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
source to share
No one has answered this question yet
Check out similar questions: