I have WSDL which can be used to validate complete XML and part of XMLs
MY XML :
<Request>
<Part> .. </part>
<Part> .. </part>
<Part> .. </part>
<Part> .. </part>
<Part> .. </part>
<Part> .. </part>
<Part> .. </part>
</Request>
I have configured validation action which is validating complete and throwing as one or more part is having invalid data.
Requirement is : I have to validate only the part in the above request and remove invalid part before sending to backend.
Any help??
This can be done by using extension element / function in the XSLT.
Skeleton:
<xsl:template match=Request>
<xsl:copy>
<xsl:for-each select="Part">
<xsl:if test="dp:schema-validate($schema,.) !=''">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
schema-validate() : Performs a schema validation.
Namespace declaration : xmlns:dp="http://www.datapower.com/extensions"
Syntax :dp:schema-validate(schema, nodeset)
Parameters : schema : (xs:string) Identifies the XSD schema to perform the validation. nodeset:(xs:node-set) Identifies the node set that contains the XML content to validate. All arguments are passed as XPath expressions.
Results :the validated node set.
Please refer to this link for more info on Extension elements and Functions.