问题描述
我正在尝试向复杂的xml元素xsi:type='sf:Total_Report__c'
添加自定义sObject
,下面是示例和相应的xsd
example.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">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<SessionId xsi:nil="true"/>
<Url>https://somerandomurl.com</Url>
<Notification>
<Id>04l0uioAAM</Id>
<sObject xsi:type="sf:Total_Report__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>xyx033fcml98i</sf:Id>
<sf:Name>7654</sf:Name>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
模式
该架构是两个导入,如下所示:
root.xsd -- (imports) --> notifications.xsd -- (imports) --> objects.xsd
root.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:sobject.enterprise.soap.sforce.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/">
<xsd:import schemaLocation="notifications.xsd" namespace="http://soap.sforce.com/2005/09/outbound" />
<xsd:element name="Envelope">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Body">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q1="http://soap.sforce.com/2005/09/outbound" ref="q1:notifications" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xs:schema>
notifications.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://soap.sforce.com/2005/09/outbound" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/2005/09/outbound" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="objects.xsd" namespace="urn:sobject.enterprise.soap.sforce.com" />
<xs:element name="notifications">
<xs:complexType>
<xs:sequence>
<xs:element name="SessionId" nillable="true" />
<xs:element name="Url" type="xs:string" />
<xs:element name="Notification">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="xs:string" />
<xs:element name="sObject">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q1="urn:sobject.enterprise.soap.sforce.com" ref="q1:Id" />
<xs:element xmlns:q3="urn:sobject.enterprise.soap.sforce.com" ref="q2:Name" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
objects.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="urn:sobject.enterprise.soap.sforce.com" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:sobject.enterprise.soap.sforce.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Id" type="xs:string" />
<xs:element name="Name" type="xs:unsignedShort" />
</xs:schema>
在notifications.xsd中,我想要像这样的sObject <sObject xsi:type="sf:Total_Report__c" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
请让我知道,如何实现这一目标。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)