You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/08/01 00:07:18 UTC
DO NOT REPLY [Bug 11349] New: -
Erroneous SAX events for attribute whose type is a list type
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11349>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11349
Erroneous SAX events for attribute whose type is a list type
Summary: Erroneous SAX events for attribute whose type is a list
type
Product: Xerces2-J
Version: 2.0.2
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: SAX
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: achille@us.ibm.com
Xerces validating SAX parser version 2.0.2 incorrectly reports the value of an
attribute whose type is a list type. Note that this problem does not occur when
the validation is turned off, and did not exist in previous versions of Xerces.
SAMPLE SCHEMA (define a <person> element with a "refs" attribute of type list
of NCNames)
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="listOfNCNames">
<xsd:list itemType="xsd:NCName"/>
</xsd:simpleType>
<xsd:element name="person">
<xsd:complexType>
<xsd:attribute name="refs" type="listOfNCNames"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
SAMPLE INSTANCE :
<?xml version="1.0" encoding="UTF-8"?>
<person xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:///C:/temp/XercesTest.xsd"
refs="a b c d"/>
SAMPLE CODE : (print out the value of the "refs" attribute of <person>)
package com.ibm.sketch.connection;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
public class XercesTest {
public static void main(String[] args) throws Exception {
XMLReader ret = new SAXParser();
ret.setFeature("http://xml.org/sax/features/namespaces", true);
ret.setFeature("http://xml.org/sax/features/namespace-
prefixes", true);
ret.setFeature("http://xml.org/sax/features/validation", true);
ret.setFeature
("http://apache.org/xml/features/validation/schema", true);
ret.setFeature(
"http://apache.org/xml/features/continue-after-fatal-
error",
false);
ret.setContentHandler(new org.xml.sax.helpers.DefaultHandler() {
public void startElement(
String uri,
String localName,
String qName,
Attributes attributes)
throws SAXException {
if (localName.equals("person")) {
System.out.println("refs ='" +
attributes.getValue("", "refs") + "'");
}
}
});
ret.parse(args[0]);
}
}
OUTPUT:
refs ='d'
EXPECTED OUTPUT:
refs ='a b c d'
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org