XML×Ö·û´®ºÍXML DOCUMENTµÄÏ໥ת»»
±¾ÎÄÉæ¼°µ½XML×Ö·û´®ºÍXml DocumentµÄת»»ÎÊÌ⣬¾Í¸÷ÖÖXML½âÎöÆ÷·Ö±ðÁоÙÈçÏ£¬ÒÔ·½±ã½ñºó²éÔÄ¡£
¡¡¡¡Ò»¡¢Ê¹ÓÃ×îÔʼµÄjavax.xml.parsers£¬±ê×¼µÄjdk api
¡¡¡¡// ×Ö·û´®×ªXML
¡¡¡¡String xmlStr = \"......\";
¡¡¡¡StringReader sr = new StringReader(xmlStr);
¡¡¡¡InputSource is = new InputSource(sr);
¡¡¡¡DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
¡¡¡¡DocumentBuilder builder=factory.newDocumentBuilder();
¡¡¡¡Document doc = builder.parse(is);
¡¡¡¡//XMLת×Ö·û´®
¡¡¡¡TransformerFactory tf = TransformerFactory.newInstance();
¡¡¡¡Transformer t = tf.newTransformer();
¡¡¡¡t.setOutputProperty(\"encoding\",\"GB23121\");//½â¾öÖÐÎÄÎÊÌ⣬ÊÔ¹ýÓÃGBK²»ÐÐ
¡¡¡¡ByteArrayOutputStream bos = new ByteArrayOutputStream();
¡¡¡¡t.transform(new DOMSource(doc), new StreamResult(bos));
¡¡¡¡String xmlStr = bos.toString();
¡¡¡¡ÕâÀïµÄXML DOCUMENTΪorg.w3c.dom.Document
¡¡¡¡¶þ¡¢Ê¹ÓÃdom4jºó³ÌÐò±äµÃ¸ü¼òµ¥
¡¡¡¡// ×Ö·û´®×ªXML
¡¡¡¡String xmlStr = \"......\";
¡¡¡¡Document document = DocumentHelper.parseText(xmlStr);
¡¡¡¡// XMLת×Ö·û´®
¡¡¡¡Document document = ...;
¡¡¡¡String text = document.asXML();
¡¡¡¡ÕâÀïµÄXML DOCUMENTΪorg.dom4j.Document
¡¡¡¡Èý¡¢Ê¹ÓÃJDOM
¡¡¡¡JDOMµÄ´¦Àí·½Ê½ºÍµÚÒ»ÖÖ·½·¨´¦Àí·Ç³£ÀàËÆ
¡¡¡¡//×Ö·û´®×ªXML
¡¡¡¡String xmlStr = \".....\";
¡¡¡¡StringReader sr = new StringReader(xmlStr);
¡¡¡¡InputSource is = new InputSource(sr);
¡¡¡¡Document doc = (new SAXBuilder()).build(is);
¡¡¡¡//XMLת×Ö·û´®
¡¡¡¡Format format = Format.getPrettyFormat();
¡¡¡¡format.setEncoding(\"gb2312\");//ÉèÖÃxmlÎļþµÄ×Ö·ûΪgb2312£¬½â¾öÖÐÎÄÎÊÌâ
¡¡¡¡XMLOutputter xmlout = new XMLOutputter(format);
¡¡¡¡ByteArrayOutputStream bo = new ByteArrayOutputStream();
¡¡¡¡xmlout.output(doc,bo);
¡¡¡¡String xmlStr = bo.toString();
¡¡¡¡ÕâÀïµÄXML DOCUMENTΪorg.jdom.Document
¡¡¡¡ËÄ¡¢JAVASCRIPTÖеĴ¦Àí
¡¡¡¡//×Ö·û´®×ªXML
¡¡¡¡var xmlStr = \".....\";
¡¡¡¡var xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");
¡¡¡¡xmlDoc.async=false;
¡¡¡¡xmlDoc.loadXML(xmlStr);
¡¡¡¡//¿ÉÒÔ´¦ÀíÕâ¸öxmlDocÁË
¡¡¡
Ïà¹ØÎĵµ£º
ÈκÎORMµÄ½â¾ö·½°¸¶¼Ó¦¸ÃÌṩһÖÖÒ׶ÁµÄ¡¢ÈÝÒױ༵ÄÓ³ÉäÎļþ¸ñʽ£¬¶ø²»½ö½öÌṩһ¸öGUIͼÐι¤¾ß¡£µ±ÏÂÁ÷ÐеĶÔÏó/¹ØϵԪÊý¾Ý¸ñʽ¶¼Ö§³ÖXML¡£Ê¹ÓÃXML¸ñʽµÄÎļþ¿ÉÒÔÌṩÈçϺô¦£ºÊ×ÏÈËüÊÇÇáÁ¿¼¶µÄ£¬ÌṩºÜºÃµÄÒ׶ÁÐÔ£¬Äܹ»½øÐа汾¿ØÖÆ£¬¿ÉÒÔÔÚ²¿Êð½×¶Î¶¨ÖÆ¡£
µ«ÊÇXML¸ñʽÎļþÕæµÄÊÇ×îºÃµÄÑ¡ÔñÂð£¿JavaÉçÍÅÖоͷ´¶ÔXML ......
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(NetShop.Config.DbConfigs.GetSitePath + "images/flashdata/flash.config"));
DataRow[] drs = ds.Tables[0].Select("", "[SortOrder] ASC");
//·µ»ØµÄÊǸöDataRow[]£º
//DataR ......
2009-10-27 22:44×ÊÁÏÀ´Ô´ÓÚÍøÂç,ËÄÖÖ·½Ê½,´ó¼Ò¿ÉÒÔ×Ô¼º³¢ÊÔÏÂ.
=========11111=================
tinyXML
www.grinninglizard.com/tinyxml/
=========22222================================
symbian s60 µÚÈý°æÖ®ºó£¬ÒѾÌṩÁ˽âÎöxmlµÄϵͳapi,²ÉÓõÄÊÇSAX·½Ê½¡£
XML parsing in Symbian OS v9.x À´Ô´Ä¿Â¼£º
htt ......
Paul.Todd | 09 April, 2007 15:24
I have noticed a couple of people seem to be having problems with using the XML parser in Symbian and there are no examples outside of the devkit. The parser I will be talking about is the xml one, not the one SOAP engine as the SOAP one is Nokia specific.
The ke ......
Ç°Ì᣺1.JdomµÄ¼Ü¹¹ÒѾµ¼Èë
²½Ö裺
ÓÃJDOM¶ÁÈ¡XMLÎļþÐèÏÈÓÃorg.jdom.input.SAXBuilder¶ÔÏóµÄbuild()·½·¨´´½¨Document¶ÔÏó,
È»ºóÓÃDocumentÀà¡¢ElementÀàµÈµÄ·½·¨¶ÁÈ¡ËùÐèµÄÄÚÈÝ¡£
<?xml version="1.0" encoding="UTF-8"?>
<HD>
<disk name="C">
<capacity>8 ......