|
Hi all,
I realize I might just be way over my head with
this stuff. Please forgive me, I am a beginner when it comes to this stuff. Plus
I am french so you can just blame everything on that :).
I am using Xerces serializer to print out an XML
document in the console. While buidling the document in memory at some point I
do :
Text myTxtNode =
myXMLDocument.createTextNode((String)
DOC_VALUES_Data.getProperty("STR_VALUE"));
DOC_VALUE_Elt.appendChild(myTxtNode); if ((String)
DOC_VALUES_Data.getProperty("STR_VALUE")) return null, the serializer bombs out
(createTextNode doesn't)
java.lang.NullPointerException
at org.apache.xml.serialize.BaseMarkupSerializer.escape(BaseMarkupSerializer.java:1287)
that's result = new
StringBuffer( source.length() );
at org.apache.xml.serialize.BaseMarkupSerializer.characters(BaseMarkupSerializer.java:910) at org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(BaseMarkupSerializer.java:732) at org.apache.xml.serialize.XMLSerializer.serializeElement(XMLSerializer.java:464) at org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(BaseMarkupSerializer.java:754) at org.apache.xml.serialize.XMLSerializer.serializeElement(XMLSerializer.java:464) at org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(BaseMarkupSerializer.java:754) at org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(BaseMarkupSerializer.java:795) at org.apache.xml.serialize.BaseMarkupSerializer.serialize(BaseMarkupSerializer.java:385) at com.silverstream.devcenter.drilldown.ServeXML.outputXMLDocumentFromInMemoryTree(ServeXML.java:574) at com.silverstream.devcenter.drilldown.ServeXML.service(ServeXML.java:144) at com.sssw.srv.busobj.AgoServletInvoker.serviceRequest(AgoServletInvoker.java:100) at com.sssw.srv.resources.AgServletResource.service(AgServletResource.java:149) at com.sssw.srv.resources.AgServletResource.perform(AgServletResource.java:107) at com.sssw.srv.http.httpd.perform(httpd.java:3692) at com.sssw.srv.http.Client.processRequest(Client.java:776) at com.sssw.srv.http.Client.loop(Client.java:1106) at com.sssw.srv.http.Client.runConnection(Client.java:1307) at com.sssw.srv.http.Client.run(Client.java:1267) at java.lang.Thread.run(Thread.java:479) Should the serializer be careful of this or should
the developper make sure the textnode string is not null ? Or should the XERCES
DOM implementation should bom out before that when I try to insert it there ? I
know that if I take the same document and process it through the Xalan XSLT
engine, the text node just return "null". Does Xalan use this serializer ?
Should it just insert an empty text node ?
I don't know what the correct behavior would be. It
just seems inconsistent the way it is.
BTW I use the following XSLT processor
:
org.apache.xalan.xslt.XSLTProcessor processor = new
org.apache.xalan.xslt.XSLTEngineImpl(new
org.apache.xalan.xpath.xdom.XercesLiaison());
and this code to serialize :
FileOutputStream XMLoutputStream = new
FileOutputStream("XMLoutputStream");
XMLSerializer serial = new XMLSerializer(oStream, of); serial.serialize(XMLdoc); TIA,
Ed.
|
- Re: Xerces serializer escape problem Erik Dasque
- Re: Xerces serializer escape problem Assaf Arkin
