[jdom-interest] Parsing multiple XML documents

Michel Gutierrez mig at jasm.org
Sat Jan 19 06:07:25 PST 2002


That's quite true. 

The problem may be that the derived InputStream has to scan the xml flow to 
detect the end of the document (or the begining of the next document in the 
case of a file) and this may be cpu consuming.

For my own application, I made the choice to insert a page-break (^L = 0x0C) 
to separate documents within the file (in my case a network socket). This way
the custom InputStream is quick.

/mig

On Saturday 19 January 2002 03:02, Jason Hunter wrote:
> 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@your
> >host.com
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
>st.com



More information about the jdom-interest mailing list