X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fxml%2Fpackage-info.java;h=020caed16799f7fbab9d7049c7cc560b2895f598;hb=e5f859aa0fcab5a3e4a754e5ebce475faa88a6d3;hp=2aa6c822d9ed4ba4de0ee24d6f2cc7efca39b4b6;hpb=4a575582a5c2999bd816b197d9cf274b4b3ddcd7;p=utils diff --git a/support/general/src/main/java/org/wamblee/xml/package-info.java b/support/general/src/main/java/org/wamblee/xml/package-info.java index 2aa6c822..020caed1 100644 --- a/support/general/src/main/java/org/wamblee/xml/package-info.java +++ b/support/general/src/main/java/org/wamblee/xml/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2005-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,67 @@ * limitations under the License. */ /** - * Utilities for XML processing. + *
+ * Utilities for XML processing. The aim of this package is to simplify the + * common tasks of parsing, validating, and transforming XML files and to + * provide support for XPath. The utlities use the standard Java SE APIs + * but are much easier to use. For cases where more advanced functionality is required, + * the classes provide access to the underlying Java SE types. The implementation is + * based on DOM level 3 parsing. + *
+ * + *+ * Classes {@link org.wamblee.xml.XMLDocument}, {@link org.wamblee.xml.XMLSchema}, and + * {@link org.wamblee.xml.XSLTransformation} provide parsing, validation, and transformation + * of XML files. The {@link org.wamblee.xml.XMLDocument} class provides various static + * methods as entry point for this functionality, simplifying the code a lot when + * static imports are used. The API design uses a fluent interfaces style. For instance, + * to parse, validate, and transform an XML file, one can write: + *
+ *+ * import static org.wamblee.xml.XMLDocument.*; + * ... + * XMLDocument doc = xmldocument(new File("x.xml").toURI()).validate(new File("x.xsd").toURI()).transform(new File("x.xsl").toURI()); + *+ * + *
+ * In addition, a URI resolver {@link org.wamblee.xml.ClasspathUriResolver} is provided to allow resolution of + * documents on the classpath. + *
+ * + *+ * For XPath the following classes are provided: + *
+ *XPathExpression
objects based on a given namespace
+ * context.
+ * + * For instance to apply an XPath expression to an XML document: + *
+ *+ * NamespaceContext context = new XPathContext(new SimpleNamespaceContext() + * .addPrefix("n", "http://example.com/1") + * .addPrefix("m", "http://example.com/2")); + * XMLDocument doc = new XMLDocument(new File("xpathexample.xml").toURI()); + * String value = context.createExpression("/n:root/m:x").stringEval(doc); + *+ *
+ * Or, using static imports: + *
+ *+ * NamespaceContext context = xpathcontext(namespaces() + * .addPrefix("n", "http://example.com/1") + * .addPrefix("m", "http://example.com/2")); + * XMLDocument doc = xmldocument(new File("xpathexample.xml").toURI()); + * String value = context.createExpression("/n:root/m:x").stringEval(doc); + **/ package org.wamblee.xml;