I assume you're attempting to write an XML 1.0 document. 0xb isn't a legal character [1] in an XML 1.0 document.
[1] http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Kristian Spangsege" <[EMAIL PROTECTED]> wrote on 01/21/2008 04:14:06 PM: > One more problem "from the same drawer": > > > String s = ""+(char)0xb; > > document.getDocumentElement().setAttributeNS(null, "bar", s); > > Otherwise same as previous test case. > > With the bundled Xalan serializer I get: > > > An invalid XML character (Unicode: 0xffffffff) was found in the > node's character data content. > > With the native deprecated serializer I get: > > > InvalidXMLCharInDOM: An invalid XML character (Unicode: 0xb) was > found in the DOM during normalization. > > Since this is a plain old vertical tab in both ASCII and Unicode, I > really don't see why there should be any problems in serializing it as > "". Please help understand this issue. > > Regards, > Kristian Spangsege > > > On Jan 21, 2008 5:11 PM, Kristian Spangsege > <[EMAIL PROTECTED]> wrote: > > Hi, > > > > When using the Xalan serializer bundled with Xerces 2.9.1 I get a > > fatal error whenever an attribute value contains '<' (left angle > > bracket): > > > > > The value of attribute "bar" associated with an element type "foo" > > > must not contain the '<' character. > > > > I believe this is a bug since if I instead use the now deprecated > > native serializer of Xerces, I don't get the error. Also, the the "DOM > > Level 3 Core" specification under "setAttributeNS" says this: > > > > > So any markup (such as syntax to be recognized as an entity > > > reference) is treated as literal text, and needs to be appropriately > > > escaped by the implementation when it is written out. > > > > > > Here is my code: > > > > > DOMImplementationRegistry registry = DOMImplementationRegistry. > newInstance(); > > > > > > DOMImplementation core = (DOMImplementation)registry. > getDOMImplementation("Core 3.0"); > > > Document document = core.createDocument(null, "foo", null); > > > document.getDocumentElement().setAttributeNS(null, "bar", "<"); > > > > > > DOMImplementationLS ls = (DOMImplementationLS)registry. > getDOMImplementation("LS 3.0"); > > > LSSerializer serializer = ls.createLSSerializer(); > > > serializer.getDomConfig().setParameter("error-handler", new > DOMErrorHandler() > > > { > > > public boolean handleError(DOMError e) > > > { > > > System.err.println("Error: "+e.getMessage()); > > > return false; > > > } > > > }); > > > serializer.writeToString(document); > > > > > > Please let me know if this is required behaviour rather than a bug. > > > > Regards, > > Kristian Spangsege > > > > -- > "Will robots inherit the earth? Yes, but they will be our children. We > owe our minds to the deaths and lives of all the creatures that were > ever engaged in the struggle called Evolution. Our job is to see that > all this work shall not end up in meaningless waste." > -- MARVIN L. MINSKY > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]