Java dom xml parser get html tags(some text) from xml?

I don't think you can get this not well-formed XML into a DOM as-is. (EDIT: or is it well-formed? ).

I don't think you can get this not well-formed XML into a DOM as-is. (EDIT: or is it well-formed? ) You would need to a) either escape the characters - making the XML well-formed and parseable (but probably not into a DOM you want, I guess you want to display the HTML in a different system) or b) parse it using a stream processor or c) fix it using string manipulation (add ) and then parse it into a DOM.HTH.

I tried CDATA which gives me text part,whereas I need tags with attributes like . I'll try to look into stream processing. – jason Aug 23 '11 at 10:25 With CDATA, you should get a node with all the content inside of fulltext - and no other nodes or attributes inside it.

Can you post some sample code? – PhilW Aug 23 '11 at 10:28 also, where did you add the CDATA instruction? And how did you retrieve the content (code sample)?

– PhilW Aug 23 '11 at 10:38.

HTML is a sub-language of XML (without getting into details related to XHTML). Therefore, there is no reason for the DOM parser not to treat those inner tags as XML tags. Maybe what you're looking for is a way to flatten what's inside?

Yes I want everythin between tag – jason Aug 23 '11 at 10:24 @jason: then you can traverse the DOM tree to find the tag, then convert it to a string. Example: coderanch.com/t/124119/XML/DOM-string – Eran Zimmerman Aug 23 '11 at 10:30 Not be be nagging, but HTML isn't really a sub-language of XML. A valid HTML document is not necessarily a valid or even well-formed XML document.

XHTML is a language built with XML syntax, HTML on the other hand is more lenient. – G_H Aug 23 '11 at 11:44 Which is exactly why I've written "(without getting into details related to XHTML)" :) – Eran Zimmerman Aug 23 '11 at 12:20.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions