- 浏览: 286348 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
lliiqiang:
关键在于业务也正确,数据格式只是一种声明协议
XML验证 -
koubi1986:
你好!请教一些问题:请问一下1。你是如何把nutch抓取到的二 ...
Nutch应用 -
juda:
你的希尔排序有问题, for( int i = d; i & ...
排序--插入排序 -
hamlzf:
这个例子很不错
JProfiler学习笔记 -
白色熊猫:
应该下面还有啊 ,看不到啊 麻烦贴出来下 谢谢了
多线程编程 高级主题(二)注:转
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.jdom.xpath.XPath;
/**
* Jdom解析XML
*
* @FileName:XMLUtil.java
* @author Javer.Leo (QQ:84831612)
* @date 2006-8-16
*/
public final class XMLUtil
{
/**
* 定义xml编码方式
*/
public static final String ENCODE_GBK = "GBK";
public static final String ENCODE_UTF8 = "UTF-8";
public static final String ENCODE_UTF16 = "UTF-16";
public static final String ENCODE_GB2312 = "gb2312";
public static final String ENCODE_ISO8859 = "ISO8859-1";
private static Format format = Format.getPrettyFormat();
static {
format.setEncoding(ENCODE_UTF8);
}
/**
* Read and parse an xml document from the file at xml/sample.xml.
* This method corresponds to the code in Listing 7.
* @param filePath 要解析的xml文件路径
* @return the JDOM document parsed from the file.
* @throws IOException
*/
public static Document readDocument(String filePath) throws IOException {
try {
SAXBuilder builder = new SAXBuilder(false);
Document anotherDocument = builder.build(new File(filePath));
return anotherDocument;
} catch(Exception e) {
e.printStackTrace();
throw new IOException(e.getMessage());
}
}
/**
* Read and parse an xml document from the file at xml/sample.xml.
* This method corresponds to the code in Listing 7.
* @param filePath 要解析的xml文件路径
* @return the JDOM document parsed from the file.
* @throws IOException
*/
public static Document readDocument(InputStream input) throws IOException {
try {
SAXBuilder builder = new SAXBuilder(false);
Document anotherDocument = builder.build(input);
input.close();
return anotherDocument;
} catch(Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* 读取xml文件
* @param srcFile 目标文件
* @return DOM对象
* @throws IOException
*/
public static Document readDocument(File srcFile) throws IOException {
try {
SAXBuilder builder = new SAXBuilder();
Document anotherDocument = builder.build(srcFile);
return anotherDocument;
} catch(Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* 向指定的文档模型添加指定元素标识名称的元素
* @param document 要添加元素的文档模型
* @param elementName 要添加的元素标识名称
* @param parentElementPath 父元素路径
* @return
*/
public static void addElement(Object document,String parentElementPath,String elementName){
try{
Element parentElement;
parentElement = (Element)XPath.selectSingleNode(document,parentElementPath);
Element newElement = new Element(elementName);
parentElement.addContent(newElement);
} catch (Exception e1) {
e1.printStackTrace();
}
}
/**
* 向指定的文档模型添加已创建元素
* @param document 要添加元素的文档模型
* @param newElement 要添加的新元素
* @param parentElementPath 父元素路径
* @return
*/
public static void addElement(Object document,String parentElementPath,Element newElement){
try{
Element parentElement;
parentElement = (Element)XPath.selectSingleNode(document,parentElementPath);
parentElement.addContent(newElement);
} catch (Exception e1) {
e1.printStackTrace();
}
}
/**
* 获取指定子元素路径的子元素列表
* @param document the JDOM document built from Listing 2
* @param visitedNodeName 指定要访问的子节点元素名称
* @return 返回指定元素路径的子元素列表
*/
public static List getChildrenElement(Object document,String visitedNodeName) {
List visitElements = null;
try {
visitElements = XPath.selectNodes(document,visitedNodeName);
} catch (Exception e) {
e.printStackTrace();
}
return visitElements;
}
/**
* 获取指定子元素路径名称和属性名称及值的元素
* @param document the JDOM document built from Listing 2
* @param visitedNodeName 指定要访问的子节点元素名称
* @param attributeName 属性名称
* @param attributeValue 属性值
* @return 返回指定的元素
*/
public static Element getChildElement(Object document,String visitedNodeName,String attributeName,String attributeValue) {
Element visitElement = null;
try {
visitElement = (Element)XPath.selectSingleNode(document,visitedNodeName+"[@"+attributeName+"='"+attributeValue+"']");
} catch (Exception e) {
e.printStackTrace();
}
return visitElement;
}
/**
* 获取指定子元素路径名称和属性名称及值的元素
* @param document the JDOM document built from Listing 2
* @param visitedNodeName 指定要访问的子节点元素名称
* @return 返回指定的元素
*/
public static Element getChildElement(Object document,String visitedNodeName) {
Element visitElement = null;
try {
visitElement = (Element)XPath.selectSingleNode(document,visitedNodeName);
} catch (Exception e) {
e.printStackTrace();
}
return visitElement;
}
/**
* 删除指定元素节点路径的元素
* @param removeNodeName 要删除的元素路径
* @param document xml文件对应的文档模型
*/
public static boolean removeChildElement(Object document,String removeNodeName) {
Element visitElement = null;
boolean isRemoved = false;
try {
visitElement = (Element)XPath.selectSingleNode(document,removeNodeName);
if(visitElement != null)
isRemoved = visitElement.getParentElement().removeContent(visitElement);
} catch (Exception e) {
e.printStackTrace();
}
return isRemoved;
}
/**
* 删除指定属性的元素
* @param document xml文件对应的文档模型
* @param removeNodeName 要删除的节点元素路径
* @param attributeName 属性名称
* @param attributeValue 属性值
* @return
*/
public static boolean removeChildElement(Object document,String removeNodeName ,String attributeName,String attributeValue) {
List removeElements = null;
Element visitElement = null;
boolean isRemoved = false;
try {
removeElements = XPath.selectNodes(document,removeNodeName+"[@"+attributeName+"='"+attributeValue+"']");
if(removeElements != null){
for (int i = 0; i < removeElements.size(); i++) {
visitElement = (Element) removeElements.get(i);
isRemoved = visitElement.getParentElement().removeContent(visitElement);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return isRemoved;
}
/**
* 将xml文档模型输出到标准输出设备(屏幕)
* @param document 指定的xml文档模型
*/
public static void outputDocument(Document document) {
format.setIndent(" ");
format.setExpandEmptyElements(false);
try {
XMLOutputter outputter = new XMLOutputter(format);
outputter.output(document, System.out);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 将xml文档模型输出到标准输出设备(流)
* @param document 指定的xml文档模型
*/
public static void outputDocument(Document document,OutputStream output) {
format.setIndent(" ");
format.setExpandEmptyElements(false);
try {
XMLOutputter outputter = new XMLOutputter(format);
outputter.output(document, output);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 将xml文档模型输出到指定文件
* @param document 指定的xml文档模型
* @param outputFilePath 输出文件路径
*/
public static void outputDocumentToFile(Document document,String outputFilePath) {
outputDocumentToFile(document,outputFilePath,ENCODE_GB2312);
}
/**
* 将xml文档模型输出到指定文件
* @param document 指定的xml文档模型
* @param outputFilePath 输出文件路径
* @param encodingMode 编码方式
*/
public static void outputDocumentToFile(Document document,String outputFilePath,String encodingMode) {
format.setEncoding(encodingMode);
format.setIndent(" ");
format.setExpandEmptyElements(false);
FileWriter writer = null;
try {
XMLOutputter outputter = new XMLOutputter(format);
writer = new FileWriter(outputFilePath);
outputter.output(document, writer);
writer.close();
}catch(Exception ep) {
ep.printStackTrace();
}
finally{
try {
if(writer != null)
writer.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
/**
* 将将xml文档模型输出到指定字符串
* @param document 指定的xml文档模型
* @return 返回document的内容
*/
public static String outputDocumentString(Document document){
return outputDocumentString(document,ENCODE_GBK);
}
/**
* 将将xml文档模型输出到指定字符串
* @param document 指定的xml文档模型
* @param encodingMode 编码格式
* @return 返回document的内容
*/
public static String outputDocumentString(Document document,String encodingMode){
format.setEncoding(encodingMode);
format.setIndent(" ");
format.setExpandEmptyElements(false);
XMLOutputter outputter = new XMLOutputter(format);
return outputter.outputString(document);
}
/**
* This method takes a JDOM document in memory, an xsl file at xml/car.xsl,
* and outputs the results to stdout.
* This method corresponds to Listing 9.
* @param myDocument the JDOM document built from Listing 2.
*/
// public static void executeXSL(Document myDocument) {
// try {
// TransformerFactory tFactory = TransformerFactory.newInstance();
// // Make the input sources for the XML and XSLT documents
// org.jdom.output.DOMOutputter outputter = new org.jdom.output.DOMOutputter();
// org.w3c.dom.Document domDocument = outputter.output(myDocument);
// javax.xml.transform.Source xmlSource = new javax.xml.transform.dom.DOMSource(domDocument);
// StreamSource xsltSource = new StreamSource(new FileInputStream("car.xsl"));
// //Make the output result for the finished document
// /*
// * Note that here we are just going to output the results to the
// * System.out, since we don't actually have a HTTPResponse object
// * in this example
// */
// //StreamResult xmlResult = new StreamResult(response.getOutputStream());
// StreamResult xmlResult = new StreamResult(System.out);
// //Get a XSLT transformer
// Transformer transformer = tFactory.newTransformer(xsltSource);
// //do the transform
// transformer.transform(xmlSource, xmlResult);
// } catch(FileNotFoundException e) {
// e.printStackTrace();
// } catch(TransformerConfigurationException e) {
// e.printStackTrace();
// } catch(TransformerException e) {
// e.printStackTrace();
// } catch(org.jdom.JDOMException e) {
// e.printStackTrace();
// }
// }
/**
* 修改指定节点元素的属性
* @param document
* @param nodePath
* @param name
* @param value
*/
public static void setElementAttributeValue(Object document,String nodePath,String name,String value){
try {
((Element)XPath.selectSingleNode(document,nodePath)).setAttribute(name,value);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 修改指定节点元素的属性
* @param document
* @param nodePath
* @param attrName
* @param attrValue
* @param name
* @param value
*/
public static void setElementAttributeValue(Object document,String nodePath,String attrName,String attrValue,String name,String value){
nodePath +="[@" + attrName + "='" + attrValue + "']";
setElementAttributeValue(document,nodePath,name,value);
}
/**
* 修改指定节点元素的内容
* @param document
* @param nodePath
* @param text
*/
public static void setElementText(Object document,String nodePath,String text){
try {
((Element)XPath.selectSingleNode(document,nodePath)).setText(text);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 修改指定节点元素的内容
* @param document
* @param nodePath
* @param attrName
* @param attrValue
* @param text
*/
public static void setElementText(Object document,String nodePath,String attrName,String attrValue,String text){
nodePath +="[@" + attrName + "='" + attrValue + "']";
setElementText(document,nodePath,text);
}
/**
* 设置xml的编码格式
* @param encode
*/
public static void setEncoding(String encode){
format.setEncoding(encode);
}
/**
* 用DTD文档类型定义校验xml文档
* @param content
* @return
*/
// public static boolean validate(){
// SAXBuilder builder = new SAXBuilder(true);
// try{
// // Jdom complains about the document even though it is valid
// ByteArrayInputStream bais=new ByteArrayInputStream(content.getBytes());
// builder.build(bais);
// return true;
//
// } catch (Exception e) {
//
// return false;
//
// }
//
// }
public static void main(String[] args) throws Exception
{
Document doc = XMLUtil.readDocument("test.xml");
List shapes = XMLUtil.getChildrenElement(doc, "javer/leo/example");
for(int i=0;i {
System.out.println(XMLUtil.getChildElement(shapes.get(i), "id").getText());
}
}
}
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.jdom.xpath.XPath;
/**
* Jdom解析XML
*
* @FileName:XMLUtil.java
* @author Javer.Leo (QQ:84831612)
* @date 2006-8-16
*/
public final class XMLUtil
{
/**
* 定义xml编码方式
*/
public static final String ENCODE_GBK = "GBK";
public static final String ENCODE_UTF8 = "UTF-8";
public static final String ENCODE_UTF16 = "UTF-16";
public static final String ENCODE_GB2312 = "gb2312";
public static final String ENCODE_ISO8859 = "ISO8859-1";
private static Format format = Format.getPrettyFormat();
static {
format.setEncoding(ENCODE_UTF8);
}
/**
* Read and parse an xml document from the file at xml/sample.xml.
* This method corresponds to the code in Listing 7.
* @param filePath 要解析的xml文件路径
* @return the JDOM document parsed from the file.
* @throws IOException
*/
public static Document readDocument(String filePath) throws IOException {
try {
SAXBuilder builder = new SAXBuilder(false);
Document anotherDocument = builder.build(new File(filePath));
return anotherDocument;
} catch(Exception e) {
e.printStackTrace();
throw new IOException(e.getMessage());
}
}
/**
* Read and parse an xml document from the file at xml/sample.xml.
* This method corresponds to the code in Listing 7.
* @param filePath 要解析的xml文件路径
* @return the JDOM document parsed from the file.
* @throws IOException
*/
public static Document readDocument(InputStream input) throws IOException {
try {
SAXBuilder builder = new SAXBuilder(false);
Document anotherDocument = builder.build(input);
input.close();
return anotherDocument;
} catch(Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* 读取xml文件
* @param srcFile 目标文件
* @return DOM对象
* @throws IOException
*/
public static Document readDocument(File srcFile) throws IOException {
try {
SAXBuilder builder = new SAXBuilder();
Document anotherDocument = builder.build(srcFile);
return anotherDocument;
} catch(Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* 向指定的文档模型添加指定元素标识名称的元素
* @param document 要添加元素的文档模型
* @param elementName 要添加的元素标识名称
* @param parentElementPath 父元素路径
* @return
*/
public static void addElement(Object document,String parentElementPath,String elementName){
try{
Element parentElement;
parentElement = (Element)XPath.selectSingleNode(document,parentElementPath);
Element newElement = new Element(elementName);
parentElement.addContent(newElement);
} catch (Exception e1) {
e1.printStackTrace();
}
}
/**
* 向指定的文档模型添加已创建元素
* @param document 要添加元素的文档模型
* @param newElement 要添加的新元素
* @param parentElementPath 父元素路径
* @return
*/
public static void addElement(Object document,String parentElementPath,Element newElement){
try{
Element parentElement;
parentElement = (Element)XPath.selectSingleNode(document,parentElementPath);
parentElement.addContent(newElement);
} catch (Exception e1) {
e1.printStackTrace();
}
}
/**
* 获取指定子元素路径的子元素列表
* @param document the JDOM document built from Listing 2
* @param visitedNodeName 指定要访问的子节点元素名称
* @return 返回指定元素路径的子元素列表
*/
public static List getChildrenElement(Object document,String visitedNodeName) {
List visitElements = null;
try {
visitElements = XPath.selectNodes(document,visitedNodeName);
} catch (Exception e) {
e.printStackTrace();
}
return visitElements;
}
/**
* 获取指定子元素路径名称和属性名称及值的元素
* @param document the JDOM document built from Listing 2
* @param visitedNodeName 指定要访问的子节点元素名称
* @param attributeName 属性名称
* @param attributeValue 属性值
* @return 返回指定的元素
*/
public static Element getChildElement(Object document,String visitedNodeName,String attributeName,String attributeValue) {
Element visitElement = null;
try {
visitElement = (Element)XPath.selectSingleNode(document,visitedNodeName+"[@"+attributeName+"='"+attributeValue+"']");
} catch (Exception e) {
e.printStackTrace();
}
return visitElement;
}
/**
* 获取指定子元素路径名称和属性名称及值的元素
* @param document the JDOM document built from Listing 2
* @param visitedNodeName 指定要访问的子节点元素名称
* @return 返回指定的元素
*/
public static Element getChildElement(Object document,String visitedNodeName) {
Element visitElement = null;
try {
visitElement = (Element)XPath.selectSingleNode(document,visitedNodeName);
} catch (Exception e) {
e.printStackTrace();
}
return visitElement;
}
/**
* 删除指定元素节点路径的元素
* @param removeNodeName 要删除的元素路径
* @param document xml文件对应的文档模型
*/
public static boolean removeChildElement(Object document,String removeNodeName) {
Element visitElement = null;
boolean isRemoved = false;
try {
visitElement = (Element)XPath.selectSingleNode(document,removeNodeName);
if(visitElement != null)
isRemoved = visitElement.getParentElement().removeContent(visitElement);
} catch (Exception e) {
e.printStackTrace();
}
return isRemoved;
}
/**
* 删除指定属性的元素
* @param document xml文件对应的文档模型
* @param removeNodeName 要删除的节点元素路径
* @param attributeName 属性名称
* @param attributeValue 属性值
* @return
*/
public static boolean removeChildElement(Object document,String removeNodeName ,String attributeName,String attributeValue) {
List removeElements = null;
Element visitElement = null;
boolean isRemoved = false;
try {
removeElements = XPath.selectNodes(document,removeNodeName+"[@"+attributeName+"='"+attributeValue+"']");
if(removeElements != null){
for (int i = 0; i < removeElements.size(); i++) {
visitElement = (Element) removeElements.get(i);
isRemoved = visitElement.getParentElement().removeContent(visitElement);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return isRemoved;
}
/**
* 将xml文档模型输出到标准输出设备(屏幕)
* @param document 指定的xml文档模型
*/
public static void outputDocument(Document document) {
format.setIndent(" ");
format.setExpandEmptyElements(false);
try {
XMLOutputter outputter = new XMLOutputter(format);
outputter.output(document, System.out);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 将xml文档模型输出到标准输出设备(流)
* @param document 指定的xml文档模型
*/
public static void outputDocument(Document document,OutputStream output) {
format.setIndent(" ");
format.setExpandEmptyElements(false);
try {
XMLOutputter outputter = new XMLOutputter(format);
outputter.output(document, output);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 将xml文档模型输出到指定文件
* @param document 指定的xml文档模型
* @param outputFilePath 输出文件路径
*/
public static void outputDocumentToFile(Document document,String outputFilePath) {
outputDocumentToFile(document,outputFilePath,ENCODE_GB2312);
}
/**
* 将xml文档模型输出到指定文件
* @param document 指定的xml文档模型
* @param outputFilePath 输出文件路径
* @param encodingMode 编码方式
*/
public static void outputDocumentToFile(Document document,String outputFilePath,String encodingMode) {
format.setEncoding(encodingMode);
format.setIndent(" ");
format.setExpandEmptyElements(false);
FileWriter writer = null;
try {
XMLOutputter outputter = new XMLOutputter(format);
writer = new FileWriter(outputFilePath);
outputter.output(document, writer);
writer.close();
}catch(Exception ep) {
ep.printStackTrace();
}
finally{
try {
if(writer != null)
writer.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
/**
* 将将xml文档模型输出到指定字符串
* @param document 指定的xml文档模型
* @return 返回document的内容
*/
public static String outputDocumentString(Document document){
return outputDocumentString(document,ENCODE_GBK);
}
/**
* 将将xml文档模型输出到指定字符串
* @param document 指定的xml文档模型
* @param encodingMode 编码格式
* @return 返回document的内容
*/
public static String outputDocumentString(Document document,String encodingMode){
format.setEncoding(encodingMode);
format.setIndent(" ");
format.setExpandEmptyElements(false);
XMLOutputter outputter = new XMLOutputter(format);
return outputter.outputString(document);
}
/**
* This method takes a JDOM document in memory, an xsl file at xml/car.xsl,
* and outputs the results to stdout.
* This method corresponds to Listing 9.
* @param myDocument the JDOM document built from Listing 2.
*/
// public static void executeXSL(Document myDocument) {
// try {
// TransformerFactory tFactory = TransformerFactory.newInstance();
// // Make the input sources for the XML and XSLT documents
// org.jdom.output.DOMOutputter outputter = new org.jdom.output.DOMOutputter();
// org.w3c.dom.Document domDocument = outputter.output(myDocument);
// javax.xml.transform.Source xmlSource = new javax.xml.transform.dom.DOMSource(domDocument);
// StreamSource xsltSource = new StreamSource(new FileInputStream("car.xsl"));
// //Make the output result for the finished document
// /*
// * Note that here we are just going to output the results to the
// * System.out, since we don't actually have a HTTPResponse object
// * in this example
// */
// //StreamResult xmlResult = new StreamResult(response.getOutputStream());
// StreamResult xmlResult = new StreamResult(System.out);
// //Get a XSLT transformer
// Transformer transformer = tFactory.newTransformer(xsltSource);
// //do the transform
// transformer.transform(xmlSource, xmlResult);
// } catch(FileNotFoundException e) {
// e.printStackTrace();
// } catch(TransformerConfigurationException e) {
// e.printStackTrace();
// } catch(TransformerException e) {
// e.printStackTrace();
// } catch(org.jdom.JDOMException e) {
// e.printStackTrace();
// }
// }
/**
* 修改指定节点元素的属性
* @param document
* @param nodePath
* @param name
* @param value
*/
public static void setElementAttributeValue(Object document,String nodePath,String name,String value){
try {
((Element)XPath.selectSingleNode(document,nodePath)).setAttribute(name,value);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 修改指定节点元素的属性
* @param document
* @param nodePath
* @param attrName
* @param attrValue
* @param name
* @param value
*/
public static void setElementAttributeValue(Object document,String nodePath,String attrName,String attrValue,String name,String value){
nodePath +="[@" + attrName + "='" + attrValue + "']";
setElementAttributeValue(document,nodePath,name,value);
}
/**
* 修改指定节点元素的内容
* @param document
* @param nodePath
* @param text
*/
public static void setElementText(Object document,String nodePath,String text){
try {
((Element)XPath.selectSingleNode(document,nodePath)).setText(text);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 修改指定节点元素的内容
* @param document
* @param nodePath
* @param attrName
* @param attrValue
* @param text
*/
public static void setElementText(Object document,String nodePath,String attrName,String attrValue,String text){
nodePath +="[@" + attrName + "='" + attrValue + "']";
setElementText(document,nodePath,text);
}
/**
* 设置xml的编码格式
* @param encode
*/
public static void setEncoding(String encode){
format.setEncoding(encode);
}
/**
* 用DTD文档类型定义校验xml文档
* @param content
* @return
*/
// public static boolean validate(){
// SAXBuilder builder = new SAXBuilder(true);
// try{
// // Jdom complains about the document even though it is valid
// ByteArrayInputStream bais=new ByteArrayInputStream(content.getBytes());
// builder.build(bais);
// return true;
//
// } catch (Exception e) {
//
// return false;
//
// }
//
// }
public static void main(String[] args) throws Exception
{
Document doc = XMLUtil.readDocument("test.xml");
List shapes = XMLUtil.getChildrenElement(doc, "javer/leo/example");
for(int i=0;i {
System.out.println(XMLUtil.getChildElement(shapes.get(i), "id").getText());
}
}
}
发表评论
-
跟我学XSL(七)
2006-09-24 18:28 1311本课学习在XSL中使用脚本。 <xsl:eval> ... -
跟我学XSL(六)
2006-09-24 18:17 1331这课学习XSL的函数 一、end() 含义:返回集合中最后一 ... -
跟我学XSL(五)
2006-09-24 18:09 1304本课学习各种运算符,满足编写更大灵活性的XSL样式的要求。 表 ... -
跟我学XSL(四)
2006-09-24 17:49 1205<xsl:choose> 语法:<xsl:c ... -
跟我学XSL(三)
2006-09-24 17:33 1265<xsl:if> 语法: <xsl:if ... -
跟我学XSL(二)
2006-09-24 17:29 1377书写模板(块):<xsl:template> &l ... -
跟我学XSL(一)
2006-09-24 16:21 1365个人简历表示,方式有如下两种: 1、HTML表示 resume ... -
XML验证
2006-09-24 15:48 6030XML文档必须严格遵守语法规范,即都必须是“格式良好的”。同时 ... -
DOM
2006-09-24 15:47 1374Document Object Model(文档对象模型)简称 ... -
绑定XML
2006-09-24 15:45 1576Web服务器与客户机之间的数据传递方式有三种: HTML页面、 ... -
XML显示
2006-09-24 15:38 1302XML文档本身只描述数据内容,它的显示功能由样式单来完 ... -
XML的名称空间
2006-09-24 15:31 1276XML文档中很可能会定义许多名字相同而意义不同的元素或属性,尤 ... -
XML的开发工具
2006-09-24 15:28 1417开发XML有许多工具可以使用: ● Notepad:最直接 ... -
xsl样式单
2006-09-24 10:23 1699XML文档的一大特点是 ... -
xml模式(Schema)
2006-09-23 22:08 24031. 最简单的Schema文档 hello.xml < ... -
DTD基础
2006-09-23 11:42 1096元素声明: <!ELEMENT elementname ... -
xhtml基础
2006-09-23 09:48 1044XHML标准是用HTML实现的XML,与HTML的区别是其规则 ... -
xml基础
2006-09-23 09:40 1209xml文档必须遵守两个标 ... -
xml文件解析
2006-09-23 09:19 2461xml有四种解析器 1、DOM ...
相关推荐
Dom JDom 解析xml 文件 Dom JDom 解析xml 文件 Dom JDom 解析xml 文件 自己使用 最好不要下载
DOM、JDOM、DOM4J解析XML实例
对XML的操作,JDOM对XML的解析、创建、修改。DOM4J对XML的解析、创建、修改的实现代码。
dom4j解析xml文件的压缩包,完整版。对jdom进行了封装。包含源码,jar包以及所需的全部内容。
DOM、JDOM、DOM4J解析XML实例.pdf
用四种方法实现了对xml文件的解析,对学习xml有很大帮助
dom4j和jdom解析XML小例子
用DOM SAX JDom dom4j 对xml文档解析实例 在学习孙鑫老师视频教程,自己照着敲的源码,希望对大家有帮助
读取XML文件的四种方法,详细介绍了dom,jdom,dom4j,sax
xml数据前后台解析;提供了两种方式:dom4j与jdom对xml文件、xml字符串的读与写操作;同时实现在前台用jquery解析xml,将数据展示在页面上,程序可以跑
xml文件的解析的各种方式,例如jdom解析,dom解析等等
用用4中方式(dom4j、jdom、dom、sax)解析xml
XML解析四种解析方式 DOM SAX JDOM DOM4J
使用Jdom.jar包解析XML文件,JDOM是一个开源项目,它基于树型结构,利用纯JAVA的技术对XML文档实现解析、生成、序列化以及多种操作。JDOM直接为JAVA编程服务。它利用更为强有力的JAVA语言的诸多特性(方法重载、集合...
里面包含了比较常用的xml文件解析技术,主要是dom解析,jdom解析,sax解析
4种最主流、最全面、最详细的生成和解析xml的4种方式,包括Dom,Dom4j,Sax,JDom,读懂了绝对好用xml,非常好的入门项目,而且精心排版,逻辑清晰
sax,dom,jdom,dom4j Java中常用的四种解析方式的详细演示实例,提供源代码,绝对可以运行,千万不要错过哦
dom4j和jdom解析xml的例子dom4j jdom xml 解析
现在流行的几种解析xml的方法,都做了相应的创建和解析XML的demo,虽然有点简单,但是和新手入门