This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
JDOM is a framework for XML processing that supports SAX, so you can't compare the two. You'll definitely want to use either a SAX, or StAX approach to processing the file, instead of DOM (I think you confused this with JDOM).
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Too difficult a question for “beginning”. Moving thread.
Joined: Jan 12, 2010
Thank you. I started using SAX parser and was able to parse the data except now I have hit a road block. The input XML file cannot be modified at all. I can only read it. This input file has entity referenced like &rdquo that the parser does not like. The entities are not declared within the XML file. They reside in a separate file.
In order to resolve this issue, I wrote a separate entity resolver by overriding resolveEntity. Please see my code below:
If the parser is balking at ” because it isn't properly declared by a DTD in the document, then I don't see what the point is of the string "ISO 8879-1986//ENTITIES Alternative Greek Symbols//EN" in that code.
Or is that entity reference supposed to be resolved by a schema which the parser doesn't know about?
Or is the problem that there is a DTD but the parser can't access it? That would be a problem solved by your EntityResolver, so perhaps the problem isn't that.
Anyway it would help if you told us what the actual problem was, rather than trying to get us to help with a solution which might not be the solution to the actual problem.
Joined: Jan 12, 2010
Thanks Paul. My issue is to be able to somehow ignore those non-xml entities while parsing the data. The two problems are that I cannot modify the XML file, it has no DTD declaration and the DTD itself resides outside the file.
That was the reason I started writing the Entity Resolver.