Is there a way of getting pass these type of characters like Tabs,
Linefeeds,etc etc.

It would appear that the getNextSibling() function points to the same
element(most prolly a LineFeed+tab) everytime.

My xmldoc looks like:
<root>
        <properties>
                <propone>aaaa</propone>
                <proptwo>bbbb</proptwo>
        </properties>
        <surname>abcdef</surname>
</documentum_store_details>

code snippet:

bool Fn() { 
        ...
        ...
        ...
        DOMParser Parser;
        Parser.parse(*memBufIS);

        DOM_Document DomDoc = Parser.getDocument();
        int nPropTags=-1,nProps=-1,i=0;
        DOM_NodeList NdLsPropTags =
DomDoc.getElementsByTagName("properties");  
        
        if ((nPropTags = NdLsPropTags.getLength())!=1) {
                if (nPropTags==0) {
                        printf("No properties tag");
                }       
                else {
                        printf("More than one properties tag"); 
                }
                return false;
        }
        printf("\nPropTags\t%d\n",nPropTags);
        
        DOM_Node NdProp = NdLsPropTags.item(0); 
        DOMString dsNdNmProp = NdProp.getNodeName();
        char* pszNdNmProp = dsNdNmProp.transcode();
        printf("pszNdNmProp\t%s\n",pszNdNmProp);
        
        if(!NdProp.hasChildNodes()) 
                return true;
        
        DOM_Node Node;
        DOMString dsNdNmNode,dsNdVlNode;
        char *pszNdNmNode,*pszNdVlNode;
        int nNdTpNode=-1;i=0;
        bool flag1=true,flag2=true;
                
        while (flag1 && i<10) {
                if (flag2) {
                        Node = NdProp.getFirstChild();
                        flag2=false;
                }
                else {
                        Node = NdProp.getNextSibling();
                }
                if (Node.isNull()) {
                        printf("%d\n",i);
                        flag1=false;
                }
                else {  
                        nNdTpNode=-1;pszNdNmNode=NULL,pszNdVlNode=NULL;
                        nNdTpNode = Node.getNodeType();
                        dsNdNmNode = Node.getNodeName();
                        if((pszNdNmNode==dsNdNmNode.transcode())==NULL) 
                                pszNdNmNode="NULL";
                        dsNdVlNode = Node.getNodeValue();
                        if((pszNdVlNode==dsNdVlNode.transcode())==NULL) 
                                pszNdVlNode="NULL";     
        
printf("%d\t%d\t%s\t%s\n",i,nNdTpNode,pszNdNmNode,pszNdVlNode);
                }
                i++;
        }
        printf("\ni\t%d\n",i);  
        return false;
}

-----Original Message-----
From: David E. Cleary [mailto:[EMAIL PROTECTED]]
Sent: 23 March 2001 8:12 PM
To: [EMAIL PROTECTED]
Subject: RE: NEWBIE:Cannot get to subnode using getFirstChild


> I need help
>
> I am trying to walk through all the ChildNodes in a Node.
> I can get to the ParentNode(properties) by using getElementsByTag, but i
> can't seem to get a Node representation of the first child(propone) of the
> ParantNode(properties).
>
> My XML Document looks like:
> <?xml version='1.0' encoding='ascii'?>
> <root>
>       <surname>abcdef</surname>
>       <properties>
>               <propone>aaaa</propone>
>               <proptwo>bbbb</proptwo>
>       </properties>
> </root>

The first child is a text node that contains an LF and space or tab
characters. The second child is propone.

> Problem two
> How do I get a list of all the nodes which are only one level under a
> parentnode? If I do a ParentNode.getChildNodes, I get all the Nodes
> including the ones which lies deeper than the nodes directly under the
> parentnode.

No you don't. You get just the children of that node, which include text
nodes as well as element nodes.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to