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.

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/


Mime
View raw message