This mail will come with a disclaimer. Please ignore the same, and forgive
me for it.
My XML stream (snippet):
<ObDirectMemberOfGroups><ObGroup></ObGroup><ObGroup></ObGroup></ObDirectMemb
erOfGroups>
My code snippet:
XMLCh* xDirGroupMemberTag =
XMLString::transcode("ObDirectMemberOfGroups");
DOMNodeList* DirMemberTagList =
doc->getElementsByTagName(xDirGroupMemberTag);
DOMNode* DirGroupNode = DirMemberTagList->item(0);
DOMElement* DirGroupElem = dynamic_cast<DOMElement* >
(DirGroupNode);
DOMNodeList* DirGroupsList = DirGroupElem->getChildNodes();
const XMLSize_t GroupsCount = DirGroupsList->getLength();
fprintf(stderr,"Number of Groups: %d\n",GroupsCount);
//This prints 2, as expected - the number of children of the
"ObDirectMemberOfGroups" tag is 2.
However, things change when the same XML is received as a response from
another application. There the XML comes as:
<ObDirectMemberOfGroups>
<ObGroup>
</ObGroup>
<ObGroup>
</ObGroup>
</ObDirectMemberOfGroups>
That is, the tags on separate lines. Now, the code prints the number of
children as "5". Upon investigation, I found that the 3 extra tags are
coming as "Text" tags with values as "#text", and they are inter-leaved with
the 2 expected Element tags "ObGroup".
How can I tell the parser to treat the same as a stream, and not to consider
the newlines or the white-spaces as text tags?
Any pointers/help will be gratefully received.
Regards.
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the
property of Persistent Systems Ltd. It is intended only for the use of the
individual or entity to which it is addressed. If you are not the intended
recipient, you are not authorized to read, retain, copy, print, distribute or
use this message. If you have received this communication in error, please
notify the sender and delete all copies of this message. Persistent Systems
Ltd. does not accept any liability for virus infected mails.