肥皂客户端解析PHP

发布于 2024-12-18 14:37:03 字数 1940 浏览 0 评论 0原文

我正在尝试解析来自 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 &amp; Invisible Tapes" id="1009"/>
    <descriptions>
    <description type="1">Sparco Invisible Tape - 0.75&quot; Width x 1000&quot; Length - 1&quot; Core - Premium Acetate - Writable Surface - 12 / Pack - Clear
    </description>
    <description type="2">Sparco Invisible Tape</description>
    <description type="3">0.75&quot; Width x 1000&quot; Length - 1&quot; 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文