How to define XSD to allow any item

I want to define xsd for a parameter element that will allow me to define a parameter in the following manners

<parameter name="save.type" value="attribute" /> 

or

 <parameter name="payload"> <p:AdderProcessRequest xmlns:p="http://wso2.org/bps/sample"> <!--Exactly 1 occurrence --> <x xmlns="http://wso2.org/bps/sample">{@xvalue}</x> <!--Exactly 1 occurrence --> <y xmlns="http://wso2.org/bps/sample">{@yvalue}</y> </p:AdderProcessRequest> </parameter> 

In the second approach, the xml content inside the parameter element is not known in advance, so it can be any.

Next, xsd i is created, but it does not work.

 <xs:element name="parameter" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:any minOccurs="0"/> </xs:sequence> <xs:attribute type="xs:string" name="name" use="optional"/> <xs:attribute type="xs:string" name="value" use="optional"/> </xs:complexType> </xs:element> 

Any help with this would be greatly appreciated. thanks in advance

+7
source share
1 answer

I was able to figure this out after going through the specifications posted here so that someone might need it :). You must add processContents="skip" so that the content is not processed.

 <xs:element name="parameter" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:any processContents="skip" minOccurs="0"/> </xs:sequence> <xs:attribute type="xs:string" name="name" use="optional"/> <xs:attribute type="xs:string" name="value" use="optional"/> </xs:complexType> 

+24
source

All Articles