How to verify the data type of a XML element child?

How to verify the data type of a XML element child?

  
My application programmatically walks through a XML DOM. But cannot differentiate between a Xml element and a String inside a XML element.
 
For each node, starting at root node, the application retrieves the node name and children, if avaiable. For each child the application repeats the previous steps and so on. The action works recusivelly calling itself and passing child nodes as arguments, in other words, it does a pre-order tree traversal.
 
The problem here is that I cannot differentiate a string of a child node. The application try to do the traversal in the string and it raises an error.
 
Ex.:
<?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#"           xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
            <xs:include schemaLocation="leiauteNFe_v3.10.xsd"/>
            <xs:element name="NFe" type="TNFe">
                  <xs:annotation>
                  <xs:documentation>Nota Fiscal Eletrônica</xs:documentation>
            </xs:annotation>
      </xs:element>
</xs:schema>
 
 
When it try to read the name of the children of xs:documentation, the following exception is raised:
      "Object reference not set to an instance of an object."
 
 
How could I test if the child of the node is a string or if it is another xml element?
 
 
 
Hi Natanael,

It would help us understand what is going on if you could share with us the eSpace where you are trying to consume that XML DOM. Would it be possible?

Cheers!
Nuno Parreira