XML DOM - getting data inbetween tags

M

Mike Miller

I am using apache's xerces (most recent) and Niko HTML to parse html
documents in to DOM objects to alter element's attribute values. After
getting html documents parsed successfully I can extract the node objects
and change the desired attributes.. My problem is this, how do I return the
document as a String after I have altered the node elements' attributes? My
other question is how can I access the data that would be in between tags
(i.e. <mytag>Text content here</mytag>)?

I have done some but limited research without much success, but I have
looked at the API's very closely and either there is something I don't
understand (which isn't inconceivable) or its not there...

If anyone could help me out on this, that would be great!

Thank you,

Mike Miller
 
M

Murat G.

AFAIK, to get the String representation of the document, you need to
write (or use) a general purpose DOM tree traversing code... I am not
aware of any interface method...

Re. data between tags: the text content within a DOM element is just a
type of node (TEXT_NODE) belonging to the child node list of that
element... You can use getChildNodes method to get a list of all child
nodes of an element and then weed out what you need.

Hope this helps,
Murat G.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top