xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toby H Ferguson <toby.h.fergu...@Sun.COM>
Subject Getting Pattern Facet Values
Date Fri, 09 Jan 2004 21:02:46 GMT
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.

<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
  <xsd:element name="root">
    <xsd:element ref="address"/>

  <xsd:element name="address" type="ipAddress">
    <xsd:attribute name="ipAddress" type="ipAddress"/>

  <xsd:simpleType name="ipAddress">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d{1-4}"/>

<?xml version="1.0"?>
  <address address="1234"/>
  <address address="1234.23"/>
  <address address="1234.1234"/>

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/

View raw message