Using SAX "characters()" event handler I get 2 different interpretations of
the expansion of an external file. This external file is nothing more than a
text file with several lines of text and the first line is an XML comment
line.
Example external file text "onetwo.xml":
<!-- TEST ENTITY -->
One 1
Two 2
Xerces1:
Expands the text inline as expected per the external file. There is only 1
invocation of the "characters()" event handler.
Xerces1 example ouput of external text file:
CHARS:
ONE 1
Two 2
Xerces2:
Each character in the external file seems to be treated with separate
invocations of the "characters()" event handler. However, the 1st and 2nd
characters of each newline are in the same invocation.
Xerces2 example output of external text file:
CHARS:
CHARS: On
CHARS: e
CHARS:
CHARS: 1
CHARS:
CHARS: Tw
CHARS: o
CHARS:
CHARS: 2
Sample code for "characters()" event handler:
public void characters(char buf[], int offset, int len) throws SAXException {
nl(); // newline output
emit("CHARS:"); // output "CHARS:" to track invocations
String s = new String(buf, offset, len);
if (!s.trim().equals("")) // handling whitespace in code
emit(s); // output buffer string
}
Prolog entry in "mytest.xml":
<!ENTITY onetwo SYSTEM "onetwo.xml">
Code implementation of entity ref in "mytest.xml"
<sample>&onetwo;</sample>
Any thoughts?
Thank You,
Anthony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]