From DesigningPatterns
General Characteristics
- XML is a markup language defined by SGML.
- XML defines descriptive markup languages (where the goal is to describe data, not to format or structure it).
- Style sheets allow the data in an XML document to be formatted.
- XML can be transformed into other languages (such as HTML) via XSLT.
- JAXP is a set of APIs defined by the Java SE for processing XML. They include a
- DOM parsing interface
- a SAX (simple api for xml) parsing interface, and a
- STAX interface for parsing streaming xml.
- XSLT transformation interface
- The Apache Xerces library is one common implementation of the JAXP apis.
- JAXB allows Java developers to map Java classes to XML. It is one of the APIs in the Java EE platform and is part of Java SE Version 1.6.
Related Technologies
XPATH
General
- XPATH
- XSLT relies upon the W3C's XPath language for selecting subsets of the source document tree using a variety of criteria. Examples include:
- All children, ancestors, and/or descendants, etc. of a given node. All prices of books would be book/price.
- All nodes with a child value greater than 35. (All book prices > 35 would be: book[price > 35]/price).
- All nodes with an attribute equal to a specific value (book[@id=5]).
- XPath 2.0 and 1.0 exist. 1.0 is still more widely used.
Links
XSLT
General
- XSLT is an XML-based language for declaring a transformation between an xml document and a 2nd document (whether xml or plain text).
- A few common transformations include transforming xml to html/xhtml, transforming between two xml documents (with differing schemas), etc.
- If an XML document served over the web has the following line at the top (<?xml-stylesheet type="text/xsl" href="/schemas/file_and_display.xsl"?>), the browser will attempt to render the xml file using the specified xsl document.
- Browsers have the ability to do xslt transformations via javascript, but this functionality appears to be browser dependent.
- Version 2.0 exists but Version 1.0 seems to be more widely used and implemented.
- Xalan is an Apache open source command line tool (in C++ and Java) that implements the XSLT XML transformation language and the XPath language. The tool takes as input an xml file and an xsl file and outputs the transformed data.
[janet@jackfruit /usr/share/java]$ java -cp xerces-j2.jar:xml-commons-apis.jar:xalan-
j2-serializer.jar:xalan-j2.jar org.apache.xalan.xslt.Process -IN ~/in.xml -XSL
http://laikademo.cchit.org/schemas/file_and_display.xsl -OUT ~/out.html
Links
Additional Links