ADO.NET DataSetÖеÄXMLÖ§³Ö
±êÇ©£ºÊý¾Ý·ÃÎÊ ADO.NET
ADO.NET DataSetÖеÄXMLÖ§³Ö ADO.NETÖÐXMLÖ§³ÖÖ÷Òª¼¯ÖÐÓÚDataSet¶ÔÏó£¬ÒòΪXMLÖ÷Òª¹Ø×¢µÄÊǹØϵ ºÍ ·Ö²ãµÄ½á¹¹»¯Êý¾Ý¡£
´ÓDataSetÖÐдÈëXML: 1£©¹¹ÔìÒ»¸öDataSet; 2£©DataAdapter¶ÔÏóµÄFill()·½·¨¼ÓÔØÊý¾Ý£»
3£©DataSetÉϵ÷ÓÃWriteXml()£¬±ÈÈ磺thisDataSet.WriteXml("AresData.Xml");
Àý£º ....... custOrderRel.Nested = true; //DataRelation¶ÔÏóµÄNestedÊôÐÔ֪ͨ½«Ïà¹Ø±í£¬Ç¶Ì×ÔÚXMLÊä³öÖÐÿ¸ö¸¸¿Í»§Ö®Ï¡£ thisDataSet.WriteXml(@"c:\....\AresData.xml"); //µ÷ÓÃWriteXml()£¬½«DataSetÊý¾Ý°´XML¸ñʽдÈëÎļþÖС£
´ÓXML¶ÁÈ¡µ½DataSetÖУº
.......
DataSet thisDataSet = new DataSet();
thisDataSet.ReadXml(@"c:\....\AresData.xml"); //ReadXml()·½·¨¶ÁÈ¡XMLÎĵµµ½thisDataSet¶ÔÏóÖС£
foreach(DataRow custRow in thisDataSet.Tables["Customers"].Rows) //Ëù´´½¨µÄDataTable²ÉÓÃXMLÎĵµÖеĸùÔªËØÃüÃû¡£ {
Ïà¹ØÎĵµ£º
ºÍAndroid UI layoutÒ»Ñù£¬ÎÒÃÇÒ²¿ÉÒÔÔÚXMLÖж¨ÒåÓ¦ÓóÌÐòµÄ²Ëµ¥¡£Í¨¹ýÔڲ˵¥µÄonCreateOptionsMenu·½·¨ÖÐÅòÕͲ˵¥layout¡£ÕâÑù×ö»áʹÎÒÃǵijÌÐò´úÂë¼òµ¥¶àÁË£¬¶øÇÒ¾¡¿ÉÄܵĽ«¸ü¶àµÄ½çÃæÉè¼Æ²¿·Ö·Åµ½XML£¬±ãÓÚä¯ÀÀ¡£
1. ÔÚ¹¤³ÌµÄ/res/Îļþ¼ÐÏ´´½¨menuÎļþ¼Ð£¬ÓÃÀ´±£´æÄãΪӦÓóÌÐò¶¨ÒåµÄ²Ëµ¥XMLÎļþ¡£
Ôڲ˵¥XML ......
var
xmlDoc
=
null
;
function
parseXML
(
xmlUrl
)
{
¡¡¡¡try
{
¡¡¡¡¡¡¡¡//IE
¡¡¡¡¡¡¡¡xmlDoc
=
new
ActiveXObject
(
"Microsoft.XMLDOM"
);
¡¡¡¡¡¡¡¡xmlDoc
.
async
=
false
;
¡¡¡¡¡¡¡¡xmlDoc
......
AJAX (Òì²½ JavaScript ºÍ XML) ÊǸöвúÉúµÄÊõÓï,רΪÃèÊöJavaScriptµÄÁ½ÏîÇ¿´óÐÔÄÜ.ÕâÁ½ÏîÐÔ
ÄÜÔÚ¶àÄêÀ´Ò»Ö±±»ÍøÂ翪·¢ÕßËùºöÂÔ,Ö±µ½×î½üGmail, Google suggestºÍgoogle MapsµÄºá¿Õ³öÊÀ²ÅʹÈË
ÃÇ¿ªÊ¼Òâʶµ½ÆäÖØÒªÐÔ.
ÕâÁ½Ïî±»ºöÊÓµÄÐÔÄÜÊÇ:
* ÎÞÐèÖØÐÂ×°ÔØÕû¸öÒ³Ãæ±ãÄÜÏò·þÎñÆ÷·¢ËÍÇëÇó.
* ¶ÔXMLÎĵµµÄ½âÎöºÍ´¦Àí£®
......
import java.io.File;
import java.io.FileNotFoundException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ResolveXmlFile {
public void resolverXml() throws DocumentException, FileNotFoundExcept ......
×î³£¼ûµÄXMLÊý¾ÝÀàÐÍÓУºElement, Attribute£¬Comment, Text.
Element, Ö¸ÐÎÈç<Name>Tom<Name>µÄ½Úµã¡£Ëü¿ÉÒÔ°üÀ¨£ºElement, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.
Attribute, Ö¸ÔÚ<Employee >ÖеĴ ......