对于这个属性,一些可以接受值是:
•是一个代表schema的URL地址的字符串。
•java.io.InputStream with the contents of the schema
•org.xml.sax.InputSource
•java.io.File
•一个 java.lang.Object 的数组,数组内容是上面所提到三类中的一个。
例如:
SAXParserFactory spfactory = SAXParserFactory.newInstance();
spfactory.setNamespaceAware(true);
//turn the validation on
spfactory.setValidating(true);
//set the validation to be against WXS
saxparser.setProperty("http://java.sun.com/xml/jaxp/properties/
schemaLanguage", "http://www.w3.org/2001/XMLSchema");
//set the schema against which the validation is to be done
saxparser.setProperty("http://java.sun.com/xml/jaxp/properties/
schemaSource", new File("myschema.xsd"));
使用JAXP的TrAX APIs来进行XML文档转换处理工作
W3C XSL-T 定义了一些转换规则来把源树转化生成结果树。在XSL-T中,转换信息所存在的文件叫样式表(stylesheet)。要用JAXP来转换一个XML文档,你需要定义一个使用样式表来转换XML文档的转换器。创建好这样的转换器后,它把要转换的XML文档作为JAXP的source,返回转换好的结果作为JAXP的result。目前JAXP提供三种类型的source和result:
StreamSource, SAXSource, DOMSource and StreamResult, SAXResult, DOMResult, 他们是能够联合使用的。
Figure4: XML Transformation
