<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="http://www.likecs.com/students.xsl"?>
<students>
<student sn="01">
<name>张三</name>
<age>18</age>
</student>
<student sn="02">
<name>李四</name>
<age>20</age>
</student>
</students>
<?xml version="1.0" encoding="gb2312"?> <?xml-stylesheet type="text/xsl" href="http://www.likecs.com/students.xsl"?> <students> <student sn="01"> <name>张三</name> <age>18</age> </student> <student sn="02"> <name>李四</name> <age>20</age> </student> </students>使用SAX读取XML文件:
Java代码