You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Raghu <ra...@gmail.com> on 2006/02/21 13:18:47 UTC

How to access only immediate child nodes by name

Hi,
    I want to access immediate child DOMNodes by name.....Although
DOMElement has a method getElementsByTagName it returns a list of all
descendant nodes that have the same name....Is there a method that returns
only immediate child nodes??

Thank you!
Regards

Raghu

Re: How to access only immediate child nodes by name

Posted by Raghu <ra...@gmail.com>.
Michael,
Yes you are right.
Will have to do that I guess.
Thank you so much for your quick response.
Really appreciate it.
Thanks and regards,

Raghu



On 2/22/06, Michael Hagedorn <mi...@gmx.de> wrote:
>
> Raghu,
>
> Yes, you are right. Sorry for my misunderstanding.
> I don't see an appropriate simple method too.
>
> Looping through result of DOMNode::getChildNodes() , checking for
> (ELEMENT_NODE==NodeType) and comparing (DOMElement*)node->getTagName()
> with "module" should work. But is of course not as short and simple as
> getElementsByTagName().
>
> Regards,
> Michael
>
> Raghu wrote:
> > Micheal,
> > No the method getChildNodes returns a list of all child nodes.
> > My question is ,given the following xml
> > <list>
> >        <module>asdf</module>
> >        <module>uuu</module>
> >        <param>ttt</param>
> >        <name>gg</name>
> > </list>
> >
> > how do I retreive a list of all nodes with a particular name. For
> excample
> > how do i retreive a list of all <module>  nodes from the above xml
> file...
> >
> > Thanks and regards,
> >
> > Raghu
> >
> >
> >
> >
> > On 2/21/06, Michael Hagedorn <mi...@gmx.de> wrote:
> >
> >> Raghu,
> >>
> >> what about DOMNodeList * DOMNode::getChildNodes() ?
> >>
> >> Regards,
> >> Michael
> >>
> >>
> >> Raghu wrote:
> >>
> >>> Hi,
> >>>     I want to access immediate child DOMNodes by name.....Although
> >>> DOMElement has a method getElementsByTagName it returns a list of all
> >>> descendant nodes that have the same name....Is there a method that
> >>>
> >> returns
> >>
> >>> only immediate child nodes??
> >>> How do I do this??
> >>>
> >>> Thank you!
> >>> Regards
> >>>
> >>> Raghu
> >>>
> >>>
> >>>
> >
> >
>

Re: How to access only immediate child nodes by name

Posted by Michael Hagedorn <mi...@gmx.de>.
Raghu,

Yes, you are right. Sorry for my misunderstanding.
I don't see an appropriate simple method too.

Looping through result of DOMNode::getChildNodes() , checking for
(ELEMENT_NODE==NodeType) and comparing (DOMElement*)node->getTagName()
with "module" should work. But is of course not as short and simple as
getElementsByTagName().

Regards,
Michael

Raghu wrote:
> Micheal,
> No the method getChildNodes returns a list of all child nodes.
> My question is ,given the following xml
> <list>
>        <module>asdf</module>
>        <module>uuu</module>
>        <param>ttt</param>
>        <name>gg</name>
> </list>
>
> how do I retreive a list of all nodes with a particular name. For excample
> how do i retreive a list of all <module>  nodes from the above xml file...
>
> Thanks and regards,
>
> Raghu
>
>
>
>
> On 2/21/06, Michael Hagedorn <mi...@gmx.de> wrote:
>   
>> Raghu,
>>
>> what about DOMNodeList * DOMNode::getChildNodes() ?
>>
>> Regards,
>> Michael
>>
>>
>> Raghu wrote:
>>     
>>> Hi,
>>>     I want to access immediate child DOMNodes by name.....Although
>>> DOMElement has a method getElementsByTagName it returns a list of all
>>> descendant nodes that have the same name....Is there a method that
>>>       
>> returns
>>     
>>> only immediate child nodes??
>>> How do I do this??
>>>
>>> Thank you!
>>> Regards
>>>
>>> Raghu
>>>
>>>
>>>       
>
>   

RE: Initializing a xerces function

Posted by John Lilley <jl...@datalever.com>.
That's kind of an open question.  I suggest studying the DOMPrint example, as well as:
http://xerces.apache.org/xerces-c/domprint-3.html
http://xerces.apache.org/xerces-c/faqs-3.html

john

-----Original Message-----
From: Deepak K.B. [mailto:kbdeepak@yahoo.com] 
Sent: Tuesday, July 06, 2010 2:36 PM
To: c-users@xerces.apache.org
Subject: Initializing a xerces function

How do I initialize a Xerces function in order to call read an xml file.


Initializing a xerces function

Posted by "Deepak K.B." <kb...@yahoo.com>.
How do I initialize a Xerces function in order to call read an xml file.


Re: How to access only immediate child nodes by name

Posted by Raghu <ra...@gmail.com>.
Micheal,
No the method getChildNodes returns a list of all child nodes.
My question is ,given the following xml
<list>
       <module>asdf</module>
       <module>uuu</module>
       <param>ttt</param>
       <name>gg</name>
</list>

how do I retreive a list of all nodes with a particular name. For excample
how do i retreive a list of all <module>  nodes from the above xml file...

Thanks and regards,

Raghu




On 2/21/06, Michael Hagedorn <mi...@gmx.de> wrote:
>
> Raghu,
>
> what about DOMNodeList * DOMNode::getChildNodes() ?
>
> Regards,
> Michael
>
>
> Raghu wrote:
> > Hi,
> >     I want to access immediate child DOMNodes by name.....Although
> > DOMElement has a method getElementsByTagName it returns a list of all
> > descendant nodes that have the same name....Is there a method that
> returns
> > only immediate child nodes??
> > How do I do this??
> >
> > Thank you!
> > Regards
> >
> > Raghu
> >
> >
>

Re: How to access only immediate child nodes by name

Posted by Michael Hagedorn <mi...@gmx.de>.
Raghu,

what about DOMNodeList * DOMNode::getChildNodes() ?

Regards,
Michael


Raghu wrote:
> Hi,
>     I want to access immediate child DOMNodes by name.....Although
> DOMElement has a method getElementsByTagName it returns a list of all
> descendant nodes that have the same name....Is there a method that returns
> only immediate child nodes??
> How do I do this??
>
> Thank you!
> Regards
>
> Raghu
>
>   

How to access only immediate child nodes by name

Posted by Raghu <ra...@gmail.com>.
Hi,
    I want to access immediate child DOMNodes by name.....Although
DOMElement has a method getElementsByTagName it returns a list of all
descendant nodes that have the same name....Is there a method that returns
only immediate child nodes??
How do I do this??

Thank you!
Regards

Raghu

Re: How to access only immediate child nodes by name

Posted by Alex Karasulu <ao...@bellsouth.net>.
Raghu wrote:

>Hi,
>    I want to access immediate child DOMNodes by name.....Although
>DOMElement has a method getElementsByTagName it returns a list of all
>descendant nodes that have the same name....Is there a method that returns
>only immediate child nodes??
>  
>

You might be on the wrong mailing list.  This is for Directory (LDAP and 
Naming) projects.

Alex