You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by Toby H Ferguson <to...@Sun.COM> on 2004/01/09 22:02:46 UTC
Getting Pattern Facet Values
I'm interested in writing an application that will reveal the underlying
facets (patterns especially) which a user must enter for some data
values - what I want to be able to do is to take input from the user on
a web page, convert to XML, match against a schema, and then when an
error occurs give the user sufficient information so that they can type
the right thing in.
I've tried SchemaType.getFacet(SchemaType.FACET_PATTERN) but that simply
returns null for my schema/instance pair - from the documentation I'd
expected to get back an XmlAnySimpleType which I could then perhaps examine.
XSD:
<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="address"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="address" type="ipAddress">
<xsd:attribute name="ipAddress" type="ipAddress"/>
</xsd:element>
<xsd:simpleType name="ipAddress">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{1-4}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Instance:
<?xml version="1.0"?>
<root>
<address address="1234"/>
<address address="1234.23"/>
<address address="1234.1234"/>
</root>
Toby Ferguson
- ---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/