dom4j ¶ÁдxmlÎļþ
Ê×ÏÈÎÒÃǸø³öÒ»¶ÎʾÀý³ÌÐò£º
import
java.io.File;
import
java.io.FileWriter;
import
java.util.Iterator;
import
org.dom4j.Document;
import
org.dom4j.DocumentHelper;
import
org.dom4j.Element;
import
org.dom4j.io.OutputFormat;
import
org.dom4j.io.SAXReader;
import
org.dom4j.io.XMLWriter;
public
class
DOM4JTest
{
/** */
/**
*/
/** */
/**
*/
/** */
/**
*/
/** */
/**
* DOM4J¶ÁдXMLʾÀý
*
*
@param
args
*
@throws
Exception
*/
public
static
void
main(String[] args)
{
try
{
XMLWriter writer
=
null
;
//
ÉùÃ÷дXMLµÄ¶ÔÏó
SAXReader reader
=
new
SAXReader();
OutputFormat format
=
OutputFormat.createPrettyPrint();
format.setEncoding(
"
GBK
"
);
//
ÉèÖÃXMLÎļþµÄ±àÂë¸ñʽ
String filePath
=
"
d:\\student.xml
"
;
File file
=
new
File(filePath);
if
(file.exi
Ïà¹ØÎĵµ£º
ͨ¹ýJOXÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»
JOXʹµÃÔÚXMLÎĵµÓëJava BeansÖ®¼ä½øÐÐÊý¾Ýת»»±äµÃÈÝÒ×.Äã¿ÉÒÔÀûÓÃJOXÀ´½«¶ÔÏóÐòÁл¯µ½XML.
¿ª·¢ÓïÑÔ£º Java
²Ù×÷ϵͳ£º
Èí¼þÖ÷Ò³£º http://www.wutka.com/jox.html
ÎĵµµØÖ·£º http://www.wutka.com/joxdoc.html
ÏÂÔØµ ......
XML ×÷ΪÊý¾ÝÔ´µÄʵÀý£¨TESTED£©
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" preinitialize="preInit()" fontSize="12" height="500">
<mx:Script>
  ......
µ¼Èëjdom1.1°æ
http://www.jdom.org/dist/binary/
import java.io.FileReader;
import org.jdom.Document;
import org.jdom.input.SAXBuilder;
public class XMLValidate {
public void validate(String xml, String schema) {
try {
SAXBuilder builder = new SAXBuilder(true);
//Ö¸¶¨Ô¼Êø·½ ......
XML How to Program
Beginning Xml Databases
Beginning XSLT and XPath Transforming XML Documents and Data
ASP.NET 2.0 XML
XML ÊÖ²á 4th Edition
XML Schema Complete Reference
......
Introduction to XML and XML With Java
If you are looking for sample programs to parse a XML file using DOM/SAX parser or looking for a program to generate a XML file please proceed directly to programs.
This small tutorial introduces you to the basic concepts of XML and using Xer ......