xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnold, Curt" <Curt.Arn...@hyprotech.com>
Subject RE: NodeList problem when using node.getChildNodes
Date Tue, 15 May 2001 19:14:26 GMT
The general list is not the appropriate forum for
questions on an specific project, the xerces-j-user
mailing list would seem to be appropriate.

You might want to give some XML and code fragments
to state the problem and also the specific version
of the Xerces parser that you are using.

It seems that you have something like:


<MyNode>Some text</MyNode>

Any you are doing something like:

NodeList list = doc.getDocumentElement().getChildNodes();

I'm not sure what you mean by:

> When I call node.getChildNodes for the result I get:
> the object having the same reference as node.
> (to be more clear I get the same thing as node, but type is NodeList)
> 
> This confuses me I expected to get one text node. 
> 

The childNodes property (which is exposed by the getChildNodes() method
in the Java binding) returns a NodeList which does not inherit from
Node.  By my reading of the spec, you should never expect getChildNodes() to
give you anything other than a NodeList, in this case a NodeList with
a length of 1.  NodeList does not inherit from Node, so I don't see
why you think it is the same thing as a Node.

Could you restate the problem on xerces-j-user and then maybe I
or someone else can answer it.  Have you read the definition of 
the childNodes property and NodeList interface in the DOM spec? http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message