|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造函数 | 方法 | 详细信息: 字段 | 构造函数 | 方法 |
java.lang.Objectcom.nonesole.swing.plaf.basic.xmlparser.W3CXml
public class W3CXml
使用 org.w3c.* 中的类来创建一些方法。
xml工具包提供了由文件-〉Document对象、由Document对象到文件、由Document->String/StringBuffer/byte[]
类型、由String/StringBuffer/byte[]-〉Document类型的方法。
构造函数摘要 | |
---|---|
W3CXml()
|
方法摘要 | |
---|---|
static org.w3c.dom.Document |
createDocument()
创建一个新的DOM Document对象。 |
static javax.xml.parsers.DocumentBuilder |
createDocumentBuilder()
创建 DocumentBuilder 对象。 |
static java.util.List<org.w3c.dom.Node> |
getNodes(org.w3c.dom.Node node,
java.lang.String nodeName)
获取指定名称节点的集合 |
static java.lang.String |
getNodes(org.w3c.dom.Node node,
java.lang.String nodeName,
int position,
java.lang.String itemName)
获取第一个指定名称节点的指定属性值 |
static org.w3c.dom.Node |
getRoot(org.w3c.dom.Document doc)
获取根节点 |
static org.w3c.dom.Document |
loadFile(java.lang.String filePath)
读取XML文件,返回Document对象 |
static org.w3c.dom.Document |
loadFile(java.net.URL url)
读取XML文件,返回Document对象 |
static byte[] |
parseToStream(org.w3c.dom.Document doc)
将Documnet对象转换为byte[]字节数组 |
static org.w3c.dom.Document |
parseXmlDocument(byte[] xml)
解析byte[]数组为Document对象。 |
static org.w3c.dom.Document |
parseXmlDocument(java.lang.StringBuffer xmlString)
解析StringBuffer对象为Document对象. |
static void |
saveFile(org.w3c.dom.Document doc,
java.lang.String filePath)
将Document对象保存为XML文件 |
static java.lang.String |
xmlDocumentToString(org.w3c.dom.Document doc)
把Document转换为String对象 |
static java.lang.StringBuffer |
xmlDocumentToStringBuffer(org.w3c.dom.Document doc)
把Document转换为StringBuffer对象 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造函数详细信息 |
---|
public W3CXml()
方法详细信息 |
---|
public static javax.xml.parsers.DocumentBuilder createDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document parseXmlDocument(java.lang.StringBuffer xmlString) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
xmlString
- - StringBuffer对象;
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document parseXmlDocument(byte[] xml) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
xml
- - the byte[] array object;
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document createDocument() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static java.lang.String xmlDocumentToString(org.w3c.dom.Document doc)
doc
- Document对象
public static java.lang.StringBuffer xmlDocumentToStringBuffer(org.w3c.dom.Document doc)
doc
- Document对象
public static byte[] parseToStream(org.w3c.dom.Document doc)
doc
- Document对象
public static org.w3c.dom.Document loadFile(java.lang.String filePath) throws java.lang.Exception
filePath
- String
java.lang.Exception
public static org.w3c.dom.Document loadFile(java.net.URL url) throws java.lang.Exception
filePath
- String
java.lang.Exception
public static final void saveFile(org.w3c.dom.Document doc, java.lang.String filePath) throws javax.xml.transform.TransformerException
doc
- Doucument对象filePath
- 文件的路径
java.lang.Exception
javax.xml.transform.TransformerException
public static org.w3c.dom.Node getRoot(org.w3c.dom.Document doc)
doc
- Document对象
public static java.util.List<org.w3c.dom.Node> getNodes(org.w3c.dom.Node node, java.lang.String nodeName)
node
- 父节点对象nodeName
- 指定子节点的名称
public static java.lang.String getNodes(org.w3c.dom.Node node, java.lang.String nodeName, int position, java.lang.String itemName)
node
- 父节点对象nodeName
- 指定子节点的名称position
- 取同名称子节点的第position个子节点itemName
- 指定属性的名称
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造函数 | 方法 | 详细信息: 字段 | 构造函数 | 方法 |