Thanks Rob -

But I'm still not understanding things correctly or Something still isn't
working right...

I tweaked the MemParse sample to use the DOMParser, but I'm still not able
to retrieve any nodes by calling doc.getElementsByTagName().

Here's my source... It should be reproducible


    DOMParser parser;

    parser.setDoValidation(false);
    MemParseHandlers handler;
    //parser.setDocumentHandler(&handler); DOMParser has one??

    parser.setErrorHandler(&handler);

    MemBufInputSource* memBufIS = new MemBufInputSource
    (
        (const XMLByte*)gXMLInMemBuf
        , strlen(gXMLInMemBuf)
        , gMemBufId
        , false
    );

    unsigned long duration;
    try
    {
        const unsigned long startMillis =
XMLPlatformUtils::getCurrentMillis();
        parser.parse(*memBufIS);
        const unsigned long endMillis =
XMLPlatformUtils::getCurrentMillis();
        duration = endMillis - startMillis;

                DOM_Document doc = parser.getDocument();

                unsigned int elementCount = 0;

                DOM_NodeList my_nodes;

                my_nodes = doc.getElementsByTagName(DOMString("*"));
                //tried the same with 
doc.getElementsByTagName(DOMString("company"))

                elementCount == ui_nodes.getLength();

                //elementCount always = 0

    }


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 1999 11:48 PM
To: [EMAIL PROTECTED]
Cc: "Ed Draper"@pacmedia.com
Subject: Re: DOMParser questions



You want to look at class MemBufInputSource, which is in the src/internal
directory.  It is used in with the SAX parser in the sample
xml-xerces/c/samples/MemParse.  I use it with DOMParser in a Xalan sample,
in xml-xalan/c/samples/XPathWrapper.

Without error handling, etc., the code looks like this:

XMLByte* buf = ....
size_t buflen = .....

MemBufInputSource inStream(buf, buflen, "foo", false);

DOMParser parser;
parser.parse(inStream);

DOM_Document doc = parser.getDocument();


-Rob



Ed Draper wrote:

>I want to pass in a byte stream of XML data and receive a DOM_Document in
>return.



Reply via email to