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!

XML file with multiple records

843834Feb 7 2004 — edited Feb 7 2004
I have an XML data file that will look something like this (repeated possibly several hundred times):

<?xml version='1.0' encoding='utf-8'?>
<A><V>Wake up to WonderWidgets!</V>
<C>Why are great</C>
</A>
<?xml version='1.0' encoding='utf-8'?>
<A>Eric</A>

When I try to parse the code using the Echo03.java sample from the website, I get the following error: END_ELM: </>org.xml.sax.SAXParseException: XML declaration may only begin entities.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3339)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3327)
at org.apache.crimson.parser.Parser2.maybePI(Parser2.java:1107)
at org.apache.crimson.parser.Parser2.maybeMisc(Parser2.java:1233)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:638)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
at Echo03.main(Echo03.java:60)

Is there any way (short of actually reading the file and looking for the beginning of each record) that I can get the parser to do multiple stard and end documents or at least get it to read and parse all the entries in the file?

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2004
Added on Feb 7 2004
1 comment
262 views