Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DOM parsing using actual content of xml file passed as a String

 
shailendra shewale
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All ranchers

here is something we(i & my team member) found problem with.

we create DOM object as

DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

docBuilder.parse(
(new InputSource(new StringReader(strActualXMLFileContent)));

but it gives

com.caucho.xml.XmlParseException: stream:1: expected top element at `Element[QName[book] Attr[QName[vid] 200096f3-live] Attr[QName[cover] no]]

where,
strActualXMLFileContent is string containing actual XML file contents(& not file path)

and book,cover etc. are dom elements.

can somebody help please?

and also i will be thankful if i know is there any other methos to pass xml file 'contents' to a dom parser(other than what i have used)

shailendra shewale
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the exact contents of the String you're trying to parse?
Have you tried other parser implementations than Caucho's (for me, your current approach has always worked just fine)?
 
shailendra shewale
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Lasse ,

Thank u for taking interest in my problem.But i cannot send the input xml that i gather in a string for it is really big xml file that takes IE5 more than 5-6 minutes to open.
If u still have something to add to ur reply please do that.
Thank you
shailendra shewale
 
shailendra shewale
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and also there are company privacy reasons,please dont mind.
shailendra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic