Friday, May 6, 2011

Defining pattern of text() node of complex mixed element

This question is related to that one. But somewhat extended.

Let's assume we have an xml:

<field name="test_field_0">
    Some text that is texty text.
    <subfield>Some text.</subfield>
</field>

The Scheme for it from related question:

<xs:element name="field">
    <xs:complexType mixed="true">
        <xs:sequence>
                <xs:element ref="subfield" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" />
    </xs:complexType>
</xs:element>

Now the additional requirement is that text() node of field element should be regulated by some pattern, for example, this: \p{Lu}(\p{Ll}\p{P}\p{Z})+

From stackoverflow
  • XML Schema does not allow to put any constraints on the text of an element that contains mixed content.

    skfd : That's sad, but thank you.

0 comments:

Post a Comment