2013-07-04 37 views
1

我有一個XML文件是這樣的:如何在原子xml文件中查找元素jquery?

<?xml version="1.0" encoding="utf-8" standalone="yes"?> 
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> 
<title /> 
<updated>2008-09-18T23:46:19.3857256Z</updated> 
<author> 
    <name>Dino</name> 
</author> 
<id /> 
<content type="application/xml"> 
    <m:properties> 
    <d:Message>Mountain View</d:Message> 
    <d:Age m:type="Edm.Int32">23</d:Age> 
    <d:AmountDue m:type="Edm.Double">200.23</d:AmountDue> 
    <d:BinaryData m:type="Edm.Binary" m:null="true" /> 
    <d:CustomerCode m:type="Edm.Guid">c9da6455-213d-42c9-9a79-3e9149a57833</d:CustomerCode> 
    <d:CustomerSince m:type="Edm.DateTime">2008-07-10T00:00:00</d:CustomerSince> 
    <d:IsActive m:type="Edm.Boolean">true</d:IsActive> 
    <d:NumOfOrders m:type="Edm.Int64">255</d:NumOfOrders> 
    <d:PartitionKey>mypartitionkey</d:PartitionKey> 
    <d:RowKey>myrowkey1</d:RowKey> 
    <d:Timestamp m:type="Edm.DateTime">0001-01-01T00:00:00</d:Timestamp> 
    </m:properties> 
</content> 

我想d:Messageelement「在jQuery的小號value,我該怎麼辦呢? 這裏是我的代碼:

$(document).ready(function() { 
     $.ajax({ 
      type: "GET", 
      url: "Insert_Log.xml", 
      dataType: "xml", 
      success: parseXml 
     }); 
    }); 
    function parseXml(xml) { 

     $(xml).find("d:Message").each(function() { 

      $("#output").append($(this).text()); 
     }); 
    } 
</script> 

但它不工作! 我可以使用JavaScript getElementsByTag("d:Message")獲得的價值,但我不知道如何使用jQuery的

回答