[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] fixed attribute values in Schemas
I am having problems with Schemas and fixed attribute values. In my instance documents, fixed attributes defined in my Schema do not seem to be defined. I am using the SAX parser from apache xerces-1-2-3, which is supposed to support fixed and default attributes. I define an element java.sql.Date with the fixed attribute 'pattern': <element name="java.sql.Date" > <complexType> <simpleContent> <extension base="date" > <attribute name="pattern" type="string" use="fixed" value="yyyy-MM-dd" /> </extension> </simpleContent> </complexType> </element> ...then a test instance document with a java.sql.Date element: <?xml version="1.0"?> <db_bean xmlns="http://schemahost/xml/namespaces/db_bean" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="http://schemahost/xml/namespaces/db_bean db_bean.xsd" class="com.vencast.bean.db.DealComponent" > <property name="lastUpdateDate" > <java.sql.Date>2000-01-02</java.sql.Date> </property> </db_bean> ...but when I parse the document it has no attributes. Thank you in advance for your help, I am putting the full schema below in case that is part of the problem. --Larry <schema xmlns="http://www.w3.org/2000/10/XMLSchema" targetNamespace="http://schemahost/xml/namespaces/db_bean" elementFormDefault="qualified" xmlns:dbb="http://schemahost/xml/namespaces/db_bean"> <element name="db_bean"> <complexType> <annotation> <documentation></documentation> </annotation> <sequence> <element name="property" minOccurs="0" maxOccurs ="unbounded" > <complexType> <choice> <element name="java.lang.Boolean" type ="boolean" /> <element name="java.lang.Byte" type ="byte" /> <element name="java.sql.Date" > <complexType> <simpleContent> <extension base="date" > <attribute name ="pattern" type="string" use="fixed" value="yyyy-MM-dd" /> </extension> </simpleContent> </complexType> </element> <element name="java.lang.Double" type ="double" /> <element name="java.lang.Float" type ="float" /> <element name="java.lang.Integer" type ="integer" /> <element name="java.lang.Long" type ="long" /> <element name="java.lang.Short" type ="short" /> <element name="java.lang.String" type ="string" /> <element name="java.sql.Time" > <complexType> <simpleContent> <extension base="time" > <attribute name ="pattern" type="string" use="fixed" value="yyyy-MM-ddHH:mm:ss.SS0" /> <attribute name ="zero_epoch" type="string" use="fixed" value="1970-01-01" /> </extension> </simpleContent> </complexType> </element> <element name="java.sql.Timestamp" > <complexType> <simpleContent> <extension base ="timeInstant" > <attribute name ="pattern" type="string" use="fixed" value="yyyy-MM-ddTHH:mm:ss-SS-00" /> </extension> </simpleContent> </complexType> </element> </choice> <attribute name="name" use="required" > <simpleType> <restriction base="string" > <pattern value="[a-z|A-Z|_] [\w|_]*" > <annotation> <documentation>java_names must follow Java class naming rules: the first character must be a letter or '_'; the characters that follow may be letters, '_', or numbers</documentation> </annotation> </pattern> </restriction> </simpleType> </attribute> </complexType> </element> </sequence> <attribute name="class" use="required" > <simpleType> <restriction base="string" > <pattern value="[a-z|A-Z|_][\w|_|.]*" > <annotation> <documentation>java_names must follow Java class naming rules: the first character must be a letter or ' _'; the characters that follow may be letters, '_', or numbers. Periods can be used for package delimitation: ie com.vencast.SomeClass</documentation> </annotation> </pattern> </restriction> </simpleType> </attribute> </complexType> </element> </schema>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|