com.nonesole.swing.plaf.basic.xmlparser
Class W3CXml

java.lang.Object
  extended by com.nonesole.swing.plaf.basic.xmlparser.W3CXml

public class W3CXml
extends java.lang.Object

Version:
1.0 - build in 2008-03-04
Author:
JACK

Constructor Summary
W3CXml()
           
 
Method Summary
static org.w3c.dom.Document createDocument()
          Create DOM Document
static javax.xml.parsers.DocumentBuilder createDocumentBuilder()
          Create DocumentBuilder
static java.util.List<org.w3c.dom.Node> getNodes(org.w3c.dom.Node node, java.lang.String nodeName)
          Get child nodes
static java.lang.String getNodes(org.w3c.dom.Node node, java.lang.String nodeName, int position, java.lang.String itemName)
          Get nodes.
static org.w3c.dom.Node getRoot(org.w3c.dom.Document doc)
          Get root
static org.w3c.dom.Document loadFile(java.lang.String filePath)
          Load file
static org.w3c.dom.Document loadFile(java.net.URL url)
          Load file
static byte[] parseToStream(org.w3c.dom.Document doc)
          Document to byte[].
static org.w3c.dom.Document parseXmlDocument(byte[] xml)
          Parser byte[].
static org.w3c.dom.Document parseXmlDocument(java.lang.StringBuffer xmlString)
          Parser StringBuffer.
static void saveFile(org.w3c.dom.Document doc, java.lang.String filePath)
          Save file
static java.lang.String xmlDocumentToString(org.w3c.dom.Document doc)
          Document to String.
static java.lang.StringBuffer xmlDocumentToStringBuffer(org.w3c.dom.Document doc)
          Document to StringBuffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

W3CXml

public W3CXml()
Method Detail

createDocumentBuilder

public static javax.xml.parsers.DocumentBuilder createDocumentBuilder()
                                                               throws javax.xml.parsers.ParserConfigurationException
Create DocumentBuilder

Returns:
DocumentBuilder
Throws:
javax.xml.parsers.ParserConfigurationException

parseXmlDocument

public static org.w3c.dom.Document parseXmlDocument(java.lang.StringBuffer xmlString)
                                             throws javax.xml.parsers.ParserConfigurationException,
                                                    org.xml.sax.SAXException,
                                                    java.io.IOException
Parser StringBuffer.

Parameters:
StringBuffer - xmlString
Returns:
Document
Throws:
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException

parseXmlDocument

public static org.w3c.dom.Document parseXmlDocument(byte[] xml)
                                             throws javax.xml.parsers.ParserConfigurationException,
                                                    org.xml.sax.SAXException,
                                                    java.io.IOException
Parser byte[].

Parameters:
byte[] - xml
Returns:
Document;
Throws:
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException

createDocument

public static org.w3c.dom.Document createDocument()
                                           throws javax.xml.parsers.ParserConfigurationException
Create DOM Document

Returns:
DOM Document Object;
Throws:
javax.xml.parsers.ParserConfigurationException

xmlDocumentToString

public static java.lang.String xmlDocumentToString(org.w3c.dom.Document doc)
Document to String.

Parameters:
Document - doc
Returns:
String

xmlDocumentToStringBuffer

public static java.lang.StringBuffer xmlDocumentToStringBuffer(org.w3c.dom.Document doc)
Document to StringBuffer.

Parameters:
Document - doc
Returns:
StringBuffer

parseToStream

public static byte[] parseToStream(org.w3c.dom.Document doc)
Document to byte[].

Parameters:
Document - doc
Returns:
byte[]

loadFile

public static org.w3c.dom.Document loadFile(java.lang.String filePath)
                                     throws java.lang.Exception
Load file

Parameters:
String - filePath
Returns:
Document
Throws:
java.lang.Exception

loadFile

public static org.w3c.dom.Document loadFile(java.net.URL url)
                                     throws java.lang.Exception
Load file

Parameters:
URL - url
Returns:
Document
Throws:
java.lang.Exception

saveFile

public static final void saveFile(org.w3c.dom.Document doc,
                                  java.lang.String filePath)
                           throws javax.xml.transform.TransformerException
Save file

Parameters:
Doucument - doc
String - filePath
Throws:
javax.xml.transform.TransformerException

getRoot

public static org.w3c.dom.Node getRoot(org.w3c.dom.Document doc)
Get root

Parameters:
Document - doc
Returns:
Node

getNodes

public static java.util.List<org.w3c.dom.Node> getNodes(org.w3c.dom.Node node,
                                                        java.lang.String nodeName)
Get child nodes

Parameters:
Node - node
String - nodeName
Returns:
List

getNodes

public static java.lang.String getNodes(org.w3c.dom.Node node,
                                        java.lang.String nodeName,
                                        int position,
                                        java.lang.String itemName)
Get nodes.

Parameters:
Node - node
String - nodeName
int - position
String - itemName
Returns:
String