[jdom-interest] Parsing multiple XML documents

Jason Hunter jhunter at servlets.com
Fri Jan 18 18:02:48 PST 2002


You just need to create a custom InputStream that gives a simulated EOF
after each document, so the parser thinks it read a full file.  Note
that if you have PIs or comments outside the root element there can be
ambiguity regarding which document it should belong to, and that's why
this feature isn't built into any parser.

-jh-

Igal Corcos wrote:
> 
> Hello,
> 
> Is there a way to parse multiple XML documents in one physical file using
> JDOM?
> 
> For example, if I have a file called Orders.xml which contains something
> like:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Orders>
> ...
> </Orders>
> <?xml version="1.0" encoding="UTF-8"?>
> <Orders>
> ...
> </Orders>
> <?xml version="1.0" encoding="UTF-8"?>
> <Orders>
> ...
> </Orders>
> 
> Is there a way to parse the file and create 3 Document objects? If not, can
> someone suggest another way to accomplish this?
> 
> Thanks.
> -Igal Corcos
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list