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