Hello ,
I'm trying to parse an XML document a get a specific node value such as
'email' in the code below. I'm using xerces 2.4. However I don't manage
to get the value for the email. Can anybody help?

thanks in advance,

david

---------------
This the output of the piece of code below

Index:0 Value:0 
Index:1 Value:0 
Index:2 Value:0 
Index:3 Value:0 
Index:4 Value:0 
Index:5 Value:0 

-----------------
This the XML file:

<?xml version="1.0" encoding="UTF-8"?>
<?proc-inst-1 'foo' ?>
<personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:noNamespaceSchemaLocation='personal.xsd'>

  <person id="Big.Boss">
    <name xml:base="foo/bar"><family  xml:base="bar/bar">Boss</family>
<given xml:base="car/bar">Big</given><?proc-inst-2 'foobar' ?></name>
    <email>[EMAIL PROTECTED]</email>
    <link subordinates="one.worker two.worker three.worker four.worker
five.worker"/>
  </person>

  <person id="one.worker" xml:base="/auto/bar">
    <name xml:base="/car/foo/"><family
xml:base="bar/bar">Worker</family>
<given>One</given></name>
    <email>[EMAIL PROTECTED]</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="two.worker" xml:base="http://www.example.com/car/car";>
    <name xml:base="/bar/foo/"><family
xml:base="foo/bar">Worker</family>
<given>Two</given></name>
    <email>[EMAIL PROTECTED]</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="three.worker">
    <name><family>Worker</family> <given>Three</given></name>
    <email>[EMAIL PROTECTED]</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="four.worker">
    <name><family>Worker</family> <given>Four</given></name>
    <email>[EMAIL PROTECTED]</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="five.worker">
    <name><family>Worker</family> <given>Five</given></name>
    <email>[EMAIL PROTECTED]</email>
    <link manager="Big.Boss"/>
  </person>

</personnel>


--------------------------
This is a piece of the code

Main.cpp
.......
 DOMDocument *doc = parser->getDocument();
 DOMElement *root = doc->getDocumentElement();
 DOMNode *node;
 XMLCh* tmpstr;
 int len;
 int i;

 XMLString::transcode("email", tmpstr ,50);

 DOMNodeList *list = doc->getElementsByTagName(tmpstr);
 len = list->getLength();

 for (i=0; i< len ;i++)
   {
     //Returns DOMnode object
     node = list->item(i);

     const XMLCh* n = node->getNodeValue();
     cout << "Index:" << i << " Value:" << n <<endl;

   }


 delete parser;
 delete errHandler;

  XMLPlatformUtils::Terminate();


 return 0;
 

}


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

Reply via email to