肥皂客户端解析PHP
我正在尝试解析来自 Web 服务的响应 - 响应似乎是有效的 XML,但是,我只能解析属性,并且不知何故对象没有文本值的表示 - 这是一个示例:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<Product xmlns="http://com.etilize.spexlive" productId="1010043679">
<category parId="135" name="Transparent & Invisible Tapes" id="1009"/>
<descriptions>
<description type="1">Sparco Invisible Tape - 0.75" Width x 1000" Length - 1" Core - Premium Acetate - Writable Surface - 12 / Pack - Clear
</description>
<description type="2">Sparco Invisible Tape</description>
<description type="3">0.75" Width x 1000" Length - 1" Core - Premium Acetate - Writable Surface - 12 / Pack - Clear</description>
</descriptions>
</Product>
</soap:Body>
</soap:Envelope>
我可以获取categoryId ,名称和 parId 很好,但文本值似乎不存在 - 下面是我在肥皂对象上执行 var_dump 时看到的内容 - 请注意描述:
stdClass Object
(
[category] => stdClass Object
(
[id] => 1009
[name] => Transparent & Invisible Tapes
[parId] => 135
)
[descriptions] => stdClass Object
(
[description] => Array
(
[0] => stdClass Object
(
[type] => 1
)
[1] => stdClass Object
(
[type] => 2
)
[2] => stdClass Object
(
[type] => 3
)
)
)
在这方面的任何帮助将不胜感激
谢谢
I am trying to parse a response from a webservice - the response seems to be valid XML, however, I can only parse attributes and somehow the objects do not have a representation for the text values - here is an example:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<Product xmlns="http://com.etilize.spexlive" productId="1010043679">
<category parId="135" name="Transparent & Invisible Tapes" id="1009"/>
<descriptions>
<description type="1">Sparco Invisible Tape - 0.75" Width x 1000" Length - 1" Core - Premium Acetate - Writable Surface - 12 / Pack - Clear
</description>
<description type="2">Sparco Invisible Tape</description>
<description type="3">0.75" Width x 1000" Length - 1" Core - Premium Acetate - Writable Surface - 12 / Pack - Clear</description>
</descriptions>
</Product>
</soap:Body>
</soap:Envelope>
I can get the categoryId, Name and parId just fine but the Text values don't even seem to exist - Below is what I see when I do a var_dump on the soap Object - notice the descriptions:
stdClass Object
(
[category] => stdClass Object
(
[id] => 1009
[name] => Transparent & Invisible Tapes
[parId] => 135
)
[descriptions] => stdClass Object
(
[description] => Array
(
[0] => stdClass Object
(
[type] => 1
)
[1] => stdClass Object
(
[type] => 2
)
[2] => stdClass Object
(
[type] => 3
)
)
)
Any help in this regard will be appreciated
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论