XML transform¶
This transform will render entities on the form described in the XML endpoint sink to a string and embed it in the entity, which is then passed on to the transform chain.
Prototype¶
The properties are identical to the XML endpoint sink, except for the additional xml-property
:
{
"type": "xml",
"root-attributes": {
"xmlns": "http://www.example.org/ns1",
"xmlsn:foo": "http://www.example.org/ns2",
"xmlns:bar": "http://www.example.org/ns3"
},
"xml-property": "xml-property-to-use",
"include-xml-decl": false,
"skip-deleted-entities": true
}
Properties¶
Property |
Type |
Description |
Default |
Req |
---|---|---|---|---|
|
Object |
An object containing the attributes to include on the root element. This is where you typically declare your namespaces, schema and so on. |
||
|
Boolean |
If set to |
false |
|
|
String |
The property that will hold any XML generated |
Yes |
|
|
Boolean |
This can be set to |
true |
Example configuration¶
This is how a XML transform would look like in the context of a pipe (source and sink configs omitted for brevity):
{
"_id": "my-pipe",
"transform": {
"type": "xml",
"root-attributes": {
"xmlns": "http://www.example.org/ns1",
"xmlns:foo": "http://www.example.org/ns2"
},
"xml-property": "xml"
}
}
Given the input entity:
{
"_id": "1",
"name": "Entity 1",
"id": "entity-1",
"<foo:tag>": [{
"id": "child",
"name": "Child entity",
"<section>": [
{"<from>": "0"},
{"<to>": "999"}
]
}]
}
it will produce the transformed entity:
{
"_id": "1",
"name": "Entity 1",
"id": "entity-1",
"<foo:tag>": [{
"id": "child",
"name": "Child entity",
"<section>": [
{"<from>": "0"},
{"<to>": "999"}
]
}],
"xml": "<foo:tag xmlns=\"http://www.example.org/ns1\" xmlns:foo=\" .. </foo:tag>"
}