xs:pattern allows unallowed token
This should cover W3C XML Schema, Relax NG and DTD related problems.
xs:pattern allows unallowed token
Hello.
I defined the following pattern for evaluating a date-string:
IMHO this should only allow something like 2009-03-12 or nothing!
But the XML-Validation (all engines) allows the following chars: a, e, n, p, r and t
i.e.
is allowed.
Whats that
Btw: Oxygens inplaced RegEx-Konstruktor does not have this behavior.
I defined the following pattern for evaluating a date-string:
Code: Select all
([0-9]{4}\-[0-9]{1,2}\-[0-9]{1,2})?
But the XML-Validation (all engines) allows the following chars: a, e, n, p, r and t
i.e.
Code: Select all
<tag>a</tag>
Whats that
Btw: Oxygens inplaced RegEx-Konstruktor does not have this behavior.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: xs:pattern allows unallowed token
Post by sorin_ristache »
Hello,
I tested your pattern in Oxygen both in the XML Schema regex builder tool (available on the Tools menu) and in an XML document validated against an XML Schema that specifies the pattern. It works correctly. Illegal characters like a, e, n, p, etc are reported as error. Can you post a sample schema for reproducing the problem?
Regards,
Sorin
I tested your pattern in Oxygen both in the XML Schema regex builder tool (available on the Tools menu) and in an XML document validated against an XML Schema that specifies the pattern. It works correctly. Illegal characters like a, e, n, p, etc are reported as error. Can you post a sample schema for reproducing the problem?
Regards,
Sorin
Re: xs:pattern allows unallowed token
XSD
XML
<oXygen/> XML Editor 10.1, build 2009022414
Code: Select all
?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="TEST">
<xs:complexType>
<xs:sequence>
<xs:element name="FIELDVALUE">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[pattern]"/>
<xs:pattern value="(\d{4}\-\d{1,2}\-\d{1,2})?"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<TEST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Test.xsd">
<FIELDVALUE>a</FIELDVALUE>
</TEST>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: xs:pattern allows unallowed token
Post by sorin_ristache »
The two patterns are ORed, not ANDed which means the following values are accepted: p, a, t, e, r, n, 2009-03-12, 1863-3-6, etc.SaschaF. wrote:Code: Select all
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[pattern]"/>
<xs:pattern value="(\d{4}\-\d{1,2}\-\d{1,2})?"/>
</xs:restriction>
</xs:simpleType>
Regards,
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