Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

²éѯXMLÎĵµ

±êÇ©£ºÊý¾Ý·ÃÎÊ     ADO.NET
    ²éѯXMLÎĵµ     LINQ to XMLÀàÌṩÊôÐԺͷ½·¨£¬·µ»Ø¿É²éѯµÄÀàµÄ¶ÔÏ󼯺ϡ£
    ½«XML¶ÔÏó×÷ΪLINQ²éѯ¶ÔÏó£º
     .......
    XDocument customers = XDocument.Load(xmlFileName);
    var queryResult = from c in customers.Elements() select c.Name; 

    ʹÓòéѯ³ÉÔ±
        1£©Element()£º·µ»ØÎĵµ »ò Ƭ¶ÎÖеĵÚÒ»¸öÔªËØ¡£ÎĵµµÄ»°¾Í·µ»Ø¸ùÔªËØ£»         2£©Descendants()£º·µ»ØÎĵµ »ò Ƭ¶ÎÖеÄËùÓÐ×ÓÔªËØ£¨ËùÓм¶±ð£©£»             Àý£ºqueryResults = from c in customers.Descendants() select c.Name;                  foreach (var item in queryResults.Distinct()) //ɸѡ³ö²»Í¬µÄÔªËØ
                 Descendants(string)ÖØÔØ£º                  queryResults = from c in customers.Desendants("customer") select c;  //²éѯָ¶¨Ãû³ÆµÄ×ÓÔªËØ£¬·µ»ØËùÓÐcustomerÔªËØ¡£
        3£©Ancestors()£º·µ»Ø±ÈÔ´ÔªËؼ¶±ð¸ßµÄÒ»×éÔªËØ£»
        4£©Attribute()£º·µ»Øµ±Ç°Ñ¡ÖÐÔªËصÄËùÓÐÊôÐÔ£»
            Àý£ºqueryResults = from c in customers.Descendants("customer").Attributes() select c; //·µ»ØcustomersÖÐËùÓÐcustomerÔªËصÄÊôÐÔÖµ
              


Ïà¹ØÎĵµ£º

javascript¿çä¯ÀÀÆ÷´´½¨XML¶ÔÏó


var
 
xmlDoc
 
=
 
null
;
function
 
parseXML
(
xmlUrl
)
{
¡¡¡¡try
 
{
¡¡¡¡¡¡¡¡//IE
¡¡¡¡¡¡¡¡xmlDoc
 
=
 
new
 
ActiveXObject
(
"Microsoft.XMLDOM"
);
¡¡¡¡¡¡¡¡xmlDoc
.
async
 
=
 
false
;
¡¡¡¡¡¡¡¡xmlDoc ......

java ×Ô¼º×öµÄ¶ÔXMLÎļþµÄ¶Áд²Ù×÷

XMLÎļþʵÀý£º
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource auth="Container" maxActive="20" name="sss" password="123"
type="javax.sql.DataSource" />
<Resource auth="Container" ......

XML ¸ñʽ

ÏÖÔÚÎÒÃÇÔÝÇÒʹÓÓ¼Çʱ¾”À´´´½¨ÎÒÃǵÄXMLÎļþ°É¡£ÏÈ¿´Ò»¸öXMLÎļþ£º 
¡¡¡¡Àý1 
¡¡¡¡¡´?xml version="1.0" encoding="gb2312" ?¡µ 
¡¡¡¡¡´²Î¿¼×ÊÁÏ¡µ 
¡¡¡¡ ¡´Êé¼®¡µ 
¡¡¡¡ ¡´Ãû³Æ¡µXMLÈëÞ«½â¡´/Ãû³Æ¡µ 
¡¡¡¡ ¡´×÷Õß¡µÕÅÈý¡´/×÷Õß¡ ......

XMLÌØÊâ·û號

ÔÚweb.config×ö參數設¶¨時Óöµ½ÌØÊâ×ÖÔª value="http://www.yahoo.com.tw/default.aspx?sid=111111111&uid=test"
&uid這µØ·½會³ö錯...換³É&amp;uid ¾ÍOKÁË~~
幾個
對ÕÕÈçÏÂ:
< Сì¶
&lt;
> ´óì¶
&gt;
&
&amp ......

Óз´ÐÍjava ¶ÔÏóתµ½xml xstream·½Ê½

package com.jcauto.action;
import java.util.ArrayList;
import java.util.List;
public class ContentRsp {

private String resultCode;

List<ContentInfo> contentList = new ArrayList<ContentInfo>();

public void addContent(ContentInfo contentInfo) {
contentList.add(contentI ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ