Java Reference
In-Depth Information
C H A P T E R 10
Parsing, Creating, and Transforming
XML Documents
ApplicationscommonlyuseXMLdocumentstostoreandexchangedata.Javaprovides
extensivesupportforXMLviatheSAX,DOM,StAX,XPath,andXSLTAPIs.Under-
standingtheseAPIsisaprerequisitetoexploringotherJavaAPIsthatdependonXML;
for example, web services (discussed in Chapter 11 ) .
Chapter 10 introduces you to SAX, DOM, StAX, XPath, and XSLT. Before delving
intotheseAPIs,thischapterprovidesanintroductiontoXMLforthebenefitofthoseun-
familiar with this technology.
Note SAX,DOM,StAX,XPath,andXSLTareindependentAPImembersofabroad-
er API called Java API for XML Processing (JAXP). JAXP was created to let applic-
ations use XML processors to parse, create, transform, or perform other operations on
XMLdocumentsindependentlyofprocessorimplementations,byprovidingapluggab-
ilitylayerthatletsvendorsoffertheirownimplementationswithoutintroducingdepend-
encies in application code. Java 7 supports JAXP 1.4.5.
What Is XML?
XML (eXtensible Markup Language) is a metalanguage (a language used to describe
otherlanguages)fordefining vocabularies (custommarkuplanguages),whichiskeyto
XML'simportanceandpopularity.XML-basedvocabularies(e.g.,XHTML)letyoude-
scribe documents in a meaningful way.
XMLvocabularydocumentsarelikeHTML(see http://en.wikipedia.org/
wiki/HTML ) documentsinthattheyaretext-basedandconsistof markup (encodedde-
scriptions of a document's logical structure) and content (document text not interpreted
asmarkup).Markupisevidencedvia tags (anglebracket-delimitedsyntacticconstructs)
and each tag has a name. Furthermore, some tags have attributes (name-value pairs).
Search WWH ::




Custom Search