php使用GetElementsByTagnames从soap读取xml内容
这是我的XML,我有:php使用GetElementsByTagnames从soap读取xml内容,php,xml,soap,domdocument,Php,Xml,Soap,Domdocument,这是我的XML,我有: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapen
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<OrganizationId>00Dp00000008kXDEAY</OrganizationId>
<ActionId>04k28000000L3shAAC</ActionId>
<SessionId xsi:nil="true"/>
<EnterpriseUrl>https://232.salesforce.com/services/Soap/c/36.0/00Dp00000008kXD</EnterpriseUrl>
<PartnerUrl>https://232.salesforce.com/services/Soap/u/36.0/00Dp00000008kXD</PartnerUrl>
<Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC</sf:Brand__c>
<sf:Content__c>halo test</sf:Content__c>
<sf:Mobile__c>628145783535</sf:Mobile__c>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
试试这个,希望它能帮你
试试这个,希望它能帮到你
萨希尔先生,很抱歉再次打扰您,如果我有多个如下数据,如何通过循环访问
<Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC</sf:Brand__c>
<sf:Content__c>halo test 1</sf:Content__c>
<sf:Mobile__c>6281457835351</sf:Mobile__c>
</sObject>
</Notification> <Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC2</sf:Brand__c>
<sf:Content__c>halo test 2</sf:Content__c>
<sf:Mobile__c>6281457835352</sf:Mobile__c>
</sObject>
</Notification> <Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC3</sf:Brand__c>
<sf:Content__c>halo test 3</sf:Content__c>
<sf:Mobile__c>6281457835353</sf:Mobile__c>
</sObject>
</Notification>
034l3004D4247lVAAS
a0Ip0000001WxvaEAC
基础知识
光晕试验1
6281457835351
034l3004D4247lVAAS
a0Ip0000001WxvaEAC
ABC2
光晕试验2
6281457835352
034l3004D4247lVAAS
a0Ip0000001WxvaEAC
ABC3
光晕试验3
6281457835353
萨希尔先生,很抱歉再次打扰您,如果我有下面这样多个数据,如何通过循环访问它
<Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC</sf:Brand__c>
<sf:Content__c>halo test 1</sf:Content__c>
<sf:Mobile__c>6281457835351</sf:Mobile__c>
</sObject>
</Notification> <Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC2</sf:Brand__c>
<sf:Content__c>halo test 2</sf:Content__c>
<sf:Mobile__c>6281457835352</sf:Mobile__c>
</sObject>
</Notification> <Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC3</sf:Brand__c>
<sf:Content__c>halo test 3</sf:Content__c>
<sf:Mobile__c>6281457835353</sf:Mobile__c>
</sObject>
</Notification>
034l3004D4247lVAAS
a0Ip0000001WxvaEAC
基础知识
光晕试验1
6281457835351
034l3004D4247lVAAS
a0Ip0000001WxvaEAC
ABC2
光晕试验2
6281457835352
034l3004D4247lVAAS
a0Ip0000001WxvaEAC
ABC3
光晕试验3
6281457835353
谢谢。。但是如何直接访问Mobile\uu C,我混淆了使用$expectedOutput[$child->tagName],我尝试用$expectedOutput[sf:Mobile\uu C]替换,但出现了错误。很抱歉,我不熟悉php xml。多谢各位lot@Def谢谢朋友……:)删除上面的评论听起来不太好。。。再次感谢sahil先生,很抱歉再次打扰,如果我有多个如下数据,如何通过循环访问它?@Def您可以共享该示例XML吗?04lp0000004D7nEAAS1232ABC管理员测试124 125A0IP0000001WxyleASBF管理员测试123谢谢。。但是如何直接访问Mobile\uu C,我混淆了使用$expectedOutput[$child->tagName],我尝试用$expectedOutput[sf:Mobile\uu C]替换,但出现了错误。很抱歉,我不熟悉php xml。多谢各位lot@Def谢谢朋友……:)删除上面的评论听起来不太好。。。再次感谢sahil先生,很抱歉再次打扰,如果我有多个如下数据,如何通过循环访问它?@Def您可以共享该示例XML吗?04lp0000004D7nEAAS1232ABC管理员测试124 125A0IP0000001WxyleASBF管理员测试123
<Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC</sf:Brand__c>
<sf:Content__c>halo test 1</sf:Content__c>
<sf:Mobile__c>6281457835351</sf:Mobile__c>
</sObject>
</Notification> <Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC2</sf:Brand__c>
<sf:Content__c>halo test 2</sf:Content__c>
<sf:Mobile__c>6281457835352</sf:Mobile__c>
</sObject>
</Notification> <Notification>
<Id>034l3004D4247lVAAS</Id>
<sObject xsi:type="sf:SMS_Activity__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>a0Ip0000001WxvaEAC</sf:Id>
<sf:Brand__c>ABC3</sf:Brand__c>
<sf:Content__c>halo test 3</sf:Content__c>
<sf:Mobile__c>6281457835353</sf:Mobile__c>
</sObject>
</Notification>