Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Parsing XML while ignoring comments/mixed context/PI

843834Feb 9 2007 — edited Oct 10 2007
Hey everyone
Let's say I have three boolean variables representing whether or not to ignore comments, mixed context and PIs in an XML document
How would I go about to output the same XML file but without those three sections , depending on if they're true or false?
Are there features on parsers that you can set to ignore PI or ignore mixed context and such?

For example, if you would have this XML:
<root><?pi something><!--comment--></root>
and PI is set to false while comments is set to true, then the output should be
<root><!--comment--></root>
I tried for 2 hours to figure out how to start that or what to do but I'm really lost. Any help would be appreciated, Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2007
Added on Feb 9 2007
5 comments
811 views