我希望 XML 看起来像下面这样,没有标题:
<LicenseCodeRequest xmlns="http://www.gilmore.ca/services/eVantageBookLicense" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ClientID>XXX</ClientID>
<PartNumber>1000-VS1</PartNumber>
<Qty>2</Qty>
<CustomerOrderNumber>56789</CustomerOrderNumber>
<BillingReferenceID>1234</BillingReferenceID>
<SoldToCode>XX-XXX</SoldToCode>
<Students>
<Student>
<StudentID>1</StudentID>
<StudentFirstName>Some</StudentFirstName>
<StudentLastName>One</StudentLastName>
<StudentEmail>someone@exampe.com</StudentEmail>
</Student>
<Student>
<StudentID>2</StudentID>
<StudentFirstName>Another</StudentFirstName>
<StudentLastName>One</StudentLastName>
<StudentEmail>anotherone@exampe.com</StudentEmail>
</Student>
</Students>
<SendStudentEmail>false</SendStudentEmail>
<ContactFirstName>me</ContactFirstName>
<ContactLastName>myself</ContactLastName>
<ContactEmail>me.myself@example.com</ContactEmail>
<SendContactEmail>true</SendContactEmail>
<ShipAddress1>123</ShipAddress1>
<ShipAddress2></ShipAddress2>
<ShipCity>someplace</ShipCity>
<ShipState>NM</ShipState>
<ShipCountry>US</ShipCountry>
<ShipZipcode>54481</ShipZipcode>
<Language>en</Language>
<AssignmentApplication>false</AssignmentApplication>
</LicenseCodeRequest>
然而,当我预览我的 Transform 消息的输出时,我看到以下内容:
<?xml version='1.0' encoding='UTF-8'?>
这将导致提交到供应商的 API 失败。
问题1:我如何摆脱这个标题?
问题 2:如何将两个命名空间添加到 XML 行。我的数据编织中有以下内容:
%dw 2.0
output application/xml
ns gilmore http://www.gilmore.ca/services/eVantageBookLicense
ns w3i http://www.w3.org/2001/XMLSchema-instance
---
LicenseCodeRequest: {
ClientID: XXX,
PartNumber: "1000-VS1",
Qty: 1,
CustomerOrderNumber: 56789,
BillingReferenceID: 1234,
SoldToCode: "XX-XXXX",
Students: {
Student: {
StudentID: 1,
StudentFirstName: "Some",
StudentLastName: "One",
StudentEmail:payload.email,
}
},
SendStudentEmail: false,
ContactFirstName: "me",
ContactLastName: "myself",
ContactEmail: "me.myself@example.com",
SendContactEmai: true,
ShipAddress1: 123,
ShipAddress2: "",
ShipCity: "someplace",
ShipState: "NM",
ShipCountry: "US",
ShipZipcode: 54481,
Language: "en",
AssignmentApplication: false
}
如果我gilmore#
在前面添加LicenseCodeRequest:
它会将输出更改为:
gilmore:LicenseCodeRequest xmlns="http://www.gilmore.ca/services/eVantageBookLicense"
但:
- 我不希望它成为
gilmore:LicenseCodeRequest...
我只需要它LicenseCodeRequest...
成为 - 我需要将第二个命名空间放入同一个标签中。
我怎么做?
非常感谢您提前。