K.WIKI schrieb:
Hi a gain ,

I try to parse a  XML file

what i'm doing know it's like this
        XMLCh tempStr[100];
        XMLString::transcode("LS", tempStr, 99);
        DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(tempStr);
        DOMBuilder* parser =
((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,
0);


        m_xmlDoc = 0;
        m_xmlDoc = parser->parseURI(m_strValue); //strValue = "C:\\x1.xml";

until now this solution work .

But now , I want Parse a string ,
I try with parser->parseWithContext (...)

but I don't know how can add my string to parseWithContext ?? or there is
another way to do this

Thanks


You can parse a String in Memory the following way:

->Create a MemBufInputSource like this:


        MemBufInputSource* memBufIS = new MemBufInputSource
        (
        (const XMLByte*)YourString
        , static_cast<constXMLSize_t>(strlen(YourString)*sizeof(char))
        , "test"
        , false
        );

->Parse your InputSource:

        YourParser->parse(*memBufIS);

->Retrieve the DOMDocument:

        YourDOMDocument = m_parser->getDocument();

Reply via email to