DOMParser cannot find the schema under the same path as an xml file containing
Chinese characters
-------------------------------------------------------------------------------------------------
Key: XERCESJ-1359
URL: https://issues.apache.org/jira/browse/XERCESJ-1359
Project: Xerces2-J
Issue Type: Bug
Components: JAXP (javax.xml.parsers)
Affects Versions: 2.9.1
Environment: Windows in China
Reporter: liaomingxue
Priority: Minor
Under the same directory, there are an xml file a.xml and a schema file r.xsd.
With the code below, all is ok. But if change the name of the file a.xml to a
name containing Chinese characters, then the DOMParser says it cannot find the
schema file r.xsd.
try
{
DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/validation",true);
parser.setFeature("http://apache.org/xml/features/validation/schema",true);
parser.parse("E:/a.xml");
Document doc = parser.getDocument();
}
catch(Exception e)
{
e.printStackTrace();
}
a.xml:
<?xml version="1.0" encoding="gb2312"?>
<ResourceReg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNameSpaceSchemaLocation="r.xsd">
<ResourceFig>
<ResourceKID>512 </ResourceKID>
<PortAddr>192.192.192.222:1:1 </PortAddr>
<ResourceSID>3 </ResourceSID>
</ResourceFig>
<ResourceStatus>
<ZBWZ>135,26 </ZBWZ>
<YXZT>1 </YXZT>
<CSQB>true </CSQB>
<BKF>2 </BKF>
</ResourceStatus>
</ResourceReg>
r.xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ResourceReg">
<xs:complexType>
<xs:all>
<xs:element name="ResourceFig" type="ResourceFig" minOccurs="1"
maxOccurs="1" />
<xs:element name="ResourceStatus" minOccurs="1" maxOccurs="1" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="ResourceFig">
<xs:all>
<xs:element name="ResourceKID" type="xs:unsignedShort" />
<xs:element name="PortAddr" type="xs:token" />
<xs:element name="ResourceSID" type="xs:unsignedByte" />
</xs:all>
</xs:complexType>
</xs:schema>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]