java 的xml编程sax解析

java 的xml编程sax解析

ID:6760058

大小:33.00 KB

页数:7页

时间:2018-01-24

java 的xml编程sax解析_第1页
java 的xml编程sax解析_第2页
java 的xml编程sax解析_第3页
java 的xml编程sax解析_第4页
java 的xml编程sax解析_第5页
资源描述:

《java 的xml编程sax解析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、JAVA的XML编程SAX解析JAVA鐨刋ML缂栫▼SAX瑙f瀽鍒嗙被锛?J2SE2009-02-1822:35413浜洪槄璇?璇勮(0)鏀惰棌涓炬姤SAX涓昏鏄互涓茶鍜屽眰娆$殑鏂瑰紡杩涜瑙f瀽锛屽涓嬫槸涓€涓緢绠€鍗曠殑瑙f瀽渚嬪瓙锛?1銆侀€夋嫨涓€涓瑙f瀽鐨剎ml鏂囨。[java]viewplaincopy

2、.oreilly.com/javaxml2"xmlns:ora="http://www.oreilly.com"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.oreilly.com/javaxml2XSD/contents.xsdhttp://www.oreilly.comXSD/contents-ora.xsd">JavaandXML

4、cname="Transformations"/><

5、/book>2銆佷娇鐢⊿AX杩涜瑙f瀽锛屼唬鐮佸涓嬶細[java]viewplaincopypackagejavaxml2;importjava.io.IOException;importjava.io.OutputStreamWriter;importorg.xml.sax.Attributes;importorg.xml.sax.ContentHandler;importorg.xml.sax.InputSource;importorg.xml.sax.Locator;importorg.xml.sax.SAXException

6、;importorg.xml.sax.XMLReader;importorg.xml.sax.helpers.DefaultHandler;importorg.xml.sax.helpers.XMLReaderFactory;publicclassMySaxXmlextendsDefaultHandler{/***@paramargs*@throwsSAXException*@throwsException*/privateLocatorlocator;privateintindex1=0;privateintindex2=0;publ

7、icvoidcharacters(char[]ch,intstart,intlength)throwsSAXException{//TODO鑷姩鐢熸垚鏂规硶瀛樻牴//System.out.print("SAXEvent:CHARACTERS[");System.out.print("鏈功<<");try{OutputStreamWriteroutw=newOutputStreamWriter(System.out);outw.write(ch,start,length);outw.flush();}catch(Exceptione)

8、{e.printStackTrace();}System.out.println(">>鐨勭洰褰?);//System.out.println("]");}publicvoidendDocument()th

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。