我正在使用Guzzle Services根据给定数据构建XML请求。我在生成具有属性和单值的标记时遇到问题。例如:
<foo bar="some value">some other value</foo>
我可以生成一个包含多个属性且没有这样值的标记:
<foo bar="some value" baz="some other value" />
使用以下服务说明:
'parameters' => [
'foo' => [
'location' => 'xml',
'type' => 'object',
'properties' => [
'bar' => [
'location' => 'xml',
'type' => 'string',
'data' => ['xmlAttribute' => true]
],
'baz' => [
'location' => 'xml',
'type' => 'string',
'data' => ['xmlAttribute' => true]
]
]
]
]
或者我可以生成一个带有单个属性的标签和一个嵌套在另一个标签内的值,如下所示:
<foo bar="some value">
<baz>some other value</baz>
</foo>
使用以下服务说明:
'parameters' => [
'foo' => [
'location' => 'xml',
'type' => 'object',
'properties' => [
'bar' => [
'location' => 'xml',
'type' => 'string',
'data' => ['xmlAttribute' => true]
],
'baz' => [
'location' => 'xml',
'type' => "string',
]
]
]
]
但似乎没有办法生成这样的标签:
<foo bar="some value">some other value</foo>
这可能吗?