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 Sharon Kohen <Sh...@mintech.co.il> on 2000/12/06 14:01:19 UTC

Dom parser behaves on SunOS diffrently then on NT.

Hi Gents,

When I'm using the parser on XML doc with no DOCTYPE tag I'm getting in both
platforms the same dom, the problem occurs when DOCTYPE tag included: on NT
no diffrence, but on Sun the dom includes only the name of the root element!

I'm using the following code to get the root:
		DOM_NodeList nList = m_parser->getDoc().getChildNodes();
		DOM_Node docRoot = nList.item(0); // this is the root... 


Does anyone have any idea? the document look something like that:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XMLDOC [
	.
	.
	.
]>
<XMLDOC>
	.
	.
	.
</XMLDOC>


		Waiting to hear from you Sharon.

Re: Dom parser behaves on SunOS diffrently then on NT.

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Sharon,

The code should behave the same on both platforms. The parser parses the
document and builds the tree according to the document content. Looking
at your XML snippet, the first child of the document will be a XML
declaration node (must be inserted as the first child), followed by a
DOCTYPE node, then the root element node. So, when you get the children
of a document you need to check the type of the child node. If you are
interested in getting the root element, then use
doc->getDocumentElement().

Regards,
Khaled Noaman
XML Parser Dev. - IBM Toronto Lab
knoaman@ca.ibm.com

>
> Hi Gents,
>
> When I'm using the parser on XML doc with no DOCTYPE tag I'm getting
> in both platforms the same dom, the problem occurs when DOCTYPE tag
> included: on NT no diffrence, but on Sun the dom includes only the
> name of the root element!
>
> I'm using the following code to get the root:
>                 DOM_NodeList nList =
> m_parser->getDoc().getChildNodes();
>                 DOM_Node docRoot = nList.item(0); // this is the
> root...
>
> Does anyone have any idea? the document look something like that:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE XMLDOC [
>         .
>         .
>         .
> ]>
> <XMLDOC>
>         .
>         .
>         .
> </XMLDOC>
>
>                 Waiting to hear from you Sharon.