You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by renganathan <re...@deccanetworld.com> on 2001/10/17 08:38:41 UTC
Can we create our own DOM_Nodelist
Hi,
I am new to XML. For a given element node, I declare 5 to 6 different childnodes. Now say the childnode 3, appears n times. I would like to create my own Nodelist ( of length n) with only chidenodes 3 in it. Can somebody guide me in this regard..?
Thanks in advance,
Rengan
*********************************************
Read DIGITALLY & Save TREES !!
*********************************************
RE: Can we create our own DOM_Nodelist
Posted by Erik Rydgren <er...@mandarinen.se>.
Create a filter class.
class cFilterNodeList
{
DOM_Element& m_roElement;
CString m_oWantedElementName;
public:
cFilterNodeList(DOM_Element& roElement, const char* pzElementName)
: m_roElement(roElement), oWantedElementName(pzElementName)
{}
unsigned long getLength() {
// loop over all childs of m_roElement counting only elements with
correct name
}
DOM_Node item(unsigned int nIndex) {
// Do same loop as above decreasing nIndex when element with correct
name found
// when nIndex is zero. Return current child element
}
}
It should be really easy to implement and use.
Erik Rydgren
-----Original Message-----
From: renganathan [mailto:renganathan@deccanetworld.com]
Sent: den 17 oktober 2001 08:39
To: xerces-c-dev@xml.apache.org
Subject: Can we create our own DOM_Nodelist
Hi,
I am new to XML. For a given element node, I declare 5 to 6 different
childnodes. Now say the childnode 3, appears n times. I would like to create
my own Nodelist ( of length n) with only chidenodes 3 in it. Can somebody
guide me in this regard..?
Thanks in advance,
Rengan
*********************************************
Read DIGITALLY & Save TREES !!
*********************************************