|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.joseluismartin.xml.XMLUtils
public abstract class XMLUtils
XML DOM Utility static lib for XML (Thread safe) Cache the DOM DocumentBuilder in thread local variable.
| Constructor Summary | |
|---|---|
XMLUtils()
|
|
| Method Summary | |
|---|---|
static Node |
copyNode(Node source,
Node dest)
Copy one node to another node. |
static String |
documentToString(Document doc)
Serialize a Document to a Sring using JAXP without formating |
static String |
elementToString(Element elto)
Element to String without format |
static DocumentBuilder |
getDocumentBuilder()
Get a DocumentBuilder from a ThreadLocal variable, Create if null |
static Document |
newDocument()
Get new instance of DOM Document |
static Document |
newDocument(String xml)
Get a new org.w3c.Document from xml string (UTF8) |
static Document |
newDocument(String ns,
String name)
Creates a new Document with name and namespace |
static Document |
newDocumentFromFile(String path)
Get a new org.w3c.Document from files String |
static Document |
newDocumentFromResource(String res)
Get a org.w3c.Document from resource String |
static String |
prettyDocumentToString(Document doc)
Serialize a Document to a String using JAXP with identation (4 spaces) |
static Element |
stringToElement(String xml)
Get a DOM Element from xml string |
static ValidationResult |
validateSchema(Document doc,
Schema schema)
Validate Document on schema |
static ValidationResult |
validateSchema(String xml,
Schema schema)
Validate a Document with schema |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLUtils()
| Method Detail |
|---|
public static Document newDocumentFromResource(String res)
res - ResourceString
public static Document newDocumentFromFile(String path)
path - ResourceString
public static Document newDocument(String xml)
xml - string with xml
public static Document newDocument()
public static DocumentBuilder getDocumentBuilder()
public static String prettyDocumentToString(Document doc)
doc - to serialize
public static String documentToString(Document doc)
doc - Document to serialize
public static String elementToString(Element elto)
elto - to serialize
public static Element stringToElement(String xml)
xml - the string to parse
public static Node copyNode(Node source,
Node dest)
source - source Nodedest - destination Node
public static Document newDocument(String ns,
String name)
ns - namespacename - name
public static ValidationResult validateSchema(String xml,
Schema schema)
xml - to validateschema - to falidate from
public static ValidationResult validateSchema(Document doc,
Schema schema)
doc - to validateschema - for validation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||