https://fi.dev.java.net/issues/show_bug.cgi?id=15 Issue #|15
Summary|Parsing of escaped characters is not normalized.
Component|fi
Version|current
Platform|All
OS/Version|All
URL|
Status|NEW
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P3
Subcomponent|core
Assigned to|issues@fi
Reported by|zugarekd
------- Additional comments from
zugarekd@... Wed Jul 25 15:57:27 +0000 2007 -------
When an element's content consists of escaped characters the resulting DOM
contains multiple text nodes. Based on the DOM specifications, the first
available DOM should only contain one text node. The attached sample code
outputs a single character '<'.
The document object model specification states, "If there is no markup inside an
element's content, the text is contained in a single object implementing the
Text interface that is the only child of the element."
try {
String t1 = "<RAW_DATA_STRING><ACCOUNTS><ACCOUNT></RAW_DATA_STRING>";
//String t1 = "<RAW_DATA_STRING>1234 1234</RAW_DATA_STRING>";
XML_SAX_FI fi = new XML_SAX_FI();
byte b[] = t1.getBytes();
ByteArrayInputStream is = new ByteArrayInputStream(b);
ByteArrayOutputStream os = new ByteArrayOutputStream();
fi.parse(is, os);
DOMDocumentParser d1 = new DOMDocumentParser();
Document d2 =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
ByteArrayInputStream d3 = new ByteArrayInputStream(os.toByteArray());
d1.parse(d2, d3);
System.out.println(d2.getDocumentElement().getFirstChild().getNodeValue());
} catch (Exception e) {
e.printStackTrace();
}
---------------------------------------------------------------------
To unsubscribe, e-mail:
issues-unsubscribe@...
For additional commands, e-mail:
issues-help@...