Guzzle Services - create XML element with attribute and value

I am using Guzzle Services to create a data driven XML query. I am having trouble creating a tag with an attribute and a single value. For example:

<foo bar="some value">some other value</foo>

      

I can create a tag with multiple attributes and not have a value like this:

<foo bar="some value" baz="some other value" />

      

using the following service description:

'parameters' => [
    'foo' => [
        'location' => 'xml',
        'type' => 'object',
        'properties' => [
            'bar' => [
                'location' => 'xml',
                'type' => 'string',
                'data' => ['xmlAttribute' => true]
            ],
            'baz' => [
                'location' => 'xml',
                'type' => 'string',
                'data' => ['xmlAttribute' => true]
            ]
        ]
    ]
]

      

Or I can create a tag with a single attribute and value nested within another tag, like this:

<foo bar="some value">
    <baz>some other value</baz>
</foo>

      

using the following service description:

'parameters' => [
    'foo' => [
        'location' => 'xml',
        'type' => 'object',
        'properties' => [
            'bar' => [
                'location' => 'xml',
                'type' => 'string',
                'data' => ['xmlAttribute' => true]
            ],
            'baz' => [
                'location' => 'xml',
                'type' => "string',
            ]
        ]
    ]
]

      

But it doesn't seem like there is a way to create a tag like this:

<foo bar="some value">some other value</foo>

      

Is it possible?

+3
php guzzle


source to share


No one has answered this question yet

Check out similar questions:

1065
Link. What does this error mean in PHP?
thirty
SimpleXML: select elements that have a specific attribute value
4
How do I use DTO to use REST API in PHP?
3
Yii SOAP Web Service returns XML
1
getting XML data as is (with tags, attributes and values) using php
1
PHP SOAP client values ​​and attributes not loading
0
Simplexml_load_string access tag value
0
How to get xml node value by attribute value using simplexml?
0
PHP - Don't get expected results using comparison operator ==
-1
Get attribute value using SimpleXML for PHP



All Articles
Loading...
X
Show
Funny
Dev
Pics