Bug 35560 - org.xml.sax.SAXParseException: General Schema Error:
Summary: org.xml.sax.SAXParseException: General Schema Error:
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: SAX (show other bugs)
Version: unspecified
Hardware: PC Windows Server 2003
: P1 critical
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords: Xerces2
Depends on:
Blocks:
 
Reported: 2005-06-30 11:25 UTC by liuyutao
Modified: 2005-06-30 03:25 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description liuyutao 2005-06-30 11:25:30 UTC
when the work dirctory including chinese character, DOMParse cannt parse the 
current path.

for example:
the current work dir : E:\н¨Îļþ¼Ð\eclipse
the schema file : E:\н¨Îļþ¼Ð\eclipse\Model.xsd

_code:_________________________________________________________________

    DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
      Document document = domBuilder.parse(new File("Model.xml"));
      Element modelElement = document.getDocumentElement();
      modelElement.setAttribute("xmlns:xsi",
        "http://www.w3.org/2001/XMLSchema-instance");
      modelElement.setAttribute("xsi:noNamespaceSchemaLocation", "Model.xsd");
     

    
      StringReader sr = new StringReader(toXMLString(document, true));
      InputSource is = new InputSource(sr);
      DOMParser domParser = new DOMParser();      
      domParser.setFeature("http://apache.org/xml/features/allow-java-
encodings",true);
      domParser.setFeature("http://xml.org/sax/features/validation", true);
      domParser.setFeature("http://apache.org/xml/features/validation/schema",
        true);
      domParser.setFeature("http://apache.org/xml/features/validation/schema-
full-checking",
        true);
            
      
      domParser.setErrorHandler(new ErrorHandler());
      domParser.parse(is);
      sr.close();

______________________________________________________________________


result:

[Fatal Error] :0:0: File "Model.xsd" not found.
org.xml.sax.SAXParseException: General Schema Error: Stopping after fatal 
error: File "Model.xsd" not found..
	at org.apache.xerces.framework.XMLParser.reportError
(XMLParser.java:1150)
	at 
org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError
(XMLValidator.java:1712)
	at org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar
(XMLValidator.java:2732)
	at 
org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndAttri
butes(XMLValidator.java:2610)
	at org.apache.xerces.validators.common.XMLValidator.callStartElement
(XMLValidator.java:1152)
	at org.apache.xerces.framework.XMLDocumentScanner.scanElement
(XMLDocumentScanner.java:1862)
	at 
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch
(XMLDocumentScanner.java:1005)
	at org.apache.xerces.framework.XMLDocumentScanner.parseSome
(XMLDocumentScanner.java:381)
	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
	at com.sitechasia.tools.service.ServiceMain.validateXML
(ServiceMain.java:717)
	at com.sitechasia.tools.service.ServiceMain.main(ServiceMain.java:761)