You could TRY feeding the pom schema into JAXB to generate JAXB objects from 
it.   From there, using a JAXBContext, you can call context.createBinder and 
then use that to unmarshall the XML DOM into JAXB objects.  You can then 
manipulate the JAXB objects and then have it update the XML after word using 
the Binder.   Supposedly, the binder allows semi-preserving of the infoset 
while using the JAXB objects.

That said, I've never tried it, particularly with CDATA.  :-)

Dan



On Tuesday, August 02, 2011 6:00:25 PM John Casey wrote:
> Hi all,
> 
> I'm working on some tooling for $dayjob that needs to manipulate POM
> files according to certain rules.
> 
> The problem I'm running into is that some of the POMs it much manipulate
> contain CDATA sections, comments, etc. Also, since the modified POM
> often will be used as the basis for a patch file, I'd like to preserve
> as much of the ordering and existing whitespace in the file as possible,
> to minimize the patchfile size.
> 
> I'm currently using the JDom-driven, Modello-generated writer, coupled
> with the stock XPP3-driven reader (not the best, I know). It's losing
> the CDATA (big problem) and injecting ^M (wrong line ending, little
> problem)...
> 
> Does anyone have experience with this? Anyone maybe have an advanced POM
> reader/writer stashed somewhere that can preserve CDATA and the like?
> 
> Thanks,
> 
> -john
-- 
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to