XML Îļþsax½âÎö Ö®´´½¨document¶ÔÏó
Ò».Éú³Édocument¶ÔÏó¡£
import org.jdom.*;
import org.jdom.input.SAXBuilder;
public class ReportDocUtil {
public ReportDocUtil() {
}
/**
* <p>Description:covert xml file to Document</p>
* @param url ¸ñʽxmlÎļþµÄ´æ·ÅµÄÏà¶Ô·¾¶
* @return Document
* <p>Create Time: 2003-11-17</p>
*/
public static Document toDocument(String xmlFilePath)throws Exception {
Document document = null;
SAXBuilder saxBuilder = new SAXBuilder();
document = saxBuilder.build(xmlFilePath);
return document;
}
public static Document getXMLDocument(String xml)throws Exception{
Document document = null;
SAXBuilder saxBuilder = new SAXBuilder();
StringReader stringIn = new StringReader(xml);
document = saxBuilder.build(stringIn);
return document;
}
}
Ïà¹ØÎĵµ£º
XML ÐòÁл¯¿ÉÒÔ²ÉÓôӼòµ¥µ½¸´ÔӵĶàÖÖÐÎʽ¡£ÀýÈ磬¿ÉÒÔÐòÁл¯Ö»°üº¬¹«¹²×ֶκ͹«¹²ÊôÐÔµÄÀ࣬Èç XML ÐòÁл¯¼ò½éÖÐËùʾ¡£ÏÂÃæµÄ´úÂëʾÀýÌÖÂÛ¸÷Öָ߼¶·½°¸£¬°üÀ¨ÈçºÎʹÓà XML ÐòÁл¯Éú³É·ûºÏÌض¨ XML ¼Ü¹¹ (XSD) ÎĵµµÄ XML Á÷¡£
ÐòÁл¯Êý¾Ý¼¯
³ýÁËÐòÁл¯¹«¹²ÀàµÄʵÀýÍ⣬»¹¿ÉÐòÁл¯ DataSet µÄʵÀý£¬ÈçÏÂÃæµÄ´úÂëʾÀýËùʾ ......
ÏÂÃæµÄÄÚÈÝ£¬ÎÒÃǽ«¸ü¶àµÄ¹Ø×¢DOM£¬ÎªDOM×÷Ò»¸ö½ÏΪÏêϸµÄ½âÎö£¬Ê¹ÎÒÃÇʹÓÃÆðÀ´¸üΪµÃÐÄÓ¦ÊÖ¡£
DOMÏê½â
1£®»ù±¾µÄDOM¶ÔÏó
DOMµÄ»ù±¾¶ÔÏóÓÐ5¸ö£ºDocument£¬Node£¬NodeList£¬ElementºÍAttr¡£ÏÂÃæ¾ÍÕâЩ¶ÔÏóµÄ¹¦ÄܺÍʵÏֵķ½·¨×÷Ò»¸ö´óÖµĽéÉÜ¡£
Document¶ÔÏó´ú±íÁËÕû¸öXMLµÄÎĵµ£¬ËùÓÐÆäËüµÄNode£¬¶¼ÒÔÒ»¶¨µÄ˳Ðò°üº ......
ͨ³£Çé¿öÏ£¬Äã¿ÉÒÔ´Ó·þÎñÆ÷ÉÏΪtree¿Ø¼þÈ¡µÃXMLÊý¾Ý £¬ÄãÒ²¿ÉÒÔÔÚ<mx:Tree>TagÀïÖ±½Ó¶¨Òå¸ñʽÁ¼ºÃµÄXMLÊý¾Ý¡£
Äã¿ÉÒÔʹÓÃ<mx:XML>»òÕß<mx:XMLList>TagÔÚmxmlÀﶨÒåXMLÊý¾Ý¡£
Äã¿ÉÒÔ½«XML objectÖ±½Ó×÷Ϊһ¸ö²ã¼¶Êý¾Ý¿Ø¼þµÄdataProvider,however,if the object changes dynamically,ÄãÓ¦¸Ã×öÈçÏ´¦Àí£º ......
5. ÃüÃû¹æÔò£¨²»ÄÜ°üÀ¨ xml£¬¿Õ¸ñ£¬¼âÀ¨ºÅ£¬µÈÌØÊâ·ûºÅ£¬²»ÄÜÊý×Ö¿ªÍ·£©
6. ¿ÉÒÔ×Ô´øÊôÐÔ¡£ÊôÐÔÖµÓÓ”±êʾ
7. ×¢ÊÍ<!--×¢Ê͵ÄÄÚÈÝ-->
8. Èç¹ûÒªÏÔʾÌØÊâ·ûºÅ¿ÉÓÃ<![CDATA[ ÕâÀïдÌØÊâ·ûºÅ ]]>
´´½¨
var xml:XML=<shuiGuo>
& ......
import java.awt.Image;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
public class createXml
{
public static boolean writeXml(String path,String dir,String wpath,String wname)
{
File[] files = ReaderListFiles(path);
boo ......