Implementing XML Based Applications
public void setDocument(Source source) throws ... {
this.source = source;
// Builds an XML processing pipeline (chaining a SAX parser and
// a style sheet transformer) which validates the source document
// extracts its orderId, transforms it into a different format,
// and copies the resulting document into the Result object
public void copyDocument(Result result) throws ... {
orderId = null;
InputSource inputSource
= SAXSource.sourceToInputSource(source);
SAXSource saxSource = new SAXSource(filter, inputSource);
transformer.transform(transformer, saxSource, result);
// Returns the processed document as a Source object
public Source getDocument() throws ... {
return new StreamSource(new StringReader(
// Returns the processed document as a String object
public String getDocumentAsString() throws ... {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
copyDocument(new StreamResult(stream));
return stream.toString(DEFAULT_ENCODING);
// Returns the orderId value extracted from the source document
public String getOrderId() {
return orderId;
Code Example 4.10
Combining SAX and XSLT to Perform XML Processing Steps
4.4.3 Entity Resolution
As mentioned earlier in this chapter, XML documents may contain references to
other external XML fragments. Parsing replaces the references with the actual
content of these external fragments. Similarly, XML schemas may refer to external
type definitions, and these definitions must also be accessed for the schema to be

New Page 1

Home : About Us : Network : Services : Support : FAQ : Control Panel : Order Online : Sitemap : Contact : Terms Of Service

java web hosting



 Our partners: | PHP: Hypertext Preprocessor | Best Web Hosting | Java Web Hosting | Inexpensive Web Hosting |

Jsp Web Hosting | Cheapest Web Hosting | Jsp Hosting | Cheap Hosting


Virtualwebstudio. Business web hosting division of Web Design Plus. All rights reserved