Hi folks,

I've just started looking at dom4j and have a couple questions I
hope someone can help me with...

I'm trying to use the package to manipulate HTML/XHTML-Transitional
documents that have mixed data elements, e.g.

   <body> Before <div>Inside</div> After</body>

I'd like able to swap out "Before" for some new text or element,
swap "Before" and "After", and otherwise make a general mess of
the document programatically.

Now when I parse this document in dom4j I end up with an Element
(body) whose text is "Before After" and another element (div)
whose text is "Inside".

In fact, the "body" Element seems to have three child nodes:

   Text    (NodeType 3)   : "Before"
   Element (NodeType 1)   : "Inside"
   Text    (NodeType 3)   : "After"


My questions:

(1) What's the simplest way to grab a list of the children
    of a given node? Build an XPath expression and use
    selectNode? Cast it as a Branch and use node() and/or
    nodeIterator()?

(2) How do I get the parent node of a Text Node? It appears as
    though Text Nodes don't implement getParent(). Am I missing
    something?

Thanks in advance for any guidance you can provide.

-Ken

----------------------------------------------------------------------
[EMAIL PROTECTED]
    






_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to