【发布时间】:2014-11-25 07:48:03
【问题描述】:
我需要创建一个 web-hook,用于将 xml 数据发布到存储库。
xml格式应该是这样的:
<Order OrderID="xxxx" AffiliateID="xxxxxx">
<ShipToName>Bob Sanders</ShipToName>
<ShipToContact>Bob Sanders</ShipToContact>
<ShipToName2></ShipToName2>
<AddressLine1>21 N. Long St.</AddressLine1>
<AddressLine2>Unit A</AddressLine2>
<AddressLine3></AddressLine3>
<City>Barrington Hills</City>
<Country>US</Country>
<State>Il</State>
<Province></Province>
<Zip>60010</Zip>
<Email>madman@gmail.com</Email>
<Phone>7086639935</Phone>
<SpecialInstructions></SpecialInstructions>
<SpecialInstructions2></SpecialInstructions2>
目前是这样的:
<order>
<buyer-accepts-marketing type="boolean">true</buyer-accepts-marketing>
<cancel-reason nil="true"/>
<cancelled-at type="dateTime" nil="true"/>
<cart-token>6343c2a1ec2e675202ad9fdccb8fe862</cart-token>
<checkout-token>c62fcb629ce1df6a7202be1e4f34f237</checkout-token>
<closed-at type="dateTime" nil="true"/>
<confirmed type="boolean">true</confirmed>
<created-at type="dateTime">2014-11-24T23:22:22-07:00</created-at>
<currency>USD</currency>
<email>kads@hfi.com</email>
<financial-status>pending</financial-status>
<fulfillment-status nil="true"/>
<gateway>Cash on Delivery (COD)</gateway>
<id type="integer">282488743</id>
<landing-site>/</landing-site>
<location-id type="integer" nil="true"/>
<name>#SH1001</name>
<note nil="true"/>
<number type="integer">1</number>
我需要更改节点名称并只抓取几个必需的节点而不是全部。 我不明白从哪里开始。
为了更好地理解这里的情况是网址:
- https://shibumi-home.myshopify.com/admin/orders.xml[需要修改的XML]
- http://divinepnc.com/a/webhooks-shopify/a.xml【应该怎样】
我不是要求提供该情况的确切代码,我只想问我应该如何进行。
非常感谢
【问题讨论】:
-
只需解析从 Shopify 发送的 XML,然后从这些部分中放入您需要的 XML 文件。