Thanks, that did the trick! Regarding your other suggestion, I encountered a “feature” of pub.xml:xmlNodeToDocument and pub.schema:validate that prevent me from using the two in conjunction. Here’s the scenario:
- IS contains a document type definition, myDoc. myDoc was generated from mySchema.
- mySchema defines a complex type, DocField1. DocField1 is defined as a “Document” in myDoc, not a DocumentList.
- Incoming XML contains multiple instances of DocField1.
pub.xml:xmlNodeToDocument is called providing “myDoc” in the documentType parameter. xmlNodeToDocument uses the first value, discarding all additional instances of DocField1.
- To validate the incoming XML request I call pub.xml:documentToXMLString, pub.xml:xmlStringToNode and finally pub.schema:validate. The document validates successfully when in fact multiple instances of DocField1 should fail validation against mySchema.
Your first suggestion might be to use the “arrays” parameter in pub.xml:xmlNodeToDocument to ensure that DocField1 is always generated as a DocumentList. If this happened then pub.schema:validate would work correctly. Unfortunately, this logic belongs to a custom soap processor that must handle any incoming XML document defined in mySchema. Therefore, I will never know until runtime what values belong in arrays. I can derive the document type name (which corresponds to names in the schema), but as you can see above this approach doesn’t work.
- Extract raw XML from incoming SOAP request using Mark’s suggestion below.
- Call pub.xml:xmlStringToNode and pub.schema:validate. The incoming request fails validation against mySchema.