??xml version="1.0" encoding="utf-8" standalone="yes"?>久草福利在线视频,中文在线√天堂,亚洲综合国产激情另类一区http://www.aygfsteel.com/simie/category/23814.htmlzh-cnSat, 14 Jul 2007 15:03:27 GMTSat, 14 Jul 2007 15:03:27 GMT60Introduction to XML Schemahttp://www.aygfsteel.com/simie/archive/2007/07/14/130205.html和田?/dc:creator>和田?/author>Fri, 13 Jul 2007 16:38:00 GMThttp://www.aygfsteel.com/simie/archive/2007/07/14/130205.htmlhttp://www.aygfsteel.com/simie/comments/130205.htmlhttp://www.aygfsteel.com/simie/archive/2007/07/14/130205.html#Feedback0http://www.aygfsteel.com/simie/comments/commentRss/130205.htmlhttp://www.aygfsteel.com/simie/services/trackbacks/130205.htmlIntroduction to XML Schema
[XML Schema
介绍]

:linqingfeng
p原文: http://www.w3schools.com/schema/default.asp


XML Schema is an XML based alternative to DTD.
[XML Schema
是一U?span>XML文gcd定义的基本方?span>]

An XML schema describes the structure of an XML document.
[
每个XML Schema描述XML文档的结?span>]

The XML Schema language is also referred to as XML Schema Definition (XSD).
[XML Schema
也称?span>XML模式定义(XSD)]


What You Should Already Know
[
在学习之前你应该知道什?span>]

Before you study the XML Schema Language, you should have a basic understanding of XML and XML Namespaces. It will also help to have some basic understanding of DTD.
[
在你开始学?span>XML Schema语言之前Q你应该?span>XML?span>XML的命名空间有基本的了解。那样会帮助你了?span>DTDQ?span>Document Type Definition文gcd定义Q?span>].


What is an XML Schema?
[XML Schema
是什么?]

The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a DTD.
[XML Schema
目标是定义合法的XML文档Q就?span>DTD那样]

An XML Schema:
[
M?span>XML SchemaQ?span>]

  • defines elements that can appear in a document
    [
    定义在文档中的元?span>]
  • defines attributes that can appear in a document
    [
    定义在文档中的属?span>]
  • defines which elements are child elements
    [
    定义哪些元素为子元素]
  • defines the order of child elements
    [
    定义子元素的?span>]
  • defines the number of child elements
    [
    定义子元素的?span>]
  • defines whether an element is empty or can include text
    [
    定义元素是否为空]
  • defines data types for elements and attributes
    [
    定义元素和属性的数据cd]
  • defines default and fixed values for elements and attributes
    [
    定义元素和属性的默认值和固定?span>]

XML Schemas are the Successors of DTDs
[XML Schemas
?span>DTD的替代?span>]

We think that very soon XML Schemas will be used in most Web applications as a replacement for DTDs. Here are some reasons:
[
我们认ؓ很快XML Schemas׃替代DTD而大量应用于Web应用。原因有如下几个Q?span>]

  • XML Schemas are extensible to future additions
    [XML Schemas
    易于未来的扩?span>]
  • XML Schemas are richer and more useful than DTDs
    [XML Schemas
    ?span>DTD更有用处]
  • XML Schemas are written in XML
    [XML Schemas
    本n是XML]
  • XML Schemas support data types
    [XML Schemas
    支持数据cd]
  • XML Schemas support namespaces
    [XML Schemas
    支持命名I间]

XML Schema is a W3C Recommendation
[XML Schemas
?span>W3C推荐使用?span>]

XML Schema was originally proposed by Microsoft, but became an official W3C recommendation in May 2001.
[XML Schemas
最初由微Y提出Qƈ?span>2001q五月成?span>W3C的官Ҏ定标?span>]

The specification is now stable and has been reviewed by the W3C Membership.
[
其规格文档现已稳定ƈ加入?span>W3C标准?span>]

XML Schemas - Why?
[
Z么选用XML SchemasQ?span>]

 


There are a number of reasons why XML Schema is better than DTD.
[XML Schemas
有趣多方面优?span>DTD]


XML Schema has Support for Data Types
[XML Schemas
支持数据cd]

One of the greatest strengths of XML Schemas is the support for data types.
[XML Schemas
其中最好的斚w之一是支持数据cd]

With the support for data types:
[
Ҏ据类型提供的支持有:]

  • It is easier to describe permissible document content
    [
    易于描述文档内容是否允许]
  • It is easier to validate the correctness of data
    [
    易于验证数据的正?span>]
  • It is easier to work with data from a database
    [
    易于复合数据库操作数?span>]
  • It is easier to define data facets (restrictions on data)
    [
    易于定义数据U束]
  • It is easier to define data patterns (data formats)
    [
    易于格式化数?span>]
  • It is easier to convert data between different data types
    [
    易于数据在不同的数据cd中{?span>]

XML Schemas use XML Syntax
[XML Schemas
是用XML的语?span>]

Another great strength about XML Schemas is that they are written in XML.
[
另一个最大的优点?span>XML Schemas是用XML书写?span>]

Because XML Schemas are written in XML:
[XML Schemas
?span>XML书写的好处有Q?span>]

  • You don't have to learn another language
    [
    不用学习另一U新的语a]
  • You can use your XML editor to edit your Schema files
    [
    能在XML的编辑器中编?span>XML Schemas文g]
  • You can use your XML parser to parse your Schema files
    [
    能用XML解释器去解释XML Schemas文g]
  • You can manipulate your Schema with the XML DOM
    [
    能用XML DOM(Document Object Model,文档物g模型)操作XML Schemas文g]
  • You can transform your Schema with XSLT
    [
    能用XSLT来{?span>XML Schemas文g]

XML Schemas Secure Data Communication
[XML Schemas
数据通信更安?span>]

When data is sent from a sender to a receiver it is essential that both parts have the same "expectations" about the content.
[
当数据从发送方传递给接受Ҏ, XML Schemas会让昄的内容达C?span>”期望”]

With XML Schemas, the sender can describe the data in a way that the receiver will understand.
[XML Schemas
文g能让发送方的数据被接受Ҏ解释]

A date like this: "03-11-2004" will, in some countries, be interpreted as 3. November and in other countries as 11. March, but an XML element with a data type like this:
[
例如一个日期的表述” 03-11-2004”,在某些国家会被解释ؓ11?span>3?/st1:chsdate>,而在另一些国家却被解释成3?span>11?/st1:chsdate>],而相同的数据?span>XML上表q成:

<date type="date">2004-03-11</date>

ensures a mutual understanding of the content because the XML data type date requires the format YYYY-MM-DD.
[
׃XML数据cd定义了他的格式是YYYY-MM-DD,从而能正的表述其内容的含义]


XML Schemas are Extensible
[XML Schemas
是可扩展?span>]

XML Schemas are extensible, just like XML, because they are written in XML.
[XML Schemas
是可扩展?span>,像普通的XML一?span>,因ؓ他本w就是一?span>XML]

With an extensible Schema definition you can:
[
可扩展性的定义带来的好处有Q?span>]

  • Reuse your Schema in other Schemas
    [
    可从用你的规则与其他规则]
  • Create your own data types derived from standard types
    [
    从其他的标准的数据类型中创徏自定义的数据cd]
  • Reference multiple schemas from the same document
    [
    同一个文档可以引用多个规?span>]

Well-Formed is not Enough
[
良好格式qƈ不?span>]

A well-formed XML document is a document that conforms to the XML syntax rules:
[
一个具有良好格式的XML文档是完全符?span>XML的语法规则的Q?span>]

  • must begin with the XML declaration
    [
    必须?span>XML声明开?span>]
  • must have one unique root element
    [
    必须有且仅有一个根节点]
  • all start tags must match end-tags
    [
    所有标{N必须有相对的l束标签]
  • XML tags are case sensitive
    [XML
    的标{是区分大小写的]
  • all elements must be closed
    [
    所有的元素都必L闭合?span>]
  • all elements must be properly nested
    [
    所有元素都必须合理的嵌?span>(元素不可以交?span>)]
  • all attribute values must be quoted
    [
    所有的属性都必须被引?span>]
  • XML entities must be used for special characters
    [
    所有的XML实体都必ȝҎ的字W来?span>]

Even if documents are Well-Formed they can still contain errors, and those errors can have serious consequences. Think of this situation: you order 5 gross of laser printers, instead of 5 laser printers. With XML Schemas, most of these errors can be caught by your validating software.
[
即文档完全W合格式也会包含错误,而且有些错误会有严重的逻辑问题.想一惌L情况:你订购五台激光打印机是ؓ了来替代五台Ȁ光打印机.配合XML Schemas,大部分的错误都可以由你的软g校验出来?span>.]

XSD How To
[XSD
如何]


XML documents can have a reference to a DTD or an XML Schema.
[XML
文档能和一?span>DTD或者一?span>XML Schema相关]


A Simple XML Document
[
一个简单的XML文档]

Look at this simple XML document called "note.xml":
[
看看q个名ؓ"note.xml"?span>XML文档]

<?xml version="1.0"?>

<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

 


A Simple DTD
[
一个简单的DTD]

This is a simple DTD file called "note.dtd" that defines the elements of the XML document above ("note.xml"):
[
q个单的DTD"note.dtd"定义?span>"note.xml"中的元素:]

<!ELEMENT note (to, from, heading, body)>

<!ELEMENT to (#PCDATA)>

<!ELEMENT from (#PCDATA)>

<!ELEMENT heading (#PCDATA)>

<!ELEMENT body (#PCDATA)>

Line 1 defines the note element to have four elements: "to, from, heading, body". Line 2-5 defines the to element to be of the type "#PCDATA", the from element to be of the type "#PCDATA", and so on...
[
W一行定义了note元素有四个子元素: "to, from, heading, body".而第二行到第五行分别定义?strong>to?strong>from{元素ؓ"#PCDATA"]


A Simple XML Schema
[
一个简单的XML Schema]

This is a simple XML Schema file called "note.xsd" that defines the elements of the XML document above ("note.xml"):
[
q个单的XML Schema文g"note.xsd"同样定义?span>"note.xml"中的元素Q?span>]

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.w3schools.com"

xmlns="http://www.w3schools.com"

elementFormDefault="qualified">

<xs:element name="note">

    <xs:complexType>

      <xs:sequence>

        <xs:element name="to" type="xs:string"/>

        <xs:element name="from" type="xs:string"/>

        <xs:element name="heading" type="xs:string"/>

        <xs:element name="body" type="xs:string"/>

      </xs:sequence>

    </xs:complexType>

</xs:element>

</xs:schema>

The note element is said to be of a complex type because it contains other elements. The other elements (to, from, heading, body) are said to be simple types because they do not contain other elements. You will learn more about simple and complex types in the following chapters.
[
那个note元素׃包含有其他的子元素而被定义?strong>complex type(复合cd). 其他包含在它里面的元?span>(to, from, heading, body)都被定义?strong>simple types(单类?span>). 你将会在以后的章节里面学到更多关于复合类型和单类型的知识.]


A Reference to a DTD
[DTD
的引?span>]

This XML document has a reference to a DTD:
[
q个XML文档引用自一?span>DTD:]

<?xml version="1.0"?>

<!DOCTYPE note SYSTEM

"http://www.w3schools.com/dtd/note.dtd">

<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

 


A Reference to an XML Schema
[XML Schema
的引?span>]

This XML document has a reference to an XML Schema:
[
q个XML文档引用自一?span>XML Schema文档:]

<?xml version="1.0"?>

<note

xmlns="http://www.w3schools.com"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.w3schools.com note.xsd">

 

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

 

XSD - The <schema> Element
[XSD
中的<schema>元素]


The <schema> element is the root element of every XML Schema!
[<schema>
元素是每一?span>XML Schema文g的根元素!]


The <schema> Element
[<schema>
元素]

The <schema> element is the root element of every XML Schema:
[[<schema>
元素是每一?span>XML Schema文g的根元素:]

<?xml version="1.0"?>

<xs:schema>

...

...

</xs:schema>

The <schema> element may contain some attributes. A schema declaration often looks something like this:
[[<schema>
元素包含一些属?span>.一般声明如?span>:]

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.w3schools.com"

xmlns="http://www.w3schools.com"

elementFormDefault="qualified">

...

...

</xs:schema>

The following fragment:
[
以下片段:]

xmlns:xs="http://www.w3.org/2001/XMLSchema"

indicates that the elements and data types used in the schema (schema, element, complexType, sequence, string, boolean, etc.) come from the "http://www.w3.org/2001/XMLSchema" namespace. It also specifies that the elements and data types that come from the "http://www.w3.org/2001/XMLSchema" namespace should be prefixed with xs:
[
说明元素和数据类型的使用模式(schema, element, complexType, sequence, string, Boolean{等)来自?span>"命名I间.同时也可?strong>xs:作ؓ前缀]

This fragment:
[
如下片段:]

targetNamespace="http://www.w3schools.com"

indicates that the elements defined by this schema (note, to, from, heading, body.) come from the "http://www.w3schools.com" namespace.
[
说明元素(note, to, from, heading, body.)的用模式来自于命名I间"http://www.w3schools.com"]

This fragment:
[
如下片段:]

xmlns="http://www.w3schools.com"

indicates that the default namespace is "http://www.w3schools.com".
[
说明默认的命名空间是"http://www.w3schools.com".]

This fragment:
[
如下片段:]

elementFormDefault="qualified"

indicates that any elements used by the XML instance document which were declared in this schema must be namespace qualified.
[
说明所有全局元素的子元素被以缺省方式放到目标命名空_q同全局元素或者类型一?span>]


Referencing a Schema in an XML Document
[
?span>XML文g中引?span>Schema]

This XML document has a reference to an XML Schema:
[
如下XML文档有一?span>XML Schema的引?span>:]

<?xml version="1.0"?>

<note xmlns="http://www.w3schools.com"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.w3schools.com note.xsd">

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

The following fragment:
[
下面片段:]

xmlns="http://www.w3schools.com"

specifies the default namespace declaration. This declaration tells the schema-validator that all the elements used in this XML document are declared in the "http://www.w3schools.com" namespace.
[
声明默认的命名空?span>.此声明告知模式校验器让所?span>XML元素都在命名I间"http://www.w3schools.com"?span>]

Once you have the XML Schema Instance namespace available:
[
有时你可以用?span>XML模式实例命名I间:]

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

you can use the schemaLocation attribute. This attribute has two values. The first value is the namespace to use. The second value is the location of the XML schema to use for that namespace:
[
你能用上schemaLocationq个属?span>.q个属性有两个含义.W一个含义是q个命名I间被?span>.W二个含义是定位XML schema用到的命名空?span>:]

xsi:schemaLocation="http://www.w3schools.com note.xsd"



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=705007



]]>
RSShttp://www.aygfsteel.com/simie/archive/2007/07/14/130204.html和田?/dc:creator>和田?/author>Fri, 13 Jul 2007 16:37:00 GMThttp://www.aygfsteel.com/simie/archive/2007/07/14/130204.htmlhttp://www.aygfsteel.com/simie/comments/130204.htmlhttp://www.aygfsteel.com/simie/archive/2007/07/14/130204.html#Feedback0http://www.aygfsteel.com/simie/comments/commentRss/130204.htmlhttp://www.aygfsteel.com/simie/services/trackbacks/130204.html内容目录

RSS Introduction [RSS介绍]
An introduction to what RSS is and how it can be used.
介绍什么是RSSQ它的应用?/p>

RSS History [RSS历史]
How RSS started and how it has been developed and changed
RSS是怎么诞生的,它是怎样发展和变化的.

RSS Syntax [RSS语法]
A brief introduction how to make RSS.
制作RSS的简单介l?/p>

RSS Channel [RSS频道]
How to make and what can be included in the <channel> element.
怎么完成<channel>元素里的内容

RSS Item [RSS内容]- How to make and what can be included in the <item> element.
怎样?lt;item>元素才算合理?/p>

RSS Publishing [RSS 发布]- How to publish your RSS.
怎样发布的你的RSS

RSS Readers [RSS阅读器]- How to read other site's RSS.
怎样阅读其他|站的RSS


RSS介绍
译QLinyupark / 2006-04-24

RSS was designed to share data like headlines, links and short descriptions of these.
RSS 数据分成像标题Q连接和单描q的形式。(羃q的信息Q?

RSS allows fast browsing for news and updates.
RSS能快速浏览新d更新内容?/p>


What You Should Already Know
哪些是你应该已经知道?/h2>

Before you continue you should have a basic understanding of the following:
在l学习前你应该有下面q些知识点的基础Q?/p>

  • HTML / XHTML
  • XML / XML 命名I间

What is RSS?
什么是RSSQ?/h2>
  • RSS stands for Really Simple Syndication
    RSS是 Really Simple Syndication Q真正的单聚合)
  • RSS allows you to syndicate your site content
    RSS可以聚合你网站上的内?
  • RSS is a selected list of defined items on a site
    RSS是一站点上被选中的内Ҏ?
  • RSS defines an easy way to share and view headlines and content
    RSS是一U更便捷的方法去查看标题和内?
  • RSS files can be automatically updated
    RSS文g可以自动的更?
  • RSS allows personalized views for different sites
    RSS允许更具人性化Q个性化Q的查看不同的站?
  • RSS is written in XML
    RSS是用XML来书写的

Why Use RSS?
Z么用RSSQ?/h2>

RSS was designed to show selected data.
RSS 能展C选择的数据(针对性)

Without RSS, users will have to check your site daily to check for new updates. This may be too time-consuming for many users. With an RSS feed (RSS is often called a News Feed or RSS Feed) they can check your site faster using an RSS aggregator (a site or program that gathers and sorts out several RSS feeds).
没有RSS的话Q用户将必须每天C的站上看看有没更新内宏V这对于一些用h说是很浪Ҏ间的。通过一个RSS feed他们可以使用RSS阅读器更快的查看你的站是否有更新?/p>

Since RSS data is small and fast-loading, it can easily be used with services like cell phones or PDA's.
因ؓRSS数据很小而且加蝲速度很快Q它可以Ҏ的在手机或PDA服务上用?/p>

Web-rings with similar information can easily share data on their sites to make them better and more useful.
Wb-rings通过怼的信息可以方便的׃n他们站点的信息?/p>


Who Should Use RSS?
哪些人应该用RSSQ?/h2>

Webmasters who seldom update their sites do not need RSS.
站长如不是经常更新站带内信息的话可以不用RSS

RSS can be useful for Web sites that are updated frequently, like:
RSS对于那些l常更新的站Ҏ说是和有帮助的,像:

  • News sites - Lists news with title, date and descriptions
    新闻?
  • Site changes - Lists changed pages or new pages
    站点改动信息版块
  • Companies - Lists news and new products
    公司?- 新闻 ?C?
  • Calendars - Lists upcoming events and important days
    日历

The Future of RSS
展望RSS

RSS is going to be everywhere.
RSS遍及每个角?

Thousands of sites use RSS and more people understand its usefulness every day.
数千站用着RSSq且每天有越来越多的人明白了它的有用之处?/p>

By using RSS, information on the Web becomes easier to find and web developers can spread their information more easily to special interest groups.
有了RSSQ在WEB上的信息变的Ҏ扑ֈq且WEB开发者能够容易的信息传播给兴趣组?/p>

Hopefully, future RSS versions will include additional fields that will make it even easier to categorize and share.
未来的RSS版本可能包含额外的领域来使分cd分n信息来的更容易?/p>

RSS的历?br>译QLinyupark / 2006-04-24

RSS has been released in many different versions.
RSS发布q一些不同的版本


The History of RSS
RSS的历?

Here is the history of RSS according to Dave Winer (key developer of most of the RSS formats):
依据Dave WinerQRSS开发的关键人物Q的描述QRSS有这L历史Q?/p>

  • Dec. 1997 - Dave Winer developed scriptingNews
    1997q?2?Dave Winer 开发了新闻脚本
     
  • Mar. 1999 - RSS 0.90 was developed by Netscape, which supported the scriptingNews format. This was simply XML with a RDF Header
     1999q三?- RSS 0.90 q景公司开?支持格式化新闻脚?
  • Jun. 1999 - scriptingNews 2.0b1 was developed by Dave Winer at UserLand. This included Netscape's RSS 0.90 features
    新闻脚本2.0b1?1999q?月由Dave Winer开发,包含了网景RSS 0.90的特?br> 
  • Jul. 1999 - RSS 0.91 was an attempt by Netscape to move towards a more standard format and included most features from scriptingNews 2.0b1 but they removed the RDF header
    1999q??- RSS0.91 |景试图Ud更多的标准格式ƈ包含更多来自scriptingNews2.0b1的特性但是他们却删除了RDF? 
  • Jul. 1999 - UserLand uses RSS 0.91 and gets rid of scriptingNews
    1999q??- UserLand利用了没有scriptNews的RSS0.91
     
  • Netscape discontinues their RSS development
     |景中断了他们对RSS的开?
  • Jun. 2000 - Official RSS 0.91 specification release from UserLand
     UserLand公开了规范文?br>
  • Aug. 2000 - RSS 1.0 developed by a group lead by Rael Dornfest at O'Reilly. This format uses RDF and namespaces. Because of its name it is often confused as being a new version of 0.91, but this is a completely new format with no ties to RSS 0.91
     
  • Dec. 2000 - RSS 0.92 developed by Dave Winer at UserLand and includes optional elements
     
  • Sep. 2002 - RSS 2.0 is designed by Dave Winer after leaving Userland
     
  • Jul. 2003 - RSS 2.0 specification released through Harvard under a Creative Commons license

What Are The differences?
有什么区别?

Unlike the other RSS formats, RSS 1.0 was developed using the W3C RDF (Resource Description Framework) standard.
不像其他RSS的规?RSS1.0使用W3C的DRF标准开?


What RSS Version Should I Use?
我该用哪个版本的RSSQ?/h2>

RSS 0.91 and RSS 2.0 are easiest to understand. RSS 1.0 is more complex to learn and takes more time and bandwidth to process.
RSS0.91和RSS2.0是最Ҏ理解的版本?.0学v来比较复杂而且需要花更多的带宽来q作?/p>

Our tutorial is based on RSS 2.0.
我们的教E是ZRSS2.0?/p>


Is There an RSS Web Standard?
有RSS WEB标准吗?

There is no official standard for RSS. But about 50 % of all RSS feeds use the RSS 0.91 format. About 25 % use the RSS 1.0 format and the last 25 % is split between the other RSS 0.9x versions and RSS 2.0.
没有正式的RSS标准。但在所有的RSS feeds中大U有50% 使用RSS 0.91规格. 25%使用RSS1.0规格q且臛_?5%使用 RSS 0.9x ?RSS 2.0之间的版本?/p>

RSS语法
译QLinyupark / 2006-04-24

The syntax rules of RSS 2.0 are very simple and very strict.
RSS2.0的语法规则非常简单ƈ十分的严根{?/p>

This tutorial teaches how to create your own RSS feed and maintain it.
q个教程会教你如何徏立你自己的RSS feedq维护它?/p>


An Example RSS document
一个RSS文档的例?/h2>

RSS documents use a self-describing and simple syntax.
RSS文档使用了简单的自描q语法?/strong>

<?xml version="1.0" encoding="ISO-8859-1" ?>

<rss version="2.0">
<channel>

<title>W3Schools</title>
<link>http://www.w3schools.com</link>
<description>W3Schools Web Tutorials </description>
<item>
<title>RSS Tutorial</title>

<link>http://www.w3schools.com/rss</link>
<description>Check out the RSS tutorial
on W3Schools.com</description>
</item>
</channel>
</rss>

The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the ISO-8859-1 (Latin-1/West European) character set.
文档内的W一行ؓXML声明-定义了XML的版本和文档使用的字W编码。这个例子里文档使用的是XML1.0版本,~码?ISO-8859-1.

The next line describes the RSS element of the document (like it was saying: "this is an RSS document - version 2.0"):
下面的一行描qRSS文档元素Q这个就像在?"q是一份RSS2.0版本的文?Q?/p>

<rss version="2.0">

The next line describes the <channel> element of the document:
再下面的一行描qC文档?lt;channel>元素:

<channel>

The next three lines describe three child elements of the <channel> element (<title>, <link> and <description>):
接下来的三行描述?lt;channel>的三个子元素Q?lt;title>,<link>,<description>Q?/p>

<title>W3Schools</title>
<link>http://www.w3schools.com</link>

<description>W3Schools Web Tutorials</description>

Then there is an <item> element. The <item> element contains the information you would like your RSS feed to show (<title>, <link> and <description>). You can add multiple <item> elements:
然后是<item>元素,<item>元素包含了RSS展示的一些信息(<title>, <link> ?<description>Q你可以dC<item>元素Q?/p>

<item>
<title>RSS Tutorial</title>
<link>http://www.w3schools.com/rss</link>
<description>Check out the RSS tutorial
on W3Schools.com</description>
</item>

Finally, the two last lines close the <channel> and <rss> elements:
最后的两行关闭<channel> ?<rss> 元素Q?/p>

</channel>
</rss>

Did you understand that this was an RSS feed from W3Schools? Don't you agree that RSS is pretty self-descriptive?
你明白这是个来自W3S的RSSfeed了不Q难道你不认是个很好的RSS自我描述Q?/p>


RSS is an XML Dialect
RSS 是一UXML的方a

Because RSS is XML, there are a couple of things you must remember.
因ؓRSS是XMLQ有一些事你必M?/strong>

  • All XML elements must have a closing tag
    所有XML元素必须有关闭标{?
  • XML tags are case sensitive
    XML标签区分大小?
  • All XML elements must be properly nested
    所有XML元素必须合理嵌套
  • Attribute values must always be quoted
    属性值必d引号?

Comments in RSS
RSS注释

The syntax for writing comments in RSS is similar to that of HTML:
书写RSS注释的语法和HTML十分怼Q?

<!-- This is a comment -->


RSS channel元素
译QLinyupark / 2006-04-24

The <channel> element is where you describe your RSS feed.
<channel>元素内是描述RSS feed的地?/p>

With RSS 2.0 there are a lot of different options for the channel element.
对于channel元素来说RSS2.0有很多不同的选择Q指内部可选择的元素有很多U)


The <channel> Element
<channel>元素

The RSS <channel> element is where items are displayed. It is like an RSS headline. Channel elements normally do not change very often.
RSS?lt;channel>元素是项目内ҎC的地方。它像RSS的标题。一般来讲它不会频繁的改动?/p>

There are three required elements inside the <channel> element: <title>, <link>, and <description>.
有三个内部元素是必须有的:<title>, <link>, ?<description>.

The <title> element should contain a short description of your site and your RSS feed:
<title>元素里应该包含你的站和你的RSS feed短的说明Q?/p>

<title>W3Schools News Update</title>

The <link> element should define the link to your site's main page:
<link>元素应该定义你网站主늚铄Q?/p>

<link>http://www.w3schools.com</link>

The final required element is <description>. This element should describe your RSS feed.
最后必L的元素就?<description>,q个元素应该描述你的RSS feed.

<description>W3Schools Web Tutorials</description>


Optional Elements in <channel>
<channel>内的可选元?/h2>
Element 元素 Description 描述
<category> Defines one or more categories the channel belongs to
定义一个或多个频道分类
<cloud> Allows notification of updates.
允许更新通告
<copyright> Notifies about copyrighted material
提醒有关版权
<docs> An URL to documentation on the RSS version the channel is using
频道所使用的RSS版本文档URL
<generator> If the channel is created using an automatic generator, this is defined here
如果频道是自动生成器产生的,在q里定义
<image> Inserts a picture to the channel.
l频道加囄
<language> Describes what language the channel uses. By using this tag it is possible for RSS aggregators to group sites based on language.
描述了频道所使用的语a?/td>
<lastBuildDate> Defines the last date the channel was modified
定义频道最Cơ改动的旉
<managingEditor> Defines an e-mail address for the editor of the site
定义~辑站点人员的E-mail地址
<pubDate> Defines the last publication date for the channel
定义频带最新的发布旉
<rating> Parental control rating of the page
面评估
<skipDays> Defines days where it is unnecessary for RSS aggregators to update the feed
<skipHours> Defines hours where it is unnecessary for RSS aggregators to update the feed
<textInput> Creates a text input for the channel
<ttl> (ttl = time to live) Defines how many minutes the channel can stay cached before refreshing
存活的有效时?/td>
<webMaster> Defines an e-mail address for the webmaster of the site
定义站张的邮件地址

RSS item 元素
译QLinyupark / 2006-04-24

The <item> element is where you link to and describe the update on your site.
<item>元素内是你网站连接和描述更新内容的地斏V?/p>

With RSS 2.0 there are a lot of different options for the item element.
在RSS 2.0 item元素里有很多不同的可选内?/p>


The <item> Element
<item>元素

The RSS <item> is where updates are displayed. It is kind of like a headline for an article. <item> elements are created every time there is an update on your site that you would like displayed in your RSS feed.
<item>是显CRSS更新内容的地斏V它像是文章的标题。当你的站点有更新时RSSfeed中的<item>元素׃被徏立v来?/p>

There are several optional <item> elements, but either the <title> or the <description> are required.
<item>元素里有几个可选的元素,?lt;title> 或是<description>是必L的?/p>

A RSS <item> should include the <title>, <link> and <description> elements.
一个RSS?lt;item>应该包括 <title>, <link> ?<description>元素

The first element is your news item's title. This should be a very short description of your site and your RSS feed:
W一个元素是目的题目。应该用十分短的描述Q?/p>

<title>W3Schools New RSS Tutorial</title>

The next element is the link to the part of your site the item is referring to:
接下来的元素目所兌的连接:

<link>http://www.w3schools.com/rss</link>

The next line is the RSS feed description. This should describe your RSS feed item.
再下面的一行就是RSS feed的描q部?q应该是描述你的RSS feed目的?/p>

<description>W3Schools RSS Tutorial</description>


Optional Elements in <item>
可选的<item>元素

Tag Description
<author> Defines the author of the item.
定义作?/td>
<category> Places the item in one or more of the channel categories.
cd
<comments> An URL to a comment's page for the item.
针对目的评论页URL
<enclosure> Describes a media object related to the item
描述一个与目有关的媒体对?/td>
<guid> GUID = Globally Unique Identifier. Defines a unique identifier to the item.针对目定义独特的标?/td>
<pubDate> The publication date for the item.
目发布旉
<source> Is used to define a third party source.
转蝲地址Q源地址Q?/td>

RSS发布
译QLinyupark / 2006-04-24

Having a RSS feed is no good unless other people can see it.
光有RSS feedq是不够的,应该让别看到?/p>


Publish Your RSS Feed
发布你的RSS feed

Publishing and getting people to notice your RSS feed is as important as making one.
发布q让Z注意到的你RSS和你制作它一样重?/p>

First, put your rss.xml file on the internet. You can place it on the same server as your site.
首先Q将你的RSS.xml文g攑ֈ你的站点服务器上?/p>

Next, let people know you have a RSS feed. Register your feed with an aggregator.
然后Q让Z知道你有一个RSSfeed.到相关的目录站上注册你的RSSQ下面是一些国外知名的RSS发布站)

  • Syndic8: The largest RSS directory. Syndicate has over 300,000 feeds listed. Register your feed here.
  • Daypop: A large news oriented RSS aggregator. Over 50,000 news oriented feeds. Register your feed here.
  • Newsisfree: A news oriented RSS aggregator. Over 18,000 feeds. Register your feed here.

Then, place this RSS Logo and this XML Logo with URL's to a page that explains briefly how other people can view your RSS feed.
接着Q?这两个含有q接CRSS地址的图片放C站点的页面上Qh们就可以看到你的RSS feed?


Can I Manage my RSS Feed Myself?
我可以自行管理RSS feed吗?

The best way to be sure your RSS feed includes the things you want, and works the way you want, is to manage it yourself. But this can be very time consuming, especially for pages with a lot of updates.
如你惌RSS里包括一些你惌的东西或是想按你的想法来做,最好的办法是你自己来理它,但是q将是非常烦琐的Q因为很多页有不同的东西要更新?/p>

Your other alternative is to use a third party automated RSS.
q有U选择是使用W三方的RSS自动生成?/p>


Automated RSS
RSS自动生成

If you don't want to update your RSS feed yourself, there are tools and services you can use to automate it.
如果你不惌己来更新RSSQ这有些工具可以Z服务?br>===== 以下是几个工L官方地址=====

One such service is MyRSSCreator (featured in "RSS for dummies"), who can offer an automated, reliable RSS service in just 10 minutes.

There are also free services such as FeedFire, who offers free creation and distribution of RSS feeds.

For users who just need an easy RSS feed for their personal website, some of the most popular blog (Web Log) managers (like Blogger and Radio) offers built in automated RSS services.


Validate
校验

You can validate your RSS feed here[校验地址]. This validator supports all RSS versions.


 

RSS阅读?br>译QLinyupark / 2006-04-24

A RSS reader gathers your news for you.
一个RSS阅读器可以ؓ你收集新?/p>

RSS readers are available for many different devices and OS.
RSS阅读器可以在很多不同的设备和操作pȝ上运?/p>


RSS Readers
[下面是国外的几款阅读器]

There are a lot of different RSS readers. Some work as web services, and some are limited to windows (or Mac, PDA or UNIX). Here are a few I have tried and liked:

  • NewsGator Online - An free online based RSS aggregator. NewsGator Online also includes synchronization with Outlook Edition, viewing content on TV with Media Center Edition, as well as the publication of blogs and headlines.
     
  • RssReader - A free Windows based RSS aggregator. RssReader supports RSS versions 0.9x, 1.0 and 2.0 as well as Atom 0.1, 0.2 and 0.3.
     
  • FeedDemon - A great Windows based RSS aggregator. This is very easy to use and has a very orderly interface. But this is not freeware.
     
  • blogbot - A RSS aggregator plugin for your Outlook or Internet Explorer. The lite version for Internet Explorer is free.

There are a lot of other RSS readers out there. http://www.ourpla.net/cgi-bin/pikie.cgi?RssReaders has a big list of RSS readers, you can even add your own readers to this page or comment on the existing ones.



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=704849



]]>
JAXP 专述http://www.aygfsteel.com/simie/archive/2007/07/06/128540.html和田?/dc:creator>和田?/author>Fri, 06 Jul 2007 04:40:00 GMThttp://www.aygfsteel.com/simie/archive/2007/07/06/128540.htmlhttp://www.aygfsteel.com/simie/comments/128540.htmlhttp://www.aygfsteel.com/simie/archive/2007/07/06/128540.html#Feedback0http://www.aygfsteel.com/simie/comments/commentRss/128540.htmlhttp://www.aygfsteel.com/simie/services/trackbacks/128540.html2000 q?11 ?01 ?/p>
q是细?JAXPQSun ?Java API for XML 的文章,帮助解除了有?JAXP 本质和服务目的的疑惑。本文讲解了 JAXP 的基本概念,演示 XML 语法分析Z么需?JAXPQƈ昄如何L更改 JAXP 使用的语法分析器。本文还q一步讲qC SAX ?DOM q两个流行的?JAXP 相关?Java ?XML API?/blockquote>

Java ?XML 在每一个技术领域都刉了新闻Qƈ且对于Y件开发h员来_g?1999 q和 2000 q最重要的发展。结果,Java ?XML API 的数量激增。其中两个最行?DOM ?SAX q引h大兴,?JDOM 和数据绑?API 也接t而来。只透彻理解q些技术中的一个或两个是一艰巨Q务,而正用所有这些技术就会您成Z家。但在去q_另一?API lh留下了深d象,它就?Sun ?Java API for XMLQ通常UCؓ JAXP。如果考虑?Sun 在其q_上还没有M特定?XML 的品,那么q个q展׃ؓ奇。而o人惊奇的是h们对 JAXP 了解的缺乏。多C用它的开发h员在他们所用的q个 API 的概느解上都有错误?/p>

什么是 JAXPQ?/span>

本文假设您有 SAX ?DOM 的基本知识。这里实在没有够篇q来解释 SAX、DOM ?JAXP。如果您?XML 语法分析的新手,那么可能要通过联机资源阅读 SAX ?DOMQ或者浏览我的书。( 参考资?/font> 一节中有至 API 和我的书的链接。)获得基本知识后再看本文会比较好?





回页?/font>


API q是抽象Q?/span>

在讲解代码之前,介绍一些基本概念很重要。严格地_JAXP ?APIQ但是将其称为抽象层更准。它不提供处?XML 的新方式Q不补充 SAX ?DOMQ也不向 Java ?XML 处理提供新功能。(如果在这点上理解有误Q则本文正好适合您!Q它只是佉K过 DOM ?SAX 处理一些困难Q务更Ҏ。如果在使用 DOM ?SAX API 旉到特定于供应商的dQ它q通过独立于供应商的方式处理这些Q务成为可能?/p>

虽然要分别讲q所有这些特性,但是真正需要掌握的是:JAXP 不提供语法分析功?/em> Q没?SAX、DOM 或另一?XML 语法分析 APIQ就 无法分析 XML 语法 。有很多人曾让我?DOM、SAX ?JDOM ?JAXP q行Ҏ。但q行q些Ҏ是不可能的,因ؓ前三?API ?JAXP 的目的完全不同。SAX、DOM ?JDOM 都分?XML 语法。?JAXP 却提供到达这些语法分析器和结果的方式。它自n不提供分析文档语法的新方法。如果要正确使用 JAXPQ则一定要弄清q点。这您比其它 XML 开发h员领先一大截?

如果仍然怀疑(或认为我故弄玄虚Q,请从 Sun ?Web 站点下蝲 JAXP 分发Q请参阅 参考资?/font> 一节)Q然后就会知道基?JAXP 是什么。在包括?jar ( jaxp.jar ) ?只有六个c?/em> Q这?API 会有多难哪?所有这些类Q?javax.xml.parsers 包的一部分Q都位于现有语法分析器之上。这些类中的两个q用于错误处理。JAXP 比h们想象的要简单得多。那么,Z么还感到困惑哪?





回页?/font>


Sun ?JAXP ?Sun 的语法分析器

JAXP 下蝲时包?Sun 的语法分析器。所?parser 器类作ؓ com.sun.xml.parser 包和相关子包的一部分位于 parser.jar 档案中。应该知道,该语法分析器Q代码名?CrimsonQ??/em> ?JAXP 自n的一部分。它?JAXP 版本的一部分Q但不是 JAXP API 的一部分。o人困惑吗Q有一炏V换q种方式xQJDOM ?Apache Xerces 语法分析器一h供。该语法分析器不?JDOM 的一部分Q但?JDOM 使用Q所以包括它Q以保 JDOM 可以单独使用。JAXP 也是如此Q但不象 JDOM 那样好表达:JAXP ?Sun 的语法分析器一h供,以便可以立即使用。但是,很多人将 Sun 的语法分析器中包括的cd?JAXP API 的一部分。例如,新闻l中一个常见的问题是:“怎样使用 JAXP 中的 XMLDocument c?其目的是什么?”q个{案可有些复杂?

首先Q?com.sun.xml.tree.XMLDocument cM?JAXP 的一部分。它?Sun 语法分析器的一部分。所以,q个问题从一开始就lh以误对{其ơ,JAXP 的整个意义在于在处理语法分析器时提供供应商独立性。?JAXP 的同一代码可以?Sun ?XML 语法分析器、Apache ?Xerces XML 语法分析器和 Oracle ?XML 语法分析器一起用。而用特定于 Sun 的类是个坏主意。这?JAXP 的整个意义相背离。现在看出来q个问题怎样h概念了吗Q语法分析器?JAXP 发行版本Q至是 Sun 的版本)中的 API 被؜Z谈,开发h员将其中一个的cdҎ当成是另一个的了,反之亦然?





回页?/font>


旧和?/span>

关于 JAXPQ最后需要指出的是:使用 JAXP 有一些缺陗例如,JAXP 只支?SAX 1.0 ?DOM W一层规范。SAX 2.0 ?2000 q?5 月v完成,DOM W二层规范支持甚臛_大多数语法分析器中存在更长时间。DOM W二层规范还没有完成Q但实_E_以用于生产。这两个 API 的新版本都有重大改进Q最明显的是?XML 名称I间的支持。该支持q允?#8220;XML Schema 认”Q这个与 XML 相关的另一热门技术。公q__?JAXP 发布 1.0 最l发行版ӞSAX 2.0 ?DOM W一层规范都q没有完成。但是,׃没有包括q些新版本,实为开发h员带来很大不ѝ?/p>

q可以?JAXPQ但是也可以{待 JAXP 1.1Q它支持 SAX 2.0 ?DOMW二层规?。否则,发玎ͼJAXP 提供的优点以 SAX ?DOM 最新版本中的功能ؓ代hQƈ使应用程序更加难以编码。无论是否等待下一?JAXP 发行版,都要留意q个问题。如果将 JAXP 与语法分析器一起用,而语法分析器支持?DOM ?SAX 版本?JAXP 支持的要高,则可能会有类路径问题。所以,事先留意一下,q且Q一旦有 JAXP 1.1Q马上升U。基本理?JAXP 之后Q让我们看一?JAXP 依赖?APIQSAX ?DOM?/p>



回页?/font>


?SAX 开?/span>

SAX QSimple API for XMLQ是用于处理 XML 的事仉动方法。它基本p多回调函数组成。例如,每当 SAX 语法分析器遇到元素的开始标记时p?startElement() 。对于字W串Q将调用 characters() 回调函数Q然后在元素l束标记处调?endElement() 。还有很多回调函数用于文档处理、错误和其它词汇l构。现在知道这是怎么回事了。SAX E序员实C个定义这些回调函数的 SAX 接口。SAX q实C个名?HandlerBase 的类Q该cd现所有这些回调函敎ͼq提供所有这些回调方法的~省I实现。(提到q一Ҏ因ؓ它在后面讲到?DOM 中很重要。)SAX 开发h员只需扩展q个c,然后实现需要插入特定逻辑的方法。所以,SAX 的关键在于ؓq些不同的回调函数提供代码,然后允许语法分析器在适当的时候触发这些回调函C的每一个?

因此Q典型的 SAX q程如下Q?/p>

  • 用特定供应商的语法分析器实现创徏一?SAXParser 实例
  • 注册回调实现Q例如,通过使用扩展 HandlerBase 的类Q?
  • 开始进行语法分析,然后在触发回调实现时{待

JAXP ?SAX lg提供执行所有这些步骤的单方式。如果没?JAXPQSAX 语法分析器要直接从供应商c(?org.apache.xerces.parsers.SAXParser Q进行实例化Q或者必M用名?ParserFactory 的帮助类。第一个方法的问题很明显:不独立于供应商。第二个Ҏ的问题在于类厂需要一个自变量Q即要用的语法分析器类的字W串名称Q还是那?Apache c?org.apache.xerces.parsers.SAXParser Q。可以通过不同语法分析器作ؓ String 传递来更改语法分析器。用这U方法不必更改Q?import 语句Q但是还是要重新~译cR这昄不是最佌x案。如果能够不重新~译c而更改语法分析器Q可能会单得多,是不是这样呢Q?

JAXP 提供了更好的替代ҎQ它允许语法分析器作ؓ Java pȝ属性来提供。当Ӟ当从 Sun 下蝲版本Ӟ得C?Sun 语法分析器的 JAXP 实现。可以从 Apache XML Web 站点下蝲?Apache Xerces 上构建其实现的相?JAXP 接口。因此(无论哪一U情况)Q更Ҏ在用的语法分析器需要更改类路径讄Q即从一U语法分析器实现更改到另一个,但是 ?/em>要求重新~译代码。这是 JAXP 的魔力,或抽象性?

SAX 语法分析器一?/font>

JAXP SAXParserFactory cL能够L更改语法分析器实现的关键所在。必d个类的新实例Q等一会将讲到Q。创建新实例之后Q类厂提供一个方法来获得支持 SAX 的语法分析器。在内部QJAXP 实现处理依赖于供应商的代码,使您的代码不受媄响。这个类厂还提供其它一些优UҎ?

除创?SAX 语法分析器实例的基本工作之外Q类厂还允许讄配置选项。这些选项影响所有通过cd获得的语法分析器实例。JAXP 1.0 中两个可用的功能是设|名U空间敏感?( setNamespaceAware (boolean awareness))Q和打开认 ( setValidating (boolean validating))。请CQ一旦设|了q些选项Q在调用该方法之后,它们媄?所?/em>?cd获得的实例?

讄了类厂之后,调用 newSAXParser() 返回一个随时可用的 JAXP SAXParser cd例。这个类装了一个下层的 SAX 语法分析器(SAX c?org.xml.sax.Parser 的实例)。它q防止向语法分析器类dM特定于供应商的附加功能。(q记得以前对 XmlDocument 的讨论吗Q)q个cd以开始进行实际的语法分析。以下清单显C如何创建、配|和使用 SAX cd?



清单 1. 使用 SAXParserFactory
import java.io.File;
            import java.io.IOException;
            import java.io.OutputStreamWriter;
            import java.io.Writer;
            // JAXP
            import javax.xml.parsers.FactoryConfigurationError;
            import javax.xml.parsers.ParserConfigurationException;
            import javax.xml.parsers.SAXParserFactory;
            import javax.xml.parsers.SAXParser;
            // SAX
            import org.xml.sax.AttributeList;
            import org.xml.sax.HandlerBase;
            import org.xml.sax.SAXException;
            public class TestSAXParsing {
            public static void main(String[] args) {
            try {
            if (args.length != 1) {
            System.err.println ("Usage: java TestSAXParsing [filename]");
            System.exit (1);
            }
            // 获得SAX 语法分析器类?
            SAXParserFactory factory = SAXParserFactory.newInstance();
            //讄讄名称I间敏感性选项Q关掉确认选项
            factory.setValidating(true);
            factory.setNamespaceAware(false);
            SAXParser parser = factory.newSAXParser();
            parser.parse(new File(args[0]), new MyHandler());
            } catch (ParserConfigurationException e) {
            System.out.println("The underlying parser does not support " +
            " the requested features.");
            } catch (FactoryConfigurationError e) {
            System.out.println("Error occurred obtaining SAX Parser Factory.");
            } catch (Exception e) {
            e.printStackTrace();
            }
            }
            }
            class MyHandler extends HandlerBase {
            //通过 DocumentHandler, ErrorHandler{实现的SAX回调函数
            }
            

h意,在这D代码中Q在使用cd时可能发生两个特定于 JAXP 的问题:无法获得或配|?SAX cdQ以及无法配|?SAX 语法分析器。当无法获得 JAXP 实现中指定的语法分析器或pȝ属性时Q通常会发生第一个问?FactoryConfigurationError 。当正在使用的语法分析器中的Ҏ不可用Ӟ会发生第二个问题 ParserConfigurationException 。这两个问题都容易处理,应该不会?JAXP 的用造成M困难?

在获得类厂、关闭名U空间ƈ打开“认”之后Q将获得 SAXParser Q然后开始语法分析。请注意Q?SAX 语法分析器的 parse() Ҏ取得前面提到?SAX HandlerBase cȝ一个实例。(可以通过完整?Java 清单 查看该类的实?/font> 。)q要传递要q行语法分析的文件。但是, SAXParser 所包含的远不止q一个方法?

使用 SAX 语法分析?/font>

获得 SAXParser cȝ实例之后Q除了向语法分析器传?File q行语法分析之外Q还可以用它做更多的事。由于如今大型应用中的应用程序组件之间通信方式Q?#8220;对象实例创徏者就是其使用?#8221;q样的假定ƈ不L安全的。换句话_一个组件可能创?SAXParser 实例Q而另一lgQ可能由另一开发h员编码)可能需要用那个实例。由于这个原因,提供了一些方法来定语法分析器的讄。执行此d的两个方法是 isValidating() Q它通知调用E序Q语法分析器要、或不要执行“认”Q以?isNamespaceAware() Q它q回一个指C,说明语法分析器可以或不可以处?XML 文档中的名称I间。虽然这些方法能提供有关语法分析器可以执行功能的信息Q但是无法更改这些特性。必d语法分析器类厂别执行该操作?

另外Q有多种Ҏ来请求对文档q行语法分析。除了只接受 File ?SAX HandlerBase 实例QSAXParser ?parse() Ҏq能?String 形式接受 SAX InputSource 、Java InputStream ?URLQ所有这些都要与 HandlerBase 实例一h供。所以,不同cd的输入文档可以用不同方式的语法分析来处理?

最后,可以直接通过 SAXParser ?getParser() Ҏ获得和用下层的 SAX 语法分析器( org.xml.sax.Parser 的实例)。获得这个下层实例之后,可以获得通常?SAX Ҏ。下一个清单显C?SAXParser c(q个 JAXP ?SAX 语法分析的核心类Q的各种使用CZ?



清单 2. 使用 JAXP SAXParser
 //获得SAXP的一个实?
            SAXParser saxParser = saxFactory.newSAXParser();
            //查看是否支持 Validate 选项
            boolean isValidating = saxParser.isValidating();
            //查看是否支持 namespace 选项
            boolean isNamespaceAware = saxParser.isNamespaceAware();
            // q用一个File 和一个SAX HandlerBase 的实例进行多UŞ式的语法分析
            saxParser.parse(new File(args[0]), myHandlerBaseInstance);
            // q用一?SAX InputSource实例 和一?SAX HandlerBase 实例
            saxParser.parse(mySaxInputSource, myHandlerBaseInstance);
            //q用一?InputStream 实例和一个SAX HandlerBase 实例
            saxParser.parse(myInputStream, myHandlerBaseInstance);
            // q用一?URI 和一个SAX HandlerBase 实例
            saxParser.parse("http://www.newInstance.com/xml/doc.xml", myHandlerBaseInstance);
            //获得底层的(装QSAX 语法分析?
            org.xml.sax.Parser parser = saxParser.getParser();
            //利用底层的语法分析器
            parser.setContentHandler(myContentHandlerInstance);
            parser.setErrorHandler(myErrorHandlerInstance);
            parser.parse(new org.xml.sax.InputSource(args[0]));
            

目前为止Q关?SAX 已经讲了很多Q但是还没有揭示M不寻常或令h惊奇的东ѝ事实上QJAXP 的功能很,特别是当 SAX 也牵涉进来时。这很好Q因为有最的功能性意味着代码可移植性更强,q可以由其他开发h员与M?SAX 兼容?XML 语法分析器一起用,无论是免费(通过开放源码,希望如此Q还是通过商业途径。就是这栗在 JAXP 中?SAX 没有更多的东ѝ如果已l知?SAXQ那么现在已l掌握大U?98% 的内宏V只需学习两个新类和两?Java 异常Q您可以开始了。如果从没用过 SAXQ那也很单,现在可以开始?/p>



回页?/font>


处理 DOM

如果要休息以q接 DOM 挑战Q那么先别休息。在 JAXP 中?DOM 的过E与 SAX 几乎相同Q所要做的全部只是更改两个类名和一个返回类型,q样差不多了。如果理?SAX 的工作原理和 DOM 是什么,则不会有M问题?/p>

DOM ?SAX 的主要差异是它们?API l构。SAX 包含一个基于事件的回调函数集,?DOM 有一个内存中的树状结构。换句话_?SAX 中,从不需要操作数据结构(除非开发h员手工创建)。因此,SAX 不提供修?XML 文档的功能。?DOM 正好提供q种cd的功能?org.w3c.dom.Document c表C?XML 文档Q它pC元素、属性和其它 XML l构?DOM 节点 l成。所以,JAXP 无需触发 SAX 回调Q它只负责从语法分析q回一?DOM Document 对象?

DOM 语法分析器类厂一?/font>

基本理解 DOM 以及 DOM ?SAX 的差异之后,没什么好说的了。以下代码看h?SAX 代码cM。首先,获得 DocumentBuilderFactory Q与 SAX 中的方式相同)。然后,配置cd来处理确认和名称I间Q与 SAX 中的方式相同)。下一步,从类厂中?DocumentBuilder Q它?SAXParser cMQ(?SAX 中的方式相同. . . 啊,您都知道了)。然后,可以进行语法分析了Q生的 DOM Document 对象传递给打印 DOM 树的Ҏ?



清单 3. 使用文档构徏器类?/strong>
import java.io.File;
            import java.io.IOException;
            import java.io.OutputStreamWriter;
            import java.io.Writer;
            // JAXP
            import javax.xml.parsers.FactoryConfigurationError;
            import javax.xml.parsers.ParserConfigurationException;
            import javax.xml.parsers.DocumentBuilderFactory;
            import javax.xml.parsers.DocumentBuilder;
            // DOM
            import org.w3c.dom.Document;
            import org.w3c.dom.DocumentType;
            import org.w3c.dom.NamedNodeMap;
            import org.w3c.dom.Node;
            import org.w3c.dom.NodeList;
            public class TestDOMParsing {
            public static void main(String[] args) {
            try {
            if (args.length != 1) {
            System.err.println ("Usage: java TestDOMParsing [filename]");
            System.exit (1);
            }
            // 获得 Document Builder Factory
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            //打开认选项Q关掉名U空间敏感性选项?
            factory.setValidating(true);
            factory.setNamespaceAware(false);
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(new File(args[0]));
            // 从DOM C打印文档Qƈ加一初始I格
            printNode(doc, "");
            // 在这里也可以?DOM 文档q行修改
            } catch (ParserConfigurationException e) {
            System.out.println("The underlying parser does not support the requested features.");
            } catch (FactoryConfigurationError e) {
            System.out.println("Error occurred obtaining Document Builder Factory.");
            } catch (Exception e) {
            e.printStackTrace();
            }
            }
            private static void printNode(Node node, String indent) {
            // 打印 DOM ?
            }
            

此代码中可能会出C个不同的问题Q与 JAXP 中的 SAX cMQ: FactoryConfigurationError ?ParserConfigurationException 。每一个的原因?SAX 中的相同。不是实现类 ( FactoryConfigurationError ) 中有问题Q就是语法分析器不支持请求的Ҏ?( ParserConfigurationException )。DOM ?SAX 的唯一差异是:?DOM 中,?DocumentBuilderFactory 替代 SAXParserFactory Q用 DocumentBuilder 替代 SAXParser 。就q么单!Q可?查看完整代码清单 Q该清单包括用于打印 DOM 树的Ҏ。)

使用 DOM 语法分析?/font>

有了 DOM cd之后Q就可以获得 DocumentBuilder 实例?DocumentBuilder 实例可以使用的方法与 SAX 的非常类伹{主要差异是 parse() 的变U不需?HandlerBase cȝ实例。它们返回表C法分析之后的 XML 文档?DOM Document 实例。另一唯一不同之处是:为类g SAX 的功能提供了两个ҎQ用 SAX ErrorHandler 实现来处理语法分析时可能出现的问题的 setErrorHandler() Q和?SAX EntityResolver 实现来处理实体解析的 setEntityResolver() 。如果不熟悉q些概念Q则需要通过联机或在我的书中学习 SAX。以下清单显CZ用这些方法的CZ?



清单 4. 使用 JAXP DocumentBuilder
    //获得一?DocumentBuilder 实例
            DocumentBuilder builder = builderFactory.newDocumentBuilder();
            //查看是否支持 Validate 选项
            boolean isValidating = builder.isValidating();
            //查看是否支持 namespace 选项
            boolean isNamespaceAware = builder.isNamespaceAware();
            // 讄一?SAX ErrorHandler
            builder.setErrorHandler(myErrorHandlerImpl);
            // 讄一?SAX EntityResolver
            builder.setEntityResolver(myEntityResolverImpl);
            // q用多种Ҏ?file q行语法分析
            Document doc = builder.parse(new File(args[0]));
            // q用 SAX InputSource
            Document doc = builder.parse(mySaxInputSource);
            // q用 InputStream
            Document doc = builder.parse(myInputStream, myHandlerBaseInstance);
            // q用 URI
            Document doc = builder.parse("http://www.newInstance.com/xml/doc.xml");
            

是不是感?DOM q一节有些o人厌烦?有这U想法的不止您一个,?DOM 代码有些令h厌烦是因为它是直接取得所学的 SAX 知识Q然后将其用?DOM。因此,和朋友、同事打赌吧Q说使用 JAXP 只是菜一?/p>



回页?/font>


更改语法分析?/span>

最后要探讨的主题是 JAXP L更改cdcM用的语法分析器的能力。更?JAXP 使用的语法分析器实际意味着更改 cdQ因为所?SAXParser ?DocumentBuilder 实例都来自这些类厂。既然确定装入哪个语法分析器的是cdQ因此,必须更改cd。可以通过讄 Java pȝ属?javax.xml.parsers.SAXParserFactory 来更改要使用?SAXParserFactory 接口实现。如果没有定义该属性,则返回缺省实玎ͼ供应商指定的M语法分析?。相同原理适用?DocumentBuilderFactory 实现。在q种情况下,查?javax.xml.parsers.DocumentBuilderFactory pȝ属性。就q么单,我们已经学完了!q就?SAXP 的全部:提供?SAX 的挂钩,提供?DOM 的挂钩,q允许轻易更改语法分析器?





回页?/font>


l束?/span>

如您所见,没多复杂的东西。更改系l属性,通过cd、而不是语法分析器或构建器来设|?#8220;认”Q以及弄清楚JAXP实际上不是h们通常所认ؓ的那Pq些是?JAXP 的最困难部分。除了没?SAX 2.0 ?DOMW二层规范支持之外,JAXP 在两个流行的 Java ?XML API 之上提供一个有帮助的可插入层。它使代码独立于供应商,q允怸~译语法分析代码而更改语法分析器。那么,?Sun、Apache XML 或其它方便之处下?JAXPQƈ使用它吧Ql关?JAXP 1.1Qƈ增加?SAX 2 ?DOM 2、XSLT 及更多内容的支持。您在q里获得W一手新闻,所以,请关?developerWorks?



参考资?



关于作?/span>

 

Brett McLaughlin ?Lutris Technologies ?Enhydra {略NQ他致力于研I分布式pȝ体系l构。他?Java ?XML (O'Reilly) 的作者。他q参与了诸如 Java Servlet、Enterprise JavaBeans 技术、XML 和B2B应用E序{技术的研究。最q,他与 Jason Hunter 一起创Z JDOM 目Q该目为在 Java 应用E序中?XML 提供了一个简单的 API。他q是 Apache Cocoon 目、EJBoss EJB 服务器的主要开发h员,q且?Apache Turbine 目的共同创始h。Brett 目前在专家组从事 JAXP 1.1 的规范和发行。可以通过 brett@newInstance.com 与他联系?



]]>java中四U操作xml方式的比?/title><link>http://www.aygfsteel.com/simie/archive/2007/07/06/128525.html</link><dc:creator>和田?/dc:creator><author>和田?/author><pubDate>Fri, 06 Jul 2007 03:31:00 GMT</pubDate><guid>http://www.aygfsteel.com/simie/archive/2007/07/06/128525.html</guid><wfw:comment>http://www.aygfsteel.com/simie/comments/128525.html</wfw:comment><comments>http://www.aygfsteel.com/simie/archive/2007/07/06/128525.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/simie/comments/commentRss/128525.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/simie/services/trackbacks/128525.html</trackback:ping><description><![CDATA[ <strong>1. 介绍</strong> <p>    <strong>1QDOMQJAXP Crimson解析器)</strong></p> <p>    DOM是用与^台和语言无关的方式表CXML文档的官方W3C标准。DOM是以层次l构l织的节Ҏ信息片断的集合。这个层ơ结构允许开发h员在树中L特定信息。分析该l构通常需要加载整个文档和构造层ơ结构,然后才能做Q何工作。由于它是基于信息层ơ的Q因而DOM被认为是Z树或Z对象的。DOM以及q义的基于树的处理具有几个优炏V首先,׃树在内存中是持久的,因此可以修改它以便应用程序能Ҏ据和l构作出更改。它q可以在M时候在树中上下DQ而不是像SAX那样是一ơ性的处理。DOM使用h也要单得多?/p> <p>    <strong>2QSAX</strong></p> <p>    SAX处理的优炚w常类g媒体的优点。分析能够立卛_始,而不是等待所有的数据被处理。而且Q由于应用程序只是在d数据时检查数据,因此不需要将数据存储在内存中。这对于大型文档来说是个巨大的优炏V事实上Q应用程序甚至不必解析整个文档;它可以在某个条g得到满时停止解析。一般来_SAXq比它的替代者DOM快许多?/p> <p>    选择DOMq是选择SAXQ?对于需要自q写代码来处理XML文档的开发h员来_ 选择DOMq是SAX解析模型是一个非帔R要的设计决策?DOM采用建立树Şl构的方式访问XML文档Q而SAX采用的事件模型?/p> <p>    DOM解析器把XML文档转化Z个包含其内容的树Qƈ可以Ҏq行遍历。用DOM解析模型的优Ҏ~程ҎQ开发h员只需要调用徏树的指oQ然后利用navigation APIs讉K所需的树节点来完成Q务。可以很Ҏ的添加和修改树中的元素。然而由于用DOM解析器的时候需要处理整个XML文档Q所以对性能和内存的要求比较高,其是遇到很大的XML文g的时候。由于它的遍历能力,DOM解析器常用于XML文档需要频J的改变的服务中?/p> <p>    SAX解析器采用了Z事g的模型,它在解析XML文档的时候可以触发一pd的事Ӟ当发现给定的tag的时候,它可以激zM个回调方法,告诉该方法制定的标签已经扑ֈ。SAX对内存的要求通常会比较低Q因为它让开发h员自己来军_所要处理的tag.特别是当开发h员只需要处理文档中所包含的部分数据时QSAXq种扩展能力得到了更好的体现。但用SAX解析器的时候编码工作会比较困难Q而且很难同时讉K同一个文档中的多处不同数据?/p> <p>    <strong>3QJDOM </strong><a ><strong><u><font color=#0000ff>http://www.jdom.org</font></u></strong></a></p> <p>    JDOM的目的是成ؓJava特定文档模型Q它化与XML的交互ƈ且比使用DOM实现更快。由于是W一个Java特定模型QJDOM一直得到大力推q和促进。正在考虑通过“Java规范hJSR-102”它最l用?#8220;Java标准扩展”。从2000q初已l开始了JDOM开发?/p> <p>    JDOM与DOM主要有两斚w不同。首先,JDOM仅用具体类而不使用接口。这在某些方面简化了APIQ但是也限制了灵zL。第二,API大量使用了Collectionsc,化了那些已经熟悉q些cȝJava开发者的使用?/p> <p>    JDOM文档声明其目的是“使用20%Q或更少Q的_֊解决80%Q或更多QJava/XML问题”Q根据学习曲U假定ؓ20%Q。JDOM对于大多数Java/XML应用E序来说当然是有用的Qƈ且大多数开发者发现API比DOMҎ理解得多。JDOMq包括对E序行ؓ的相当广泛检查以防止用户做Q何在XML中无意义的事。然而,它仍需要您充分理解XML以便做一些超出基本的工作Q或者甚至理解某些情况下的错误)。这也许是比学习DOM或JDOM接口都更有意义的工作?/p> <p>    JDOM自n不包含解析器。它通常使用SAX2解析器来解析和验证输入XML文档Q尽它q可以将以前构造的DOM表示作ؓ输入Q。它包含一些{换器以将JDOM表示输出成SAX2事g、DOM模型或XML文本文档。JDOM是在Apache许可证变体下发布的开放源码?/p> <p>    <strong>4QDOM4J </strong><a ><strong><u><font color=#0000ff>http://dom4j.sourceforge.net</font></u></strong></a></p> <p>    虽然DOM4J代表了完全独立的开发结果,但最初,它是JDOM的一U智能分支。它合ƈ了许多超出基本XML文档表示的功能,包括集成的XPath支持、XML Schema支持以及用于大文档或化文档的基于事件的处理。它q提供了构徏文档表示的选项Q它通过DOM4J API和标准DOM接口hq行讉K功能。从2000下半q开始,它就一直处于开发之中?/p> <p>    为支持所有这些功能,DOM4J使用接口和抽象基本类Ҏ。DOM4J大量使用了API中的Collectionsc,但是在许多情况下Q它q提供一些替代方法以允许更好的性能或更直接的编码方法。直接好处是Q虽然DOM4J付出了更复杂的API的代P但是它提供了比JDOM大得多的灉|性?/p> <p>    在添加灵zL、XPath集成和对大文档处理的目标ӞDOM4J的目标与JDOM是一LQ针对Java开发者的易用性和直观操作。它q致力于成ؓ比JDOM更完整的解决ҎQ实现在本质上处理所有Java/XML问题的目标。在完成该目标时Q它比JDOM更少防止不正的应用E序行ؓ?/p> <p>    DOM4J是一个非帔R怼U的Java XML APIQ具有性能优异、功能强大和极端易用使用的特点,同时它也是一个开放源代码的Y件。如今你可以看到来多的Java软g都在使用DOM4J来读写XMLQ特别值得一提的是连Sun的JAXM也在用DOM4J.</p> <p>   <strong> 2…… 比较</strong></p> <p>    1QDOM4J性能最好,qSun的JAXM也在用DOM4J.目前许多开源项目中大量采用DOM4JQ例如大名鼎鼎的Hibernate也用DOM4J来读取XML配置文g。如果不考虑可移植性,那就采用DOM4J.</p> <p>    2QJDOM和DOM在性能试时表C佻I在测?0M文档时内存溢出。在文档情况下q值得考虑使用DOM和JDOM.虽然JDOM的开发者已l说明他们期望在正式发行版前专注性能问题Q但是从性能观点来看Q它实没有值得推荐之处。另外,DOM仍是一个非常好的选择。DOM实现q泛应用于多U编E语a。它q是许多其它与XML相关的标准的基础Q因为它正式获得W3C推荐Q与Z非标准的Java模型相对Q,所以在某些cd的项目中可能也需要它Q如在JavaScript中用DOMQ?/p> <p>    3QSAX表现较好Q这要依赖于它特定的解析方式Q事仉动。一个SAX即到来的XML,但ƈ没有载入到内存(当然当XML被dӞ会有部分文档暂时隐藏在内存中Q?/p> 3. <span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">四种</span><span lang=EN-US style="COLOR: black"><font face="Times New Roman">xml</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">操作方式的基本用方?/span><span lang=EN-US style="COLOR: black"><font face="Times New Roman"> <br><br>xml</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文gQ?br clear=all></span><span lang=EN-US style="COLOR: black"><font face="Times New Roman"><br style="mso-special-character: line-break"><br style="mso-special-character: line-break"><o:p></o:p></font></span> <div style="BORDER-RIGHT: #cccccc 0.75pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: #cccccc 0.75pt solid; PADDING-LEFT: 4pt; BACKGROUND: #fdfddf; PADDING-BOTTOM: 4pt; BORDER-LEFT: #cccccc 0.75pt solid; PADDING-TOP: 4pt; BORDER-BOTTOM: #cccccc 0.75pt solid"> <p class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; MARGIN: 3.75pt 15pt; BORDER-LEFT: medium none; WORD-BREAK: break-all; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none; mso-border-alt: solid #CCCCCC .75pt; mso-padding-alt: 4.0pt 4.0pt 4.0pt 4.0pt"><font size=3><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">?xml version="1.0" encoding="GB2312"?</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">RESULT</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">VALUE</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">NO</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">A1234</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/NO</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">ADDR</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q四川省</span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">X</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">D?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">P</span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/ADDR</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/VALUE</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">VALUE</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">NO</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">B1234</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/NO</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">ADDR</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q四川省</span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">XX</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">l<</span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/ADDR</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/VALUE</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">/RESULT</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> <br><br>1</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">DOM <br><br>import java.io.*; <br>import java.util.*; <br>import org.w3c.dom.*; <br>import javax.xml.parsers.*; <br><br>public class MyXMLReader{ <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public static void main(String arge[]){ <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">long lasting =System.currentTimeMillis(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">try{ <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">File f=new File("data_10k.xml"); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">DocumentBuilder builder=factory.newDocumentBuilder(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">Document doc = builder.parse(f); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">NodeList nl = doc.getElementsByTagName("VALUE"); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">for (int i=0;i</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">nl.getLength();i++){ <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.print("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车牌L</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + doc.getElementsByTagName("NO").item(i).getFirstChild().getNodeValue()); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.println("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车主地址</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + doc.getElementsByTagName("ADDR").item(i).getFirstChild().getNodeValue()); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> </span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">}catch(Exception e){ <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">e.printStackTrace(); <br>} <br><br>2</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">SAX <br><br>import org.xml.sax.*; <br>import org.xml.sax.helpers.*; <br>import javax.xml.parsers.*; <br><br>public class MyXMLReader extends DefaultHandler { <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">java.util.Stack tags = new java.util.Stack(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public MyXMLReader() { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">super(); <br>} <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public static void main(String args[]) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">long lasting = System.currentTimeMillis(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">try { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">SAXParserFactory sf = SAXParserFactory.newInstance(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">SAXParser sp = sf.newSAXParser(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">MyXMLReader reader = new MyXMLReader(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">sp.parse(new InputSource("data_10k.xml"), reader); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} catch (Exception e) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">e.printStackTrace(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.println("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">q行旉Q?/span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">" + (System.currentTimeMillis() - lasting) + "</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">毫秒</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">");} <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public void characters(char ch[], int start, int length) throws SAXException { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">String tag = (String) tags.peek(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">if (tag.equals("NO")) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.print("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车牌LQ?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">" + new String(ch, start, length)); <br>} <br>if (tag.equals("ADDR")) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.println("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">地址</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + new String(ch, start, length)); <br>} <br>} <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public void startElement(String uri,String localName,String qName,Attributes attrs) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">tags.push(qName);} <br>} <br><br>3</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"> JDOM <br><br>import java.io.*; <br>import java.util.*; <br>import org.jdom.*; <br>import org.jdom.input.*; <br><br>public class MyXMLReader { <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public static void main(String arge[]) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">long lasting = System.currentTimeMillis(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">try { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">SAXBuilder builder = new SAXBuilder(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">Document doc = builder.build(new File("data_10k.xml")); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">Element foo = doc.getRootElement(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">List allChildren = foo.getChildren(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">for(int i=0;i</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">allChildren.size();i++) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.print("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车牌L</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + ((Element)allChildren.get(i)).getChild("NO").getText()); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.println("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车主地址</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + ((Element)allChildren.get(i)).getChild("ADDR").getText()); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} catch (Exception e) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">e.printStackTrace(); <br>} <br><br>} <br><br>4</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">Q?/span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">DOM4J <br><br>import java.io.*; <br>import java.util.*; <br>import org.dom4j.*; <br>import org.dom4j.io.*; <br><br>public class MyXMLReader { <br><br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma"> </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">public static void main(String arge[]) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">long lasting = System.currentTimeMillis(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">try { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">File f = new File("data_10k.xml"); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">SAXReader reader = new SAXReader(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">Document doc = reader.read(f); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">Element root = doc.getRootElement(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">Element foo; <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">for (Iterator i = root.elementIterator("VALUE"); i.hasNext()<v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"> <v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><v:shape id=_x0000_i1025 style="WIDTH: 24pt; HEIGHT: 24pt" alt="" type="#_x0000_t75"></v:shape>{ <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">foo = (Element) i.next(); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.print("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车牌L</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + foo.elementText("NO")); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">    </span></em></strong><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">System.out.println("</span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">车主地址</span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">:" + foo.elementText("ADDR")); <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">  </span></em></strong></font><font size=3><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt">} catch (Exception e) { <br></span></em></strong><strong><em><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: Tahoma">   </span></em></strong></font><strong><em><span lang=EN-US style="COLOR: black; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.5pt"><font size=3>e.printStackTrace(); <br>} <br>) <o:p></o:p></font></span></em></strong></p> </div> <img src ="http://www.aygfsteel.com/simie/aggbug/128525.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/simie/" target="_blank">和田?/a> 2007-07-06 11:31 <a href="http://www.aygfsteel.com/simie/archive/2007/07/06/128525.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">䴨</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͤ</a>| <a href="http://" target="_blank">ݰ</a>| <a href="http://" target="_blank">͸</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank">ƺ</a>| <a href="http://" target="_blank">ɳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">۰</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨ǰ</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ȫ</a>| <a href="http://" target="_blank">ֿ</a>| <a href="http://" target="_blank">˳ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϰ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˶</a>| <a href="http://" target="_blank">»</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ӫɽ</a>| <a href="http://" target="_blank">ݳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank">Ͻ</a>| <a href="http://" target="_blank">ˮ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>