Hi
I have an xml file containing the following tag
<custom name="custom1">
<value>acqTypeMaxNumber[Line](plot);imageSelection[Line](plot);imagePositionSet1[Line];imagePositionSet2[Line];imageSet[Surface]</value>
</custom>
Previously I was using j2se 1.4.7, and this was not a problem to parse.
Now, after uprading to j2se 5.0, this can no longer be parsed.
I am using a class with the following structure for the parsing:
public class SaxParser extends DefaultHandler {
public static void parseXmlFile(File input, String schemaLoc, DefaultHandler handler) throws Exception {
// Create a builder factory
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
// Create a parser and parse the xml file.
SAXParser parser = factory.newSAXParser();
parser.parse(input, handler);
}
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) {
// Do stuff
}
public void characters(char[] buf, int offset, int len) throws SAXException {
name = new String(buf, offset, len).trim();
// Do stuff
}
public void endElement(String namespaceURI, String sName, String qName) throws SAXException {
// Do stuff
}
private void setAttributes(SchemaElement e, Attributes atts) {
// Do stuff
}
private boolean anyNextToFound(String name) {
// Do stuff
}
}
What I see is that the characters method is being called once for every square bracket in the value tag, and once for all characters after and before the square bracket.
I have tried, without success, to write the tag using CDATA, i.e. looking like this:
<value>;imageSelection[Line](plot);imagePositionSet1[Line];imagePositionSet2[Line];imageSet[Surface]]]</value>
I have searched a lot on the internet without finding anything concerning this problem.
Does anyone have a clue of what's going on here?
Any help at all is appreciated.