jenkins-dom4j-1.6.1-hudson-3/ 0000755 0001750 0001750 00000000000 11603102323 014574 5 ustar chuck chuck jenkins-dom4j-1.6.1-hudson-3/jalopy.xml 0000644 0001750 0001750 00000040561 11332657403 016637 0 ustar chuck chuck
14false[A-Z][a-zA-Z0-9]+[A-Z][a-zA-Z0-9]+[a-z][\w]+[a-z][\w]+[a-zA-Z][\w]+[a-z][\w]+[a-z][\w]+[a-zA-Z][\w]+[a-z][\w]+[a-z][\w]+[a-zA-Z][\w]+[a-z][\w]+[a-z][\w]+[a-zA-Z][\w]+[A-Z][a-zA-Z0-9]+\w+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z][\w]+[a-z]+(?:\.[a-z]+)*[a-z][\w]+[a-z][\w]+[a-z][\w]*falsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalse6300003000030000300003000030000true1truefalsetruefalsefalsebak01010111111011111101falsefalsetruetruetruetruefalsefalsefalsefalsefalsefalsefalsetruetruefalsefalsetruetruetrue0000false */ * @throws $exceptionType$ DOCUMENT ME!
* @param $paramType$ DOCUMENT ME!
* @return DOCUMENT ME!/**| * DOCUMENT ME!falsefalsefalse-falsefalseInner ClassesConstructorsInstance fieldsInstance initializersInner InterfacesMethodsStatic fields/initializersMetaStuff20/*| * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.| *| * This software is open source.| * See the bottom of this file for the licence.| */disabled3*:0|java:1|javax:1|org:2disabledtruetruetruefalsefalsetrue1101455-14-108-11falsefalsefalsefalsetruefalsetruefalsefalsefalsefalsefalsefalsestatic|field|initializer|constructor|method|interface|classfalsetruepublic|protected|private|abstract|static|final|synchronized|transient|volatile|native|strictfptruetruetruetruefalsefalsefalsefalsefalsefalsetruefalsefalsetruetruetruetruetruetruefalsefalse1falsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsetruefalse80truefalsefalsefalsefalsefalsefalsefalse
jenkins-dom4j-1.6.1-hudson-3/xml/ 0000755 0001750 0001750 00000000000 11332657403 015411 5 ustar chuck chuck jenkins-dom4j-1.6.1-hudson-3/xml/cookbook.xml 0000644 0001750 0001750 00000102620 11332657403 017742 0 ustar chuck chuck
DOM4J CookbookTobiasRademacher0.0.301-06-20trademComplemted doc for alpha release0.0.201-06-06trademAdded "Secret of DocumentBuilder" and "Serialization"0.0.101-06-02trademCreated the documentJune 2001This document provides a practical instruction to dom4j. It guides you through by using a lot of examples and is based on dom4j v0.5ForewordIntroducing dom4j
Most readers already knowing that dom4j is a object model representing an XML Tree in memory. dom4j
offers a easy-to-use API that provides a powerfull set of functions to process, manipulate or navigate with that XML tree. The Designers of
dom4j concentrate on a interface-bases pattern-centric architecture in order to provide a resuable high configurable object
model. You are able to create your own tree builder's by relying on the existing infrastructure and extending them. Thus
simplictiy in resuablity comes with a little bit more effort by understandig the architecture in depth. This
document will guide you through dom4j's freatures in a pratical way. It uses a lot of explained examples to achive that. The document is
also desinged as a reference so that you don't have to read the entire document right now. The document concentrate on daily work with
dom4j and is therefore called cookbook. Readers that needs detailed instruction about Java and XML (JaXP - Java XML processing)
should have a look at A quick tour through Java XML Processing using DOM4J.
Creation of a XML Object Model using DOM4J
Normally it all starts with a set of xml-files or a single xml file that you want to process, manipulate or naviagte through to extract some
values necessary in your application. Most Java Open-Source project using XML for deploying or substiute their property fieles in order
to get easy readable property data.
Reading XML data
Who does dom4j helps you to get the data store in XML? dom4j comes with a set of
Builder Classes that parses the xml data and creating
a tree like object structure in memory. You can mainpulate or nativate throug that image now. Following example shows how you can
read your data using dom4j API.
import java.io.File;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
public class DeployFileLoaderSample {
/** DOM4J object model representation of a xml document. Note: We use the interface(!) not its implementation */
private Document doc;
/**
* Loads a document from a file.
*
* @throw a org.dom4j.DocumentException occurs whenever the buildprocess fails.
*/
public void parseWithSAX(File aFile) throws DocumentException {
SAXReader xmlReader = new SAXReader();
this.doc = xmlReader.read(aFile);
}
}
The above example code should clarify the use of org.dom4j.io.SAXReader to build a complete dom4j-Tree from a given file.
The io package of dom4j contains a set of clases for creating and serzializing XML memory images. As read() method
is a overloaded method you are able to pass different kind of object that represents a source.
java.net.URL - represents a Uniform Ressource Loader or a Uniform Ressource Identifier encasulate in a URL instancejava.io.InputStream - a open input stream that transports xml datajava.io.Reader - more compartable puls the abiltiy of setting the encoding schemeorg.sax.InputSource - a single input source for a XML entity.java.lang.String - a SystemId is a String that contains a URI e.g. a URL to a XML file
So we decide to add more flexiblity to our DeployFileLoaderSample and add new method.
import java.io.File;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
public class DeployFileLoaderSample {
/** DOM4J object model representation of a xml document. Note: We use the interface(!) not its implementation */
private Document doc;
/**
* Loads a document from a file.
*
* @param aFile the data source
* @throw a org.dom4j.DocumentExcepiton occurs whenever the buildprocess fails.
*/
public void parseWithSAX(File aFile) throws DocumentException {
SAXReader xmlReader = new SAXReader();
this.doc = xmlReader.read(aFile);
}
/**
* Loads a document from a file.
*
* @param aURL the data source
* @throw a org.dom4j.DocumentExcepiton occurs whenever the buildprocess fails.
*/
public void parseWithSAX(URL aURL) throws DocumentException {
SAXReader xmlReader = new SAXReader();
this.doc = xmlReader.read(aURL);
}
}
Using Reflection API provides the most flexbility for handling all kinds of org.dom4j.io.SAXReader Sources, but that
and even a check with instanceof needs a good exception management while you suspend and a lot of
xml driven application will not need this flexiblity.
Integrating orginal XML APIs
We have talked about reading a document with SAX now. dom4j offers also some classes for integration of
the two original XML processing APIs - SAX and DOM. org.dom4j.SAXContentHandler implements some
SAX interfaces. Thus you are able to use them to create a specific SAX-based Reader class.
The DOMReader class allows you to recycle a exsiting DOM tree. This could be usefull if you already used DOM
and want to replace it step by step with dom4j or if you just needs some of DOM's behaviors and want to save
memory ressources by transforming it in a dom4j Model. Your are able to transform a DOM Docuemnt, a DOM Node branch and
single element.
import org.sax.Document;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.DOMReader;
public class DOMIntegratorSample {
private Document doc;
public void buildDOM4JTree(org.sax.Document saxDoc) {
DOMReader xmlReader = new DOMReader();
this.doc = xmlReader.read(saxDoc);
}
}
The secret of DocumentFactory
Right now we have talked a lot of reading exisiting XML information e.g. form files, URL's or even Streams.
Sometimes it's necessary to generate a XML document from scratch within a running Java Application.
The class org.dom4j.DocumentFactory defines a set of factory methods in order to create empty documents, document
types, elements, attributes, unparsed character data (CDATA), a namespace, instance regarding XPath, a Nodefilter and
some other usefull instances. Thus makes the DocumentFactory class to a central class whenever you have to create
one of theses instances by yourself.
import org.dom4j.DocumentFactory;
import org.dom4j.Document;
import org.dom4j.Element;
public class DeployFileCreator {
private Document doc;
public void generateDoc(String aRootElement) {
Element root = DocumentFacotry.getInstance().createElement(aRootElement);
this.doc = DocumentFactory.getInstance().createDocument(root);
}
}
The listing shows how two generate a new Document from scratch. The method generateDoc takes a String instance of argument. The string value contains the name of
the root element of the new document. As you can see org.dom4j.DocumentFactory is a singleton that is accessable via getInstance() as most java singeltons are.
After we obtained the instance we can DocumentFacotrie's methods. They follow the createXXX() naming convention, so if you want to create a Attribute you would
call createAttribute() instead. If your class uses DocumentFactory a lot you should add it as a member variable and initiate it via getInstance in your constructor.
import org.dom4j.DocumentFactory;
import org.dom4j.Document;
import org.dom4j.Element;
public class GranuatedDeployFileCreator {
private DocumentFactory factory;
private Document doc;
public GranuatedDeployFileCreator() {
this.factory = DocumentFactory.getInstance();
}
public void generateDoc(String aRootElement) {
Element root = this.factory.createElement(aRootElement);
this.doc = this.factory.createDocument(root);
}
}
As mentioned earlier dom4j is a interface based API. This means that DocumentFacotry and the Reader classes in io package always returning this
interfaces. So you are forced to uses interfaces to work with the object model. Collection API and W3C's DOM itselfs are another APIs
that uses this approach. Why that is
such a wide spread desing is described here and as well here.
Serialization
Once you have parsed or created a document you want to serialized it to disk or into a plain (or encrypted) stream. dom4j provides a set of classes to serialize
your DOM4J tree in four ways:
XMLHTMLDOMSAX EventsSerializing to XMLorg.dom4j.io.XMLWriter is a easy-to-use and easy-to-understand class used to serialize a dom4j Tree to a plain XML. You are able
to write these XML tree with either a java.io.OutputStream or a java.io.Writer. This can be configured with the overloaded constructor.
Writer's can be installed after inistiation also. Let's have a look at a example.
import java.io.OutputStream;
import org.dom4j.Document;
import org.dom4j.io.XMLWriter;
public class DeployFileCreator {
private Document doc;
public void serilizetoXML(OutputStream out, String aEncodingScheme) throws Exception {
XMLWriter writer = new XMLWriter();
writer.setWriter(writer.createWriter(out,aEncodingScheme);
writer.write(this.doc);
writer.close;
}
}
We used writers createWriter method to wrap a given OutputStream with the appropriate encoding. You should use a Writer rather than a OutputStream, because you are able to control the encoding of your XML application. Since write()-Method is overloaded you are able to write all Object of which DOM4J consits.
Influencing the output format
There are two way to influence the output format: org.dom4j.io.OutputFormater and org.dom4j.io.XMLWriter. Both provide methods for formatting the output e.g setting of indent
or new line.
import java.io.OutputStream;
import org.dom4j.Document;
import org.dom4j.io.XMLWriter;
import org.dom4j.io.OutputFormat;
public class DeployFileCreator {
private Document doc;
public void serilizetoXML(OutputStream out, String aEncodingScheme) throws Exception {
XMLWriter writer = new XMLWriter(OutputFormat.getPrettyPrinting());
writer.setWriter(writer.createWriter(out,aEncodingScheme);
writer.write(this.doc);
writer.close;
}
}
XMLWriter has a default OutputFormat, but that is onyl a unconfigured instance of OutputFormat, so whenever you want to get a good readable output you should configure it.
Whereas OutputFormat gains you more control and information about the applied format XMLWriter has confortable methods that provide nearly the same functionability. Another interesting feature of OutputFormat the ability of setting the encoding. It is a good idiom to use OutputFormat for setting the encoding.
The close() method is necessary to close the underlying Writer. So if you consider to use a OutputStream you should use flush() insead.
import java.io.OutputStream;
import org.dom4j.Document;
import org.dom4j.io.XMLWriter;
import org.dom4j.io.OutputFormat;
public class DeployFileCreator {
private Document doc;
private OutputFormat outFormat;
public DeployFileCreator() {
this.outFormat = OuputFormat.getPrettyPrinting();
}
public DeployFileCreator(OutputFormat outFormat) {
this.outFormat = outFormat;
}
public void serilizeToXML(OutputStream out) throws Exception {
XMLWriter writer = new XMLWriter(outFormat);
writer.setWriter(writer.createWriter(out,outFormat.getEncoding);
writer.write(this.doc);
writer.close;
}
public void serilizeToXML(OutputStream out, String encoding) throws Exception {
this.outFormat.setEncoding(encoding);
this.serzializeToXML(out);
}
}
The seriazliation methods in our little example will now set encoding using OutputFormater. If you use the parameterless construtor and the seriazliation method takes only
an java.io.OutputStream UTF8 is used for encoding. If you need a simple output on screen for debbuing or testing you can omit setting of a Writer or an OutputStream completly
because dom4j.org.io.XMLWriter standard Stream is System.out.
Printing HTMLHTMLWriter takes a dom4j tree and formats it to a stream as HTML. This formatter is similar to
XMLWriter but outputs the text of CDATA and Entity sections rather than the serialised format as in XML and also supports certain element which have no corresponding close tag such as for >BR< and >P<
import java.io.OutputStream;
import org.dom4j.Document;
import org.dom4j.io.HTMLWriter;
import org.dom4j.io.OutputFormat;
public class DeployFileCreator {
private Document doc;
private OutputFormat outFormat;
public DeployFileCreator() {
this.outFormat = OuputFormat.getPrettyPrinting();
}
public DeployFileCreator(OutputFormat outFormat) {
this.outFormat = outFormat;
}
public void serilizeToHTML(OutputStream out) throws Exception {
HTMLWriter writer = new HTMLWriter(outFormat);
writer.setWriter(writer.createWriter(out,outFormat.getEncoding);
writer.write(this.doc);
writer.close;
}
}
Building a DOM-Tree
Sometimes it's necessary to transform your dom4j tree into an DOM tree, because you are currently refactoring your application.
dom4j is very convient for step-to-step substitution of older XML API's like dom or even SAX
(see Generating SAX Events). Let's move to an example:
import org.w3c.dom.Document;
import org.dom4j.Document;
import org.dom4j.io.DOMWriter;
public class DeployFileLoaderSample {
private org.dom4j.Document doc;
public org.w3c.dom.Document transformtoDOM() {
DOMWriter writer = new DOMWriter();
return writer.createDomDocument(this.doc);
}
}
Generating SAX Events
When you want to resolve a existing document into sax events in order to process the by origin classes dom4j provides org.dom4j.SAXWriter.
import org.xml.ConentHandler;
import org.dom4j.Document;
import org.dom4j.io.SAXWriter;
public class DeployFileLoaderSample {
private org.dom4j.Document doc;
public void transformtoSAX(ContentHandler ctxHandler) {
SAXWriter writer = new SAXWriter();
writer.setContentHandler(ctxHandler);
writer.write(doc);
}
}
Using SAXWriter is fairly easy as you can see. You can resolve also org.dom.Element which means that you are able to process a single element branch with SAX.
Navigation in DOM4J
dom4j offers powerfully methods for navigating through a document. These methods are:
Sun Implementation of GOF's Iterator Pattern in Collection API (java.util.Iterator and java.util.ListIterator)Index based navigation with List.get()In-Build XPath supportIn-Build GOF Visitor PatternUsing Iterator
Most Java developers have already used java.util.Iterator or it's ancestor java.util.Enumeration. Both classe are ziemlich involed into the Collection API and used
to visit the elements of a collection. The Iterator is appylied usually with a while loop and Iterator methods hasNext() and next() item. Right now Collection API
dont support Generic Type (like C++ Templates), but there's already a Early Access Implemention avaialbe. We talked a lot of Iterator for now let's move to an living
example of it in dom4j.
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.Element;
public class DeployFileLoaderSample {
private org.dom4j.Document doc;
private org.dom4j.Element root;
public void iterateRootChildren() {
root = this.doc.getRootElement();
Iterator elementIterator = root.elementIterator();
while(elementIterator.hasNext()){
System.out.println(((Element)elementIterator.next()).getName());
}
}
}
The above exapmle might be a little bit confusing if you are not close to Collection API. Casting is necessary when you want to acess the object. Sometimes casting
can be dangerous because of a java.lang.ClassCastException. dom4j normally uses a clean object model that such a exception never occurs. There's another interesting
approach in API may be usefull.
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.Element;
public class DeployFileLoaderSample {
private org.dom4j.Document doc;
private org.dom4j.Element root;
public void iterateRootChildren(String aFilterElementName) {
root = this.doc.getRootElement();
Iterator elementIterator = root.elementIterator(aFilterElementName);
while(elementIterator.hasNext()){
System.out.println(((Element)elementIterator.next()).getName());
}
}
}
Now the the method iterates on such Elements that have the same name as the parameterized String only. This can be used as a kind of
filter applied on to of Collection API's Iterator.
Index based Nativation
Sometimes it's nessary to access an Element directly by it's index. The following example is a modification of our Iterator example
explaining index addressing in dom4j.
import java.util.List;
import org.dom4j.Document;
import org.dom4j.Element;
public class DeployFileLoaderSample {
private org.dom4j.Document doc;
private org.dom4j.Element root;
public void iterateRootChildren() {
root = this.doc.getRootElement();
List elements = root.elements;
for(int i=0; i < list.size()-1; i++) {
System.out.println(((Element)elements.get(i)).getName());
}
}
}
Remember that this form of Navigation is unsafe. You have to deal with IndexOutOfBoundsException and should choose this form of Navigation only when fast
direct acess is necessary.
The elegant XPath Implementation
XPath is is one of the most usefull features of dom4j. You can use it to retrieval element brances from any location
your currently are. A good XPath Refercence can be found in Micheal Kay's XSLT book XSLTReference.
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.Element;
public class DeployFileLoaderSample {
private org.dom4j.Document doc;
private org.dom4j.Element root;
public void browseRootChildren() {
Iterator xpathResult = this.doc.selectNodes("/*").iterator();
while(xpathPathResult.hasNext(){
System.out.println(((Element)elementIterator.next()).getName());
}
}
As selectNodes returns a List we can apply Iterator or any other Operation avaliable on java.util.List. It's also able to select a singel node when you use a fully qualified XPath.
Using Visitor Pattern
The visitor pattern has a recrusive behavior and acts like SAX in the way that partical traversal is not possible. This means the complete document or the complete element branch will be visited. You should consider wisely when you want to use Visitor pattern, but then it offers a powerfull and elegant way of navigation. This document doesn't explain Vistor Pattern in deepth, GoF covers more information.
import java.util.Iterator;
import org.dom4j.Visitor;
import org.dom4j.VisitorSupport;
import org.dom4j.Document;
import org.dom4j.Element;
public class StyleDocumentSample {
As you can see we used a anonymous inner class to override the VisitorSupport callback apdapter method visit(Element element), wherase accept starts
the inbuild vistor implemention. Please keep in mind that the complete element branch is visited.
Mainpulation with DOM4J
Acessing XML content statically is not very amazing. Thus dom4j offers serval methods for manipulation a documents content.
What org.dom4j.Document provides
A org.dom4j.Document allows you to configure and retreive the root element. You are also able to set the DOCTYPE or a SAX based EntityResolver. An empty Document should be created via org.dom4j.DocumentFactory.
Working with org.dom4j.Elementorg.dom4j.Element is a powerfull interface providing lots of methods for manipulation an Element.
public void changeElementName(String aName) {
this.element.setName(aName);
}
public void changeElementText(String aText) {
this.element.setText(aText);
}
Qualified Names
A XML Element should have a qualified name. A qualified name consits normally of a Namespace and a
local name. It's recommend to use org.dom4j.DocumentFactory to create Qualifed
Names that are provided by org.dom4j.QName instances.
import org.dom4j.Element;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.QName;
public class DeployFileCreator {
protected Document deployDoc;
protected Element root;
public void DeployFileCreator()
{
QName rootName = DocumentFactory.getInstance().createQName("preferences", "", "http://java.sun.com/dtd/preferences.dtd");
this.root = DocumentFactory.getInstance().createElement(rootName);
this.deployDoc = DocumentFactory.getInstance().createDocument(this.root);
}
}
Inserting elements
Somethimes it's necssary to insert an element somewhere in a existing XML Tree. As dom4j is based on Collection API this
causes no problems. The following exapmle shows how it could be done.
public void insertElementAt(Element newElement, int index) {
Element parent = this.element.getParent();
List list = parent.content();
list.add(index, newElement);
}
public void testInsertElementAt() {
//insert an clone of current element after the current element
Element newElement = this.element.clone();
this.insertElementAt(newElement, this.root.indexOf(this.element)+1);
// insert an clone of current element before the current element
this.insertElementAt(newElement, this.root.indexOf(this.element));
}
Studying the Collection API should lead to more solutions for similar problem and you will notify that dom4j fits well in the Collection Framework and both completing
each other in order to processing xml document in a comfortable way.
Cloning - Who many sheeps do you need?
Elements can be cloned as well. Usually cloning is supported in Java with clone() method that is derived from Object, but a cloneable Object have to
implement interface Clonable. Java support shallow copying by simply returning this for standard. dom4j supporting deep cloning
because shallow copies would not make sence in context of an XML object model. This means that cloning can take a while because the complete tree branch or event the document
will be cloned. Now we have a short look how dom4j coling mechanism is used.
import org.dom4j.Document;
import org.dom4j.Element;
public class DeployFileCreator {
private Element cloneElement(String name) {
return this.root.element(name).clone();
}
private Element cloneDetachElement(String name) {
return this.root.createCopy(name);
}
public class TestElement extends junit.framework.TestCase {
public void testCloning() throws junit.framwork.AssertionFailedException {
assert("Test cloning with clone() failed!", this.creator.cloneElement("Key") != null);
assert("Test cloning with createCopy() failed!", this.creator.cloneDetachElement() != null);
}
}
}
The difference between createCopy(...) and clone() is that first is a polymorphic method that created a decoupled deep copy whereas returns a returns a deep copy of the
current document or element itself. Cloning might be usefull when you want to build a element pool. Such a pool should be desinged carefully keeping
OutOfMemoryException in mind. You could alternativly consider to use Reference API Pawlan98
or other the aproach here JavaWorldTip76Using dom4j for XSLT
With eXtensible Stylesheet Language XML got's a powerfull method of transforming itself into other formats. Developing Exportfilter's for dataformats are normally a hard job and so for XML XSL simpliefs that work. The aronym XSLT means the process of transformation, that is usally done by an XSL compliant Processor. XSL covers following subjects:
XSL Style SheetXSL Processor for XSLTFOP Processor for FOPAn XML source
Since JaXP 1.1 TraX is the common API for proceeding a XSL Stylesheet inside Java. You start with a TransformerFactory and dealing with Result and Source. A Source contains the source xml file that should be transformed. Result's containted the the result of transformation. dom4j offers org.dom4j.io.DocumentResult and org.dom4j.io.DocumenSource for compatiblity to TrAX.
Whereas org.dom4j.io.DocumentResult contains a org.dom4j.Document as result tree, DocumentSource takes dom4j Documents and pepare them for transformation. Both classes are build on top of TraX own SAX classes. This is much more perfomant as a DOM adaptation. The following example explains the use of XSLT with TraX and dom4j.
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import org.dom4j.Document;
import org.dom4j.io.DocumentResult;
import org.dom4j.io.DocumentSource;
public class TemplateGeneratorSample {
public Source styleSheet;
public Document schema;
public Transformer transformer;
public DocumentResult result;
public class TemplateGenerator(Document aSchema, Source aStyleSheet) {
this.styleSheet = aStyleSheet;
this.schema = aSchema;
this.result = new DocumentResult();
this.transformer = TransformerFactory.newTransformer(new StreamSource(this.styleSheet.getSystemId()));
this.start();
}
public void start() {
this.transformer.transform(this.schema, this.result);
}
public Document getTemplate() {
return this.result.getDocument();
}
}
Imagine that you use XSLT to process a XML Schema in order to generate a empty template xml file accoring the schema contraints. The above sample should how easy the Java code is when you use dom4j and it's TraX support. If you use TemplateGenerator a lot you should consider the application of singleton pattern, but for this example I avoided this for simplicity. More information about TraX is provided here.
Schema-SupportFurther ReadingBooksXSLTReferenceMichaelKay2001Worx Press, Inc.1-861-005067Worx PressXSLT Programmer's Reference 2'nd EditionProgrammer To ProgrammerWorx PressGoF95ErichGammaRichardHelmRalphJohnsonJohnVlissides1995Addison Wesley Pub, Co.0-201-633-612Worx PressXSLT Programmer's Reference 2'nd EditionArticlesPawlan98MonicaPawlan1998http://developer.java.sun.com/javatips/jw-tips76.htmlReference Objects and Garbage CollectionJavaTip76DaveMillerhttp://www.javaworld.com/javaworld/javatips/jw-javatip76.htmlAn alternative to the deep copying technique
jenkins-dom4j-1.6.1-hudson-3/xml/test/ 0000755 0001750 0001750 00000000000 11332657403 016370 5 ustar chuck chuck jenkins-dom4j-1.6.1-hudson-3/xml/test/nestedNamespaces.xml 0000644 0001750 0001750 00000000341 11332657403 022372 0 ustar chuck chuck
works
jenkins-dom4j-1.6.1-hudson-3/xml/test/junk.xml 0000644 0001750 0001750 00000000055 11332657403 020061 0 ustar chuck chuck hi therehello world