You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by "Richardson, Steven" <sr...@sonusnet.com> on 2005/12/21 18:01:54 UTC

Associated COMMENT_NODE for an ELEMENT_NODE

Hi:

When walking the DOM, is there a clever way to determine the association between an XML comment and the element it is associated with?

For example, if I'm writing some code to walk the DOM trees of two XML files and want to copy certain elements from DOM1 to DOM2, how
do I also copy any optional comment for the specified element in DOM1?

The problem, as I see it, is that the comment could be above or below the associated element node.  It could also span multiple lines or consist
of multiple consecutive comment lines.

Another idea (since the XML files I'm dealing with never use TEXT_NODEs) might be to use the TEXT_NODE as documentation for a given element:

				<Foo value="some_attr_value_string">
					This TEXT_NODE serves as the documentation for the Foo element.
					It is always nicely encapsulated by the associated element.
				</Foo>


		Thanks, Steve
---------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org