That's great exactly what I was looking for.

 

Can you tell me how to pass the string as the first parameter to
MemBufInputSource. 

 

String xml = "<company></company>\";

 

    MemBufInputSource* memBufIS = new MemBufInputSource

    (

        (const XMLByte*)xml      <-- what do I do here

        , strlen(xml)

        , gMemBufId

        , false

    );

 

 

Thanks,

Enda

 

________________________________

From: Jesse Pelton [mailto:[EMAIL PROTECTED] 
Sent: 24 January 2007 13:17
To: [email protected]
Subject: RE: Creating DOMDoc from string

 

You need to create a MemBufInputSource. (The MemParse sample shows how
to do this.) You'll pass the MemBufInputSource to DOMBuilder::parse(),
which returns the DOMDocument.

 

________________________________

From: Mannion, Enda [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 24, 2007 7:58 AM
To: [email protected]
Subject: RE: Creating DOMDoc from string

Thanks again I think I may be able to use the DOMBuilder class. But I
want it to accept a string. The string contains an XML file, not a file
path but the whole XML file is in the string and I want the parser to
return a DOMDocument of this XML file, is this possible?

 

The DOMBuilder has parse functions but I do not see one that accepts a
string.

 

 

Thanks,

Enda

 

 

________________________________

From: Jesse Pelton [mailto:[EMAIL PROTECTED] 
Sent: 23 January 2007 19:28
To: [email protected]
Subject: RE: Creating DOMDoc from string

 

I don't understand the question. What does it mean to copy a string to a
DOMDocument? A string is just a sequence of characters, while a
DOMDocument is a hierarchical tree of nodes. Some serialization process
is required to transform one into the other.

 

If you use a DOMBuilder, the parse() method returns a DOMDocument. If
you use a parser derived from AbstractDOMParser (like XercesDOMParser),
you can call getDocument() to retrieve the document after calling
parse(). If neither of these helps, perhaps it would help to send some
pseudo-code showing what you've got so far and where you're stuck.

 

________________________________

From: Mannion, Enda [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 23, 2007 2:13 PM
To: [email protected]
Subject: RE: Creating DOMDoc from string

Thanks, but I don't want to parse I want to copy the XML string to a
DOMDocument object.

 

Is this possible or is there a way to create the DomDocument from the
parser?

 

Thanks,

Enda

 

________________________________

From: Jesse Pelton [mailto:[EMAIL PROTECTED] 
Sent: 23 January 2007 18:02
To: [email protected]
Subject: RE: Creating DOMDoc from string

 

See the MemParse sample. While it uses a SAX parser, the technique is
the same for DOM.

 

________________________________

From: Mannion, Enda [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 23, 2007 12:28 PM
To: [email protected]
Subject: Creating DOMDoc from string

Hi,

 

I have a string that contains an XML doc, how can I create an instance
of the DOMDocument class using this string.

 

Is there a constructor to do this? I can not use the DOMParser to read a
file in this case.

 

 

Thanks,

Enda

Reply via email to