Hello, I’ve got several questions in regards of XML in webMethods. Beforehand, I was more concerned on JSON, now it’s XML’s turn.
First, does every XML needs to have ‘root’ attribute in it? This is because in case I used ‘convert JSON to document’ and then ‘convert document to XML’, they’ll never have ‘root’ attribute, and it would be considered improper. Any work arounds? (As in, should I edit the middle document to have root attribute first?)
Second, how do we validate an XML, similar to validating JSON with pub.json.schema.validate? XML doesn’t seem to have anything resembling validation, even for its schema (XSD)…
Third, usually my go-to method to convert from XML to JSON is like this
xmlStringToXMLNode
xmlNodeToDocument
documentToJSONString
The thing is, using this method has no string/numeric recognition, if they find a number, they’ll always treat it as a string and the end result would be something like “age”:“21” instead of “age”:21. How do I get around that? Or is there another route I can take for that?
Thanks! If I have further questions, I’ll add in the replies.
Now which one from this do I pick for conformsTo? I tried all of them and none of them has any results. Am I actually doing the ‘Create XML Document Type’ wrong?
I think that the field age should be defined as integer instead of byte.
Additionally you should set elementFormDefault to unqualified, this avoids the noNamespace to be generated.
Otherwise all the tags in XML need to have the “noNamespace:” prefix.
Can you provide some screenshots from the generated nodes for verification?