2
votes

Does anyone have, or know how to edit, an XSD for XML-RPC method calls?

I found this one: MSDN Xml Rpc Schema

However it doesnt allow a valid XML-RPC case. The bit which seems off is:

<xsd:complexType name="ValueType" mixed="true">
    <xsd:choice>
        <xsd:element name="i4"            type="xsd:int" />
        <xsd:element name="int"           type="xsd:int" />
        <xsd:element name="string"        type="ASCIIString" />
        <xsd:element name="double"        type="xsd:decimal" />
        <xsd:element name="Base64"        type="xsd:base64Binary" />
        <xsd:element name="boolean"       type="NumericBoolean" />
        <xsd:element name="dateTime.iso8601" type="xsd:dateTime" />
        <xsd:element name="array"         type="ArrayType" />
        <xsd:element name="struct"        type="StructType" />
    </xsd:choice>
</xsd:complexType>

According to the XML-RPC spec, the following is valid:

...
<value>example text</value>
....

Because if no type element is provided, the text inside the <value> elements are defaulted to strings. However the above xsd would not validate it.

I tried changing it to:

<xsd:complexType mixed="true" name="ValueType">
    <xsd:choice minOccurs="0" maxOccurs="1">
        <xsd:element name="i4"            type="xsd:int" />
        <xsd:element name="int"           type="xsd:int" />
        <xsd:element name="string"        type="ASCIIString" />
        <xsd:element name="double"        type="xsd:decimal" />
        <xsd:element name="Base64"        type="xsd:base64Binary" />
        <xsd:element name="boolean"       type="NumericBoolean" />
        <xsd:element name="dateTime.iso8601" type="xsd:dateTime" />
        <xsd:element name="array"         type="ArrayType" />
        <xsd:element name="struct"        type="StructType" />
    </xsd:choice>
</xsd:complexType>

But that allows: <value>testtext<string>with more text</string></value> which shouldn't be valid according to the spec.

I'm having trouble trying to make it so the Value element can contain either data OR elements, but not a mixture of the two.

Anywho, if anyone knows how to fix the above or has a working xsd they can provide, would be really grateful.

1

1 Answers

1
votes

What you want is not describable using XSD 1.0; conceptually, what you want is a "union" of content models: text only and element only.

If you can employ other means, such as adding Schematron or moving to XSD 1.1 (poorly supported), then please update your question with additional info.