xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elena Litani <hlit...@jtcsv.com>
Subject Re: problem with getChildNodes().
Date Mon, 04 Dec 2000 17:56:59 GMT
Hi, Guoliang,
I ran your program, and results are:
return e.getChildNodes() returns <addRR>...</addRR>.
return e -> just returns a <root> element.
So there is nothing wrong with Xerces code.

I have an idea though... As you know,
return e - returns Element.
return e.getChildNodes() - returns NodeList.

So my question is - how do you access NodeList? You should use smth like:
nl.item(i).

Hope it helps,
Elena

Guoliang Cao wrote:

> Sorry.  I mean
>         return e;
> and
>         return e.getChildNodes();
> both return  <root><addRR>...</addRR><addRR>...</addRR></root>.
>
> But
>         return e.getFirstChild();
> returns <addRR>...</addRR>
>
> > Hi  there,
> >
> > I have this code section,
> >
> >         Document doc = new DocumentImpl();
> >         Element e = doc.createElementNS(PROVREQ_NAMESPACE,"root");
> >         Element elm =
> > (Element)(e.appendChild(doc.createElementNS(PROVREQ_NAMESPACE,"addRR")));
> >
> >         Node n2 =
> > elm.appendChild(doc.createElementNS(PROVREQ_NAMESPACE,"RRName"));
> >         n2.appendChild(doc.createTextNode("fadsfsadfasfadsfds"));
> >         return e.getChildNodes();
> >
> > It returns <root><addRR>....</addRR></root> instead of
> > <addRR>...</addRR>.
> > To get what I want, I have to use  e.getFirstChild().getChildNodes().
> >
> > Seems  "return e;"   and "return e.getFirstChild(); "  produce the same
> > result. This confuses me.  Can anybody explain this please?
> >
> > Thanks.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Mime
View raw message