aha!

using this method to create the node:
  Element el = doc.createElement("foo");
  el.appendChild( doc.createTextNode("bar") );

both nodeToString() and serializeAsXML() return
  <foo>bar</foo>

thanks for your help.


-----Original Message-----
From: Scott Nichol [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 26, 2004 11:14 AM
To: [EMAIL PROTECTED]
Subject: Re: xml document always null?


Apache SOAP includes a class to help serialize a Node.  In
org.apache.soap.util.xml.DOM2Writer, there is a method

    public static String nodeToString(Node node)

to get stringized XML.  There is also

    public static void serializeAsXML(Node node, Writer writer)

to output to any Writer.  I would be interested to hear what you get from
nodeToString(doc).

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "JEFF EMMINGER" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 26, 2004 10:36 AM
Subject: xml document always null?


hi all, 

i'm trying to create an xml document but all i get for output is
  el.toString = [foo: null]
  el.getNodeValue = null

can anyone see what i'm doing wrong?

[code]
import javax.xml.parsers.DocumentBuilder;
import org.apache.soap.util.xml.XMLParserUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class XmlTest {
public static void main(String[] args) {
DocumentBuilder db = XMLParserUtils.getXMLDocBuilder();
Document doc = db.newDocument();

Element el = doc.createElement("foo");
el.appendChild( doc.createTextNode("bar") );

System.out.println("el.toString = " + el.toString());
System.out.println("el.getNodeValue = " + el.getNodeValue()); } } [/code]






CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.




CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.

Reply via email to