length of match-Attribute
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
The XML Schema specification does not set a maximum length for an attribute value. You can use a pattern of 100,000 characters as a value of the xs:pattern/@value attribute but for readability you should split the pattern into subpatterns, define separate types for each subpattern and chain the types to apply all the patterns to the same value. For example the content model of the element a defined by the following schema allows only strings of 1 to 10 lowercase letters followed by 0 to 5 uppercase letters:
Regards,
Sorin
The XML Schema specification does not set a maximum length for an attribute value. You can use a pattern of 100,000 characters as a value of the xs:pattern/@value attribute but for readability you should split the pattern into subpatterns, define separate types for each subpattern and chain the types to apply all the patterns to the same value. For example the content model of the element a defined by the following schema allows only strings of 1 to 10 lowercase letters followed by 0 to 5 uppercase letters:
Code: Select all
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="lowercase">
<xs:restriction base="xs:string">
<xs:pattern value="\p{Ll}{1,10}.{0,5}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uppercaseAndLowercase">
<xs:restriction base="lowercase">
<xs:pattern value=".{1,10}\p{Lu}{0,5}"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="a" type="uppercaseAndLowercase"/>
</xs:schema>
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service