Menu

#1 Framework can't read it's own XML files

open
nobody
None
5
2003-10-09
2003-06-17
No

Framework can't read it's own XML files.

Mistake in IPDRXMLContentHandler.

Change following code to solve:

public void characters(char[] ch, int start, int end)
throws SAXException {
//EJM PATCH:
// It is illegal to access ch[0] if start is greater then
zero...
/*
String str = "";
if (ch[0] != '\n') {
str = new String(ch, start, end);
}
/**/
// Create empty string if current character block
starts with
// eof line marker. (Why?)
String str;
if (ch[start] != '\n') {
str = new String(ch, start, end);
} else {
str = "";
}
/**/

if (tagFlag_ && !(str.trim().equals(""))) {
appendTagValue_ = appendTagValue_ + str;
}
}

Discussion

  • Erwin Molendijk

    Erwin Molendijk - 2003-06-17

    Logged In: YES
    user_id=617954

    The file is called IPDRXMLContentHandler.java to be more
    precise

     
  • Jeff Meyer

    Jeff Meyer - 2003-10-09
    • status: open --> pending
     
  • Jeff Meyer

    Jeff Meyer - 2003-10-09

    Logged In: YES
    user_id=751148

    Cannot reproduce. An example of an input XML file which
    causes this problem would be helpful.

    It would appear that any output created by the WriteTool is
    properly read.

     
  • Erwin Molendijk

    Erwin Molendijk - 2003-10-09
    • status: pending --> open
     
  • Erwin Molendijk

    Erwin Molendijk - 2003-10-09

    Logged In: YES
    user_id=617954

    The original code reads ch[0]. This is illegal if the value of
    start is greater then 0. It seems this happens sometimes.
    At the moment I'm not involved in IPDR related development,
    and I have no XML file to reproduces available. Sorry about
    that. Just read the docs about the "characters()" function.
    (Btw, the solution is also mentioned in the first bug report, so
    it shouldnt take to much time to fix)

     
  • Jeff Meyer

    Jeff Meyer - 2003-11-21

    Logged In: YES
    user_id=751148

    The testing cycle of the XML routines is done using the read
    and write tools. These do not exhibit this behavior.

    It does appear that an XML document which has whitespace
    preceding the XMLDecl, will cause this behavior.

    It turns out that it is invalid for an XML document to begin
    this way. See the grammar for well formed documents in the
    XML spec (section 2.8):

    http://www.w3.org/TR/REC-xml

    [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
    [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl?
    SDDecl? S? '?>'

    A more meaningful exception will be thrown in subsequent
    release.

     

Log in to post a comment.