You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 5, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/targets/infrajs.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,22 @@ The JS Script field must include a function named `handle` with a single paramet
38
38
-`id` will be set to the incoming value.
39
39
-`datacontenttype` will default to `application/json`.
40
40
41
+
### XML Support
42
+
43
+
InfraJS scripting does not support any XML library and cannot manipulate XML. However under certain circunstances XML can be used to create outgoing events:
44
+
45
+
- Incoming event `data` element must contain a valid XML element
46
+
-`datacontenttype` attribute, which is `Content-Type` HTTP header, must be set to either `application/xml` or `text/xml`
47
+
48
+
In such cases the XML data is converted to JSON element by element. If XML attributes are present the element is rendered using prefixes:
49
+
50
+
- An attribute will be rendered as a chile JSON element prepended with `-`
51
+
- An element that contains attributes and also text, will render the text on a `#text` element.
- will be avaliable as `{"A":{"B":"B value","C":{"#text":"C Value","-attr":"C attr"}}}`
56
+
41
57
## Examples
42
58
43
59
These examples for the InfraJS target show different usages of the `JS Script` function. The incoming parameter for all of the examples will be this CloudEvent:
0 commit comments