正 文

JAXP的演进


www.7dspace.com  更新日期:2005-10-27 2:39:10  七度空间


对于这个属性,一些可以接受值是:

•是一个代表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

8页,页码:[1] [2] [3] [4] [5] [6] [7] [8] 

上一篇:快速了解IDS和IPS的区别
下一篇:AS3.0概要–了解AS3.0的改变
作者:  来源:Matrix ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐