You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tw...@locus.apache.org on 2000/01/29 01:27:00 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/validators/schema versionInfo.ent XSchemaValidator.java datatypes.dtd structures.dtd
twl 00/01/28 16:27:00
Modified: java/data personal.xsd
java/docs schema.xml
java/src/org/apache/xerces/msg SchemaMessages.java
java/src/org/apache/xerces/validators/datatype
StringValidator.java
java/src/org/apache/xerces/validators/schema
XSchemaValidator.java datatypes.dtd structures.dtd
Added: java/src/org/apache/xerces/validators/schema versionInfo.ent
Log:
Update Schema & Datatypes syntax to 12/17 Working Draft
Revision Changes Path
1.3 +20 -20 xml-xerces/java/data/personal.xsd
Index: personal.xsd
===================================================================
RCS file: /home/cvs/xml-xerces/java/data/personal.xsd,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- personal.xsd 1999/11/15 23:59:24 1.2
+++ personal.xsd 2000/01/29 00:26:58 1.3
@@ -1,29 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- <!DOCTYPE schema SYSTEM "structures.dtd"> -->
-<!DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
- "http://www.w3.org/XML/Group/1999/09/23-xmlschema/structures/structures.dtd">
+<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 19991216//EN"
+ "http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/structures.dtd">
<schema>
<element name="personnel">
- <archetype>
+ <type>
<element ref="person" minOccurs='1' maxOccurs='*'/>
<attribute name="xmlns"/>
- </archetype>
+ </type>
</element>
<element name="family">
- <archetype content="mixed"/>
+ <type content="mixed"/>
</element>
<element name="given">
- <archetype content="mixed"/>
+ <type content="mixed"/>
</element>
<element name="name">
- <archetype>
+ <type>
<element ref="family"/>
<element ref="given" minOccurs='0' maxOccurs='1'/>
- </archetype>
+ </type>
</element>
<element name="email" type="integer">
@@ -31,20 +30,20 @@
</element>
<element name="url">
- <archetype content="empty">
+ <type content="empty">
<attribute name="href" type="string" default="http://"/>
- </archetype>
+ </type>
</element>
<element name="link">
- <archetype content="empty">
+ <type content="empty">
<attribute name="manager" type="IDREF"/>
<attribute name="subordinates" type="IDREFS"/>
- </archetype>
+ </type>
</element>
<element name="person">
- <archetype>
+ <type>
<element ref="name"/>
<element ref="email" minOccurs='0' maxOccurs='*'/>
<element ref="url" minOccurs='0' maxOccurs='*'/>
@@ -53,19 +52,20 @@
<attribute name="id" type="ID"/>
<attribute name="note" type="string"/>
<attribute name="contr" type="NMTOKEN" default="false">
- <enumeration>
- <literal>true</literal>
- <literal>false</literal>
- </enumeration>
+ <datatype source="string">
+ <enumeration value="true"/>
+ <enumeration value="false"/>
+ </datatype>
</attribute>
<attribute name="salary" type="integer"/>
- </archetype>
+ </type>
</element>
<notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/>
+<!--
<textEntity name='internal-entity'>entity-value</textEntity>
<externalEntity name='external-entity' public='-//ENTITY' system='external-entity.ent'/>
<unparsedEntity name='unparsed-entity' system='unparsed-entity.ent' notation='gif'/>
-
+-->
</schema>
1.5 +26 -19 xml-xerces/java/docs/schema.xml
Index: schema.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/schema.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- schema.xml 2000/01/28 22:57:23 1.4
+++ schema.xml 2000/01/29 00:26:58 1.5
@@ -13,12 +13,15 @@
</s2>
<s2 title="Introduction">
<p>This package contains an implementation of a subset of the
- <jump href="http://www.w3.org/XML/Group/Schemas.html">
- W3C XML Schema Language</jump> as specified in the 17
- December 1999 Working Draft. The parsers contained in this
- package are able to read and validate XML documents with the
- grammar specified in either DTD or XML Schema format. There
- is no functionality for accessing typed data.</p>
+ W3C XML Schema Language as specified in the 17 December 1999
+ Working Drafts for <jump
+ href="http://www.w3.org/TR/xmlschema-1/">Structures</jump> and
+ <jump
+ href="http://www.w3.org/TR/xmlschema-2/">Datatypes</jump>. The
+ parsers contained in this package are able to read and
+ validate XML documents with the grammar specified in either
+ DTD or XML Schema format. There is no functionality for
+ accessing typed data.</p>
<p>We are making this package available in order to get
feedback on the features in the XML Schema language
design and on representing an XML document's grammar
@@ -35,17 +38,21 @@
</s2>
<s2 title="Structure Limitations">
<ul>
- <li>elementDecls, archeTypes, modelGroups and attributeGroup
+ <li>elements, types, groups and attributeGroups
share the same namespace</li>
- <li>All archetypes, elements, modelGroups and attributeGroups
+ <li>All types, elements, groups and attributeGroups
must be declared before they are used.</li>
- <li>On archetypes the following are unsupported:</li>
+ <li>On types the following are unsupported:</li>
<ul>
- <li>open, refine-able, and closed models</li>
- <li>nested element decls</li>
+ <li><code>final</code>, <code>abstract</code>,
+ <code>exact</code>, <code>nullable</code>.</li>
+ <li>nested <code>element</code> declarations</li>
</ul>
- <li>None of the items in section 5, import, inclusion, export,
- or refinement, are supported.</li>
+ <li>Only the <code><any/></code> wildcard is supported</li>
+ <li>Type derivation (section 3.6) is not supported</li>
+ <li>Unique, key and key reference constraints (section
+ 3.7) are not supported.</li>
+ <li>None of the mechanisms in section 4, are supported.</li>
</ul>
</s2>
<s2 title="Datatype Limitations">
@@ -57,15 +64,15 @@
<tr><th>Schema type</th><th>Java type</th></tr>
<tr><td>boolean</td><td>Boolean</td></tr>
<tr><td>integer</td><td>Integer</td></tr>
- <tr><td>decimal</td><td>Double</td></tr>
- <tr><td>real</td><td>Double</td></tr>
+ <tr><td>decimal</td><td>BigDecimal</td></tr>
+ <tr><td>float</td><td>float</td></tr>
+ <tr><td>double</td><td>double</td></tr>
</table>
<ul>
<li>The NMTOKEN, NMTOKENS, Name, NCName, ID, IDREF,
ENTITY, ENTITIES, NOTATION are only supported on attributes. At
the moment they cannot be applied to element content.</li>
- <li>The timeInstant, timeDuration, recurringInstant, date, time,
- binary, uri, and language datatypes are not supported.</li>
+ <li>The recurringInstant, date, time, and language datatypes are not supported.</li>
<li>Datatype qualifiers on attributes are not supported.</li>
</ul>
</s2>
@@ -86,8 +93,8 @@
</document></source>
<p>Another requirement is that the XML Schema document's grammar must
have a <!DOCTYPE ...> line specifying the DTD for XML Schema grammar.
- The DOCTYPE must specify the following system identifier:<br/>
- <code>http://www.w3.org/XML/Group/1999/09/23-xmlschema/structures/structures.dtd</code></p>
+ The DOCTYPE must specify the following system identifier:<br/></p>
+<source>http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/structures.dtd</source>
<p>Also, there must be an attribute declaration for the xmlns attribute
used to find the schema (document in the example above).</p>
<p>Review the sample file, "data/personal.xsd" for an example of an XML
1.2 +4 -4 xml-xerces/java/src/org/apache/xerces/msg/SchemaMessages.java
Index: SchemaMessages.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/msg/SchemaMessages.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SchemaMessages.java 1999/11/09 01:12:52 1.1
+++ SchemaMessages.java 2000/01/29 00:26:58 1.2
@@ -76,15 +76,15 @@
{ "NotADatatype", "{0} is not a datatype." },
{ "TextOnlyContentWithType", "The content attribute must be 'textOnly' if you specify a type attribute." },
{ "FeatureUnsupported", "{0} is unsupported" },
- { "NestedOnlyInElemOnly", "Nested Element decls only allowed in elemOnly content" },
- { "EltRefOnlyInMixedElemOnly", "Element references only allowed in mixed or elemOnly content"},
- { "OnlyInEltContent", "{0} only allowed in elemOnly content."},
+ { "NestedOnlyInElemOnly", "Nested Element decls only allowed in elementOnly content" },
+ { "EltRefOnlyInMixedElemOnly", "Element references only allowed in mixed or elementOnly content"},
+ { "OnlyInEltContent", "{0} only allowed in elementOnly content."},
{ "OrderIsAll", "{0} not allowed if the order is all."},
{ "DatatypeWithType", "Datatype qualifiers can only be used if you specify a type attribute."},
{ "DatatypeQualUnsupported", "The datatype qualifier {0} is not supported."},
{ "GroupContentRestricted", "Error: {0} content must be one of element, group, modelGroupRef. Saw {1}"},
{ "UnknownBaseDatatype", "Unknown base type {0} for type {1}." },
- { "OneOfTypeRefArchRef", "Can only have one of type, ref, and archRef attributes."},
+ { "OneOfTypeRefArchRef", "Can only have one of type and ref attributes."},
{ "NoContentForRef", "Cannot have child content for an element declaration that has a ref attribute" },
{ "IncorrectDefaultType", "Incorrect type for {0}'s default value: {1}" },
{ "IllegalAttContent", "Illegal content {0} in attribute group" },
1.5 +2 -0 xml-xerces/java/src/org/apache/xerces/validators/datatype/StringValidator.java
Index: StringValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/StringValidator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StringValidator.java 2000/01/12 21:15:00 1.4
+++ StringValidator.java 2000/01/29 00:26:58 1.5
@@ -115,6 +115,7 @@
}
public void setFacets(Hashtable facets) throws UnknownFacetException, IllegalFacetException, IllegalFacetValueException {
+ facetData = new Hashtable(); // reset old facets
for (Enumeration e = facets.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
if (key.equals(DatatypeValidator.LENGTH)) {
@@ -135,6 +136,7 @@
} else if (key.equals(DatatypeValidator.MINEXCLUSIVE)) {
} else if (key.equals(DatatypeValidator.PATTERN)) {
} else if (key.equals(DatatypeValidator.ENUMERATION)) {
+ facetData.put(key,facets.get(key));
} else {
throw new IllegalFacetException();
}
1.8 +208 -306 xml-xerces/java/src/org/apache/xerces/validators/schema/XSchemaValidator.java
Index: XSchemaValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/XSchemaValidator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XSchemaValidator.java 2000/01/25 03:53:02 1.7
+++ XSchemaValidator.java 2000/01/29 00:26:59 1.8
@@ -116,6 +116,8 @@
import org.apache.xerces.validators.datatype.DecimalValidator;
import org.apache.xerces.validators.datatype.TimeDurationValidator;
import org.apache.xerces.validators.datatype.TimeInstantValidator;
+import org.apache.xerces.validators.datatype.BinaryValidator;
+import org.apache.xerces.validators.datatype.URIValidator;
import org.apache.xerces.msg.SchemaMessages;
/**
@@ -165,6 +167,7 @@
private int fGroupCount = 0;
private int fModelGroupCount = 0;
private int fAttributeGroupCount = 0;
+ private int fDatatypeCount = 0;
private Hashtable fForwardRefs = new Hashtable(); // REVISIT w/ more efficient structure later
private Hashtable fAttrGroupUses = new Hashtable();
@@ -172,19 +175,19 @@
private static final String ELT_COMMENT = "comment";
private static final String ELT_DATATYPEDECL = "datatype";
- private static final String ELT_ARCHETYPEDECL = "archetype";
+ private static final String ELT_ARCHETYPEDECL = "type";
private static final String ELT_ELEMENTDECL = "element";
- private static final String ELT_GROUP = "group";
- private static final String ELT_ATTRGROUPDECL = "attrGroup";
- private static final String ELT_ATTRGROUPREF = "attrGroupRef";
- private static final String ELT_MODELGROUPDECL = "modelGroup";
- private static final String ELT_MODELGROUPREF = "modelGroupRef";
- private static final String ELT_TEXTENTITYDECL = "textEntity";
- private static final String ELT_EXTERNALENTITYDECL = "externalEntity";
- private static final String ELT_UNPARSEDENTITYDECL = "unparsedEntity";
+ private static final String ELT_GROUPDECL = "group";
+ private static final String ELT_ATTRGROUPDECL = "attributeGroup";
+// private static final String ELT_TEXTENTITYDECL = "textEntity";
+// private static final String ELT_EXTERNALENTITYDECL = "externalEntity";
+// private static final String ELT_UNPARSEDENTITYDECL = "unparsedEntity";
private static final String ELT_NOTATIONDECL = "notation";
- private static final String ELT_REFINES = "refines";
+// private static final String ELT_REFINES = "refines";
+ private static final String ELT_RESTRICTIONS = "restrictions";
private static final String ELT_ATTRIBUTEDECL = "attribute";
+ private static final String ELT_ANNOTATION = "annotation";
+ private static final String ELT_ANY = "any";
private static final String ATT_NAME = "name";
private static final String ATT_CONTENT = "content";
private static final String ATT_MODEL = "model";
@@ -199,14 +202,16 @@
private static final String ATT_SCHEMANAME = "schemaName";
private static final String ATT_MINOCCURS = "minOccurs";
private static final String ATT_MAXOCCURS = "maxOccurs";
- private static final String ATT_EXPORT = "export";
+// private static final String ATT_EXPORT = "export";
+ private static final String ATT_SOURCE = "source";
+ private static final String ATT_VALUE = "value";
private static final String ATTVAL_ANY = "any";
private static final String ATTVAL_MIXED = "mixed";
private static final String ATTVAL_EMPTY = "empty";
private static final String ATTVAL_CHOICE = "choice";
private static final String ATTVAL_SEQ = "seq";
private static final String ATTVAL_ALL = "all";
- private static final String ATTVAL_ELEMONLY = "elemOnly";
+ private static final String ATTVAL_ELEMONLY = "elementOnly";
private static final String ATTVAL_TEXTONLY = "textOnly";
private Document fSchemaDocument;
@@ -1726,14 +1731,14 @@
traverseElementDecl(child);
} else if (name.equals(ELT_ATTRGROUPDECL)) {
traverseAttrGroup(child);
- } else if (name.equals(ELT_MODELGROUPDECL)) {
- traverseModelGroup(child);
+ } else if (name.equals(ELT_GROUPDECL) && child.getAttribute(ATT_REF).equals("")) {
+ traverseGroup(child);
}
//
// Entities
//
-
+/*
else if (name.equals(ELT_TEXTENTITYDECL) ||
name.equals(ELT_EXTERNALENTITYDECL) ||
name.equals(ELT_UNPARSEDENTITYDECL)) {
@@ -1757,7 +1762,7 @@
}
}
}
-
+*/
//
// Notation
//
@@ -1813,176 +1818,142 @@
private int traverseTypeDecl(Element typeDecl) throws Exception {
String typeName = typeDecl.getAttribute(ATT_NAME);
String content = typeDecl.getAttribute(ATT_CONTENT);
- String model = typeDecl.getAttribute(ATT_MODEL);
- String order = typeDecl.getAttribute(ATT_ORDER);
- String type = typeDecl.getAttribute(ATT_TYPE);
- String deflt = typeDecl.getAttribute(ATT_DEFAULT);
- String fixed = typeDecl.getAttribute(ATT_FIXED);
- String schemaAbbrev = typeDecl.getAttribute(ATT_SCHEMAABBREV);
- String schemaName = typeDecl.getAttribute(ATT_SCHEMANAME);
-
+ String source = typeDecl.getAttribute(ATT_SOURCE);
+
if (typeName.equals("")) { // gensym a unique name
typeName = "http://www.apache.org/xml/xerces/internalType"+fTypeCount++;
}
-
- // integrity checks
- if (type.equals("")) {
- if (!schemaAbbrev.equals(""))
- reportSchemaError(SchemaMessageProvider.AttMissingType,
- new Object [] { "schemaAbbrev" });
- if (!schemaName.equals(""))
- reportSchemaError(SchemaMessageProvider.AttMissingType,
- new Object [] { "schemaName" });
- if (!deflt.equals(""))
- reportSchemaError(SchemaMessageProvider.AttMissingType,
- new Object [] { "default" });
- if (!fixed.equals(""))
- reportSchemaError(SchemaMessageProvider.AttMissingType,
- new Object [] { "fixed" });
- } else {
- if (fDatatypeRegistry.getValidatorFor(type) != null) // must be datatype
- reportSchemaError(SchemaMessageProvider.NotADatatype,
- new Object [] { type }); //REVISIT check forward refs
- if (!content.equals(ATTVAL_TEXTONLY)) //REVISIT: check if attribute was specified, if not, set
- reportSchemaError(SchemaMessageProvider.TextOnlyContentWithType, null);
- // REVISIT handle datatypes
- }
- Element child = XUtil.getFirstChildElement(typeDecl);
- Element refines = null;
-
- // skip the refines
- if (child != null && child.getNodeName().equals(ELT_REFINES)) {
- reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
- new Object [] { "Refinement" });
- refines = child;
- child = XUtil.getNextSiblingElement(child);
- }
-
- int contentSpecType = 0;
- int csnType = 0;
- boolean mixedContent = false;
- boolean elementContent = false;
- boolean textContent = false;
- boolean buildAll = false;
- int allChildren[] = null;
- int allChildCount = 0;
- int left = -2;
- int right = -2;
- boolean hadContent = false;
+ Element child = null;
+ int contentSpecType = 0;
+ int csnType = 0;
+ int left = -2;
+ int right = -2;
+ Vector uses = new Vector();
- if (order.equals(ATTVAL_CHOICE)) {
- csnType = XMLContentSpecNode.CONTENTSPECNODE_CHOICE;
- contentSpecType = fStringPool.addSymbol("CHILDREN");
- } else if (order.equals(ATTVAL_SEQ)) {
- csnType = XMLContentSpecNode.CONTENTSPECNODE_SEQ;
- contentSpecType = fStringPool.addSymbol("CHILDREN");
- } else if (order.equals(ATTVAL_ALL)) {
- buildAll = true;
- allChildren = new int[((org.apache.xerces.dom.NodeImpl)typeDecl).getLength()];
- allChildCount = 0;
- }
-
- if (content.equals(ATTVAL_EMPTY)) {
- contentSpecType = fStringPool.addSymbol("EMPTY");
- left = -1; // no contentSpecNode needed
- } else if (content.equals(ATTVAL_ANY)) {
- contentSpecType = fStringPool.addSymbol("ANY");
- left = -1; // no contentSpecNode needed
- } else if (content.equals(ATTVAL_MIXED)) {
- contentSpecType = fStringPool.addSymbol("MIXED");
- mixedContent = true;
- csnType = XMLContentSpecNode.CONTENTSPECNODE_CHOICE;
- } else if (content.equals(ATTVAL_ELEMONLY)) {
- elementContent = true;
- } else if (content.equals(ATTVAL_TEXTONLY)) {
- textContent = true;
- }
-
- if (mixedContent) {
- // add #PCDATA leaf
+ // skip refinement and annotations
+ child = null;
+ for (child = XUtil.getFirstChildElement(typeDecl);
+ child != null && (child.getNodeName().equals(ELT_RESTRICTIONS) ||
+ child.getNodeName().equals(ELT_ANNOTATION));
+ child = XUtil.getNextSiblingElement(child)) {
+ if (child.getNodeName().equals(ELT_RESTRICTIONS))
+ reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
+ new Object [] { "Restriction" });
+ }
+
+ // if content = textonly, source is a datatype
+ if (content.equals(ATTVAL_TEXTONLY)) {
+ if (fDatatypeRegistry.getValidatorFor(source) == null) // must be datatype
+ reportSchemaError(SchemaMessageProvider.NotADatatype,
+ new Object [] { source }); //REVISIT check forward refs
+ //handle datatypes
+ contentSpecType = fStringPool.addSymbol("DATATYPE");
left = fElementDeclPool.addContentSpecNode(XMLContentSpecNode.CONTENTSPECNODE_LEAF,
- -1, // -1 means "#PCDATA" is name
+ fStringPool.addSymbol(source),
-1, false);
- }
-
- Vector uses = new Vector();
- for (;
- child != null;
- child = XUtil.getNextSiblingElement(child)) {
- int index = -2;
- hadContent = true;
- String childName = child.getNodeName();
- if (childName.equals(ELT_ELEMENTDECL)) {
- if (child.getAttribute(ATT_REF).equals("")) { // elt decl
- if (elementContent) //REVISIT: no support for nested type declarations
- reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
- new Object [] { "Nesting element declarations" });
- else
- reportSchemaError(SchemaMessageProvider.NestedOnlyInElemOnly, null);
- } else if (mixedContent || elementContent) { // elt ref
- index = traverseElementRef(child);
- } else {
- reportSchemaError(SchemaMessageProvider.EltRefOnlyInMixedElemOnly, null);
- }
- } else if (childName.equals(ELT_GROUP)) {
- if (elementContent && !buildAll) {
- int groupNameIndex = traverseGroup(child);
- index = getContentSpec(getElement(groupNameIndex));
- } else if (!elementContent)
- reportSchemaError(SchemaMessageProvider.OnlyInEltContent,
- new Object [] { "group" });
- else // buildAll
- reportSchemaError(SchemaMessageProvider.OrderIsAll,
- new Object [] { "group" } );
- } else if (childName.equals(ELT_MODELGROUPREF)) {
- if (elementContent && !buildAll) {
- int modelGroupNameIndex = traverseModelGroup(child);
- index = getContentSpec(getElement(modelGroupNameIndex));
- if (index == -1)
- reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
- new Object [] { "Forward reference to model group" });
- index = expandContentModel(index, child);
- } else if (!elementContent)
- reportSchemaError(SchemaMessageProvider.OnlyInEltContent,
- new Object [] { "modelGroupRef" });
- else // buildAll
- reportSchemaError(SchemaMessageProvider.OrderIsAll,
- new Object [] { "modelGroupRef" });
- } else if (childName.equals(ELT_ATTRIBUTEDECL) || childName.equals(ELT_ATTRGROUPREF)) {
- break; // attr processing is done below
- } else { // datatype qual
- if (type.equals(""))
- reportSchemaError(SchemaMessageProvider.DatatypeWithType, null);
- else
- reportSchemaError(SchemaMessageProvider.DatatypeQualUnsupported,
- new Object [] { childName });
- }
- uses.addElement(new Integer(index));
- if (buildAll) {
- allChildren[allChildCount++] = index;
- } else if (left == -2) {
- left = index;
- } else if (right == -2) {
- right = index;
- } else {
- left = fElementDeclPool.addContentSpecNode(csnType, left, right, false);
- right = index;
- }
- }
- if (buildAll) {
- left = buildAllModel(allChildren,allChildCount);
- } else {
- if (hadContent && right != -2)
- left = fElementDeclPool.addContentSpecNode(csnType, left, right, false);
+
+ } else {
+ contentSpecType = fStringPool.addSymbol("CHILDREN");
+ csnType = XMLContentSpecNode.CONTENTSPECNODE_SEQ;
+ boolean mixedContent = false;
+ boolean elementContent = false;
+ boolean textContent = false;
+ left = -2;
+ right = -2;
+ boolean hadContent = false;
- if (mixedContent && hadContent) {
- // set occurrence count
- left = fElementDeclPool.addContentSpecNode(XMLContentSpecNode.CONTENTSPECNODE_ZERO_OR_MORE,
- left, -1, false);
- }
- }
+ if (content.equals(ATTVAL_EMPTY)) {
+ contentSpecType = fStringPool.addSymbol("EMPTY");
+ left = -1; // no contentSpecNode needed
+ } else if (content.equals(ATTVAL_MIXED) || content.equals("")) {
+ contentSpecType = fStringPool.addSymbol("MIXED");
+ mixedContent = true;
+ csnType = XMLContentSpecNode.CONTENTSPECNODE_CHOICE;
+ } else if (content.equals(ATTVAL_ELEMONLY)) {
+ elementContent = true;
+ } else if (content.equals(ATTVAL_TEXTONLY)) {
+ textContent = true;
+ }
+
+ if (mixedContent) {
+ // a dd #PCDATA leaf
+ left = fElementDeclPool.addContentSpecNode(XMLContentSpecNode.CONTENTSPECNODE_LEAF,
+ -1, // -1 means "#PCDATA" is name
+ -1, false);
+ }
+
+ for (;
+ child != null;
+ child = XUtil.getNextSiblingElement(child)) {
+ int index = -2;
+ hadContent = true;
+ String childName = child.getNodeName();
+ if (childName.equals(ELT_ELEMENTDECL)) {
+ if (child.getAttribute(ATT_REF).equals("") &&
+ child.getAttribute(ATT_TYPE).equals("")) { // elt decl
+ if (elementContent) //R EVISIT: no support for nested type declarations
+ reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
+ new Object [] { "Nesting element declarations" });
+ else
+ reportSchemaError(SchemaMessageProvider.NestedOnlyInElemOnly, null);
+ } else if (mixedContent || elementContent) {
+ if (!child.getAttribute(ATT_TYPE).equals("")) {
+ int elementNameIndex = traverseElementDecl(child);
+ index = fElementDeclPool.addContentSpecNode(XMLContentSpecNode.CONTENTSPECNODE_LEAF,
+ elementNameIndex,
+ -1, false);
+ } else // ATT_REF != ""
+ index = traverseElementRef(child);
+ } else {
+ reportSchemaError(SchemaMessageProvider.EltRefOnlyInMixedElemOnly, null);
+ }
+ } else if (childName.equals(ELT_GROUPDECL)) {
+ if (elementContent) {
+ int groupNameIndex = 0;
+ if (child.getAttribute(ATT_REF).equals("")) {
+ groupNameIndex = traverseGroup(child);
+ } else
+ groupNameIndex = traverseGroupRef(child);
+ index = getContentSpec(getElement(groupNameIndex));
+ } else if (!elementContent)
+ reportSchemaError(SchemaMessageProvider.OnlyInEltContent,
+ new Object [] { "group" });
+ else // buildAll
+ reportSchemaError(SchemaMessageProvider.OrderIsAll,
+ new Object [] { "group" } );
+ } else if (childName.equals(ELT_ATTRIBUTEDECL)) {
+ break; // attr processing is done be low
+ } else if (childName.equals(ELT_ANY)) {
+ contentSpecType = fStringPool.addSymbol("ANY");
+ left = -1;
+ } else { // datatype qual
+ if (source.equals(""))
+ reportSchemaError(SchemaMessageProvider.DatatypeWithType, null);
+ else
+ reportSchemaError(SchemaMessageProvider.DatatypeQualUnsupported,
+ new Object [] { childName });
+ }
+ uses.addElement(new Integer(index));
+ if (left == -2) {
+ left = index;
+ } else if (right == -2) {
+ right = index;
+ } else {
+ left = fElementDeclPool.addContentSpecNode(csnType, left, right, false);
+ right = index;
+ }
+ }
+
+ if (hadContent && right != -2)
+ left = fElementDeclPool.addContentSpecNode(csnType, left, right, false);
+ if (mixedContent && hadContent) {
+ // set occurrence count
+ left = fElementDeclPool.addContentSpecNode(XMLContentSpecNode.CONTENTSPECNODE_ZERO_OR_MORE,
+ left, -1, false);
+ }
+ }
// stick in ElementDeclPool as a hack
int typeNameIndex = fStringPool.addSymbol(typeName); //REVISIT namespace clashes possible
int typeIndex = fElementDeclPool.addElementDecl(typeNameIndex, contentSpecType, left, false);
@@ -1997,7 +1968,7 @@
String childName = child.getNodeName();
if (childName.equals(ELT_ATTRIBUTEDECL)) {
traverseAttributeDecl(child, typeIndex);
- } else if (childName.equals(ELT_ATTRGROUPREF)) {
+ } else if (childName.equals(ELT_ATTRGROUPDECL) && !child.getAttribute(ATT_REF).equals("")) {
int index = traverseAttrGroupRef(child);
if (getContentSpec(getElement(index)) == -1) {
reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
@@ -2058,12 +2029,22 @@
hadContent = true;
String childName = child.getNodeName();
if (childName.equals(ELT_ELEMENTDECL)) {
- if (child.getAttribute(ATT_REF).equals(""))
+ if (child.getAttribute(ATT_REF).equals("") &&
+ child.getAttribute(ATT_TYPE).equals("")) { //elt decl
reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
new Object [] { "Nesting element declarations" });
- else
- index = traverseElementRef(child);
- } else if (childName.equals(ELT_GROUP)) {
+ } else {
+ if (!child.getAttribute(ATT_TYPE).equals("")) {
+ int elementNameIndex = traverseElementDecl(child);
+ index = fElementDeclPool.addContentSpecNode(XMLContentSpecNode.CONTENTSPECNODE_LEAF,
+ elementNameIndex,
+ -1, false);
+
+ } else {
+ index = traverseElementRef(child);
+ }
+ }
+ } else if (childName.equals(ELT_GROUPDECL)) {
if (!buildAll) {
int groupNameIndex = traverseGroup(child);
groupIndices[numGroups++] = groupNameIndex;
@@ -2071,14 +2052,6 @@
} else
reportSchemaError(SchemaMessageProvider.OrderIsAll,
new Object [] { "group" } );
- } else if (childName.equals(ELT_MODELGROUPREF)) {
- if (!buildAll) {
- int modelGroupNameIndex = traverseModelGroupRef(child);
- index = getContentSpec(getElement(modelGroupNameIndex));
- index = expandContentModel(index, child);
- } else
- reportSchemaError(SchemaMessageProvider.OrderIsAll,
- new Object [] { "modelGroupRef" });
} else {
reportSchemaError(SchemaMessageProvider.GroupContentRestricted,
new Object [] { "group", childName });
@@ -2109,107 +2082,28 @@
return groupNameIndex;
}
- private int traverseModelGroup(Element modelGroupDecl) throws Exception {
- String modelGroupName = modelGroupDecl.getAttribute(ATT_NAME);
- String order = modelGroupDecl.getAttribute(ATT_ORDER);
-
- if (modelGroupName.equals("")) { // gensym a unique name
- modelGroupName = "http://www.apache.org/xml/xerces/internalModelGroup"+fModelGroupCount++;
- }
-
- Element child = XUtil.getFirstChildElement(modelGroupDecl);
-
- int contentSpecType = 0;
- int csnType = 0;
- boolean buildAll = false;
- int allChildren[] = null;
- int allChildCount = 0;
-
- if (order.equals(ATTVAL_CHOICE)) {
- csnType = XMLContentSpecNode.CONTENTSPECNODE_CHOICE;
- contentSpecType = fStringPool.addSymbol("CHILDREN");
- } else if (order.equals(ATTVAL_SEQ)) {
- csnType = XMLContentSpecNode.CONTENTSPECNODE_SEQ;
- contentSpecType = fStringPool.addSymbol("CHILDREN");
- } else if (order.equals(ATTVAL_ALL)) {
- buildAll = true;
- allChildren = new int[((org.apache.xerces.dom.NodeImpl)modelGroupDecl).getLength()];
- allChildCount = 0;
- }
- int left = -2;
- int right = -2;
- boolean hadContent = false;
-
- for (;
- child != null;
- child = XUtil.getNextSiblingElement(child)) {
- int index = -2;
- hadContent = true;
- String childName = child.getNodeName();
- if (childName.equals(ELT_ELEMENTDECL)) {
- if (child.getAttribute(ATT_REF).equals(""))
- reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
- new Object [] { "Nesting element declarations" });
- else {
- index = traverseElementRef(child);
- }
- } else if (childName.equals(ELT_GROUP)) {
- int groupNameIndex = traverseGroup(child);
- index = getContentSpec(getElement(groupNameIndex));
- } else if (childName.equals(ELT_MODELGROUPREF)) {
- int modelGroupNameIndex = traverseModelGroupRef(child);
- index = getContentSpec(getElement(modelGroupNameIndex));
- index = expandContentModel(index, child);
- } else {
- reportSchemaError(SchemaMessageProvider.GroupContentRestricted,
- new Object [] { "modelGroup", childName });
- }
- if (buildAll) {
- allChildren[allChildCount++] = index;
- } else if (left == -2) {
- left = index;
- } else if (right == -2) {
- right = index;
- } else {
- left = fElementDeclPool.addContentSpecNode(csnType, left, right, false);
- right = index;
- }
- }
- if (buildAll) {
- left = buildAllModel(allChildren,allChildCount);
- } else {
- if (hadContent && right != -2)
- left = fElementDeclPool.addContentSpecNode(csnType, left, right, false);
- }
-
- left = expandContentModel(left, modelGroupDecl);
-
- // stick in ElementDeclPool as a hack
- int modelGroupNameIndex = fStringPool.addSymbol(modelGroupName); //REVISIT namespace clashes possible
- int modelGroupIndex = fElementDeclPool.addElementDecl(modelGroupNameIndex, contentSpecType, left, false);
-
- return modelGroupNameIndex;
- }
-
- private int traverseModelGroupRef(Element modelGroupRef) {
- String name = modelGroupRef.getAttribute(ATT_NAME);
+ private int traverseGroupRef(Element groupRef) {
+ String name = groupRef.getAttribute(ATT_REF);
int index = fStringPool.addSymbol(name);
-// if (getContentSpec(getElement(index)) == -1) fElementDeclPool.setContentSpec(index, -2);
- return index;
+ return index;
}
public int traverseDatatypeDecl(Element datatypeDecl) throws Exception {
- int newTypeName = fStringPool.addSymbol(datatypeDecl.getAttribute(ATT_NAME));
- int export = fStringPool.addSymbol(datatypeDecl.getAttribute(ATT_EXPORT));
+ int newTypeName;
+
+ if (datatypeDecl.getAttribute(ATT_NAME).equals("")) {
+ String newTypeString = "http://www.apache.org/xml/xerces/internalDatatype"+fGroupCount++;
+ newTypeName = fStringPool.addSymbol(newTypeString);
+ } else
+ newTypeName = fStringPool.addSymbol(datatypeDecl.getAttribute(ATT_NAME));
+ int basetype = fStringPool.addSymbol(datatypeDecl.getAttribute(ATT_SOURCE));
- Element datatypeChild = XUtil.getFirstChildElement(datatypeDecl);
- int basetype = fStringPool.addSymbol(datatypeChild.getNodeName());
// check that base type is defined
//REVISIT: how do we do the extension mechanism? hardwired type name?
- DatatypeValidator baseValidator = fDatatypeRegistry.getValidatorFor(datatypeChild.getAttribute(ATT_NAME));
+ DatatypeValidator baseValidator = fDatatypeRegistry.getValidatorFor(datatypeDecl.getAttribute(ATT_SOURCE));
if (baseValidator == null) {
reportSchemaError(SchemaMessageProvider.UnknownBaseDatatype,
- new Object [] { datatypeChild.getAttribute(ATT_NAME), datatypeDecl.getAttribute(ATT_NAME) });
+ new Object [] { datatypeDecl.getAttribute(ATT_SOURCE), datatypeDecl.getAttribute(ATT_NAME) });
return -1;
}
@@ -2219,19 +2113,19 @@
Hashtable facetData = new Hashtable();
Vector enumData = new Vector();
- Node facet = datatypeChild.getNextSibling();
+ // Skip annotations
+ Node facet = datatypeDecl.getFirstChild();
+ while (facet != null && facet.getNodeName().equals(ELT_ANNOTATION))
+ facet = facet.getNextSibling();
while (facet != null) {
if (facet.getNodeType() == Node.ELEMENT_NODE) {
+ Element facetElt = (Element) facet;
numFacets++;
- if (facet.getNodeName().equals(DatatypeValidator.ENUMERATION)) {
- Node literal = XUtil.getFirstChildElement(facet);
- while (literal != null) {
- numEnumerationLiterals++;
- enumData.addElement(literal.getFirstChild().getNodeValue());
- literal = XUtil.getNextSiblingElement(literal);
- }
+ if (facetElt.getNodeName().equals(DatatypeValidator.ENUMERATION)) {
+ numEnumerationLiterals++;
+ enumData.addElement(facetElt.getAttribute(ATT_VALUE));
} else {
- facetData.put(facet.getNodeName(),facet.getFirstChild().getNodeValue());
+ facetData.put(facetElt.getNodeName(),facetElt.getAttribute(ATT_VALUE));
}
}
facet = facet.getNextSibling();
@@ -2250,7 +2144,7 @@
reportSchemaError(SchemaMessageProvider.DatatypeError,
new Object [] { e.getMessage() });
}
- return -1;
+ return newTypeName;
}
private int traverseElementDecl(Element elementDecl) throws Exception {
@@ -2260,26 +2154,23 @@
String name = elementDecl.getAttribute(ATT_NAME);
String ref = elementDecl.getAttribute(ATT_REF);
- String archRef = elementDecl.getAttribute(ATT_ARCHREF);
String type = elementDecl.getAttribute(ATT_TYPE);
- String schemaAbbrev = elementDecl.getAttribute(ATT_SCHEMAABBREV);
- String schemaName = elementDecl.getAttribute(ATT_SCHEMANAME);
String minOccurs = elementDecl.getAttribute(ATT_MINOCCURS);
String maxOccurs = elementDecl.getAttribute(ATT_MAXOCCURS);
- String export = elementDecl.getAttribute(ATT_EXPORT);
+ String dflt = elementDecl.getAttribute(ATT_DEFAULT);
+ String fixed = elementDecl.getAttribute(ATT_FIXED);
int attrCount = 0;
if (!ref.equals("")) attrCount++;
if (!type.equals("")) attrCount++;
- if (!archRef.equals("")) attrCount++;
//REVISIT top level check for ref & archref
if (attrCount > 1)
reportSchemaError(SchemaMessageProvider.OneOfTypeRefArchRef, null);
- if (!ref.equals("") || !archRef.equals("")) {
+ if (!ref.equals("")) {
if (XUtil.getFirstChildElement(elementDecl) != null)
reportSchemaError(SchemaMessageProvider.NoContentForRef, null);
- int typeName = (!ref.equals("")) ? fStringPool.addSymbol(ref) : fStringPool.addSymbol(archRef);
+ int typeName = fStringPool.addSymbol(ref);
contentSpecNodeIndex = getContentSpec(getElement(typeName));
contentSpecType = getContentSpecType(getElement(typeName));
@@ -2398,7 +2289,14 @@
int enumeration = -1;
String datatype = attrDecl.getAttribute(ATT_TYPE);
if (datatype.equals("")) {
- attType = fStringPool.addSymbol("CDATA");
+ Element child = XUtil.getFirstChildElement(attrDecl);
+ while (child != null && !child.getNodeName().equals(ELT_DATATYPEDECL))
+ child = XUtil.getNextSiblingElement(child);
+ if (child != null && child.getNodeName().equals(ELT_DATATYPEDECL)) {
+ attType = fStringPool.addSymbol("DATATYPE");
+ enumeration = traverseDatatypeDecl(child);
+ } else
+ attType = fStringPool.addSymbol("CDATA");
} else {
if (datatype.equals("string")) {
attType = fStringPool.addSymbol("CDATA");
@@ -2459,6 +2357,7 @@
attDefaultType = fStringPool.addSymbol("#IMPLIED");
}
}
+ // check default value is valid for the datatype.
if (attType == fStringPool.addSymbol("DATATYPE") && attDefaultValue != -1) {
try { // REVISIT - integrate w/ error handling
String type = fStringPool.toString(enumeration);
@@ -2499,7 +2398,7 @@
child != null;
child = XUtil.getNextSiblingElement(child)) {
String childName = child.getNodeName();
- if (childName.equals(ELT_ATTRGROUPREF)) {
+ if (childName.equals(ELT_ATTRGROUPDECL) && !child.getAttribute(ATT_REF).equals("")) {
groupIndices[numGroups++] = traverseAttrGroupRef(child);
if (getContentSpec(getElement(groupIndices[numGroups-1])) == -1) {
reportSchemaError(SchemaMessageProvider.FeatureUnsupported,
@@ -2552,7 +2451,7 @@
}
private int traverseAttrGroupRef(Element attrGroupRef) {
- String name = attrGroupRef.getAttribute(ATT_NAME);
+ String name = attrGroupRef.getAttribute(ATT_REF);
int index = fStringPool.addSymbol(name);
return index;
}
@@ -3023,12 +2922,14 @@
static class Resolver implements EntityResolver {
private static final String SYSTEM[] = {
- "http://www.w3.org/XML/Group/1999/09/23-xmlschema/structures/structures.dtd",
- "http://www.w3.org/XML/Group/1999/09/23-xmlschema/datatypes/datatypes.dtd",
+ "http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/structures.dtd",
+ "http://www.w3.org/TR/1999/WD-xmlschema-2-19991217/datatypes.dtd",
+ "http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/versionInfo.ent",
};
private static final String PATH[] = {
"structures.dtd",
"datatypes.dtd",
+ "versionInfo.ent",
};
public InputSource resolveEntity(String publicId, String systemId)
@@ -3121,12 +3022,13 @@
fRegistry.put("double", new DoubleValidator());
fRegistry.put("timeDuration", new TimeDurationValidator());
fRegistry.put("timeInstant", new TimeInstantValidator());
+ fRegistry.put("binary", new BinaryValidator());
+ fRegistry.put("uri", new URIValidator());
//REVISIT - enable the below
- //fRegistry.put("binary", new BinaryValidator());
//fRegistry.put("date", new DateValidator());
//fRegistry.put("timePeriod", new TimePeriodValidator());
//fRegistry.put("time", new TimeValidator());
- //fRegistry.put("uri", new URIValidator());
+
DatatypeValidator v = null;
for (int i = 0; i < integerSubtypeTable.length; i++) {
1.2 +119 -36 xml-xerces/java/src/org/apache/xerces/validators/schema/datatypes.dtd
Index: datatypes.dtd
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/datatypes.dtd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- datatypes.dtd 1999/11/09 01:11:39 1.1
+++ datatypes.dtd 2000/01/29 00:26:59 1.2
@@ -1,39 +1,122 @@
-<!-- Note that the expansion of 'facets' below is less
- restrictive than that imposed by the XML Schema schema for
- datatypes: There should in fact be no more than one of each of
+<!-- DTD for XML Schemas: Part 2: Datatypes -->
+<!-- $Id: datatypes.dtd,v 1.2 2000/01/29 00:26:59 twl Exp $ -->
+<!-- Note this DTD is NOT the normative datatypes DTD - - the
+ prose copy in the datatypes REC is the normative version (which
+ shouldn't differ from this one except for this comment and entity
+ expansions, but just in case -->
+<!ENTITY % p ''> <!-- can be overriden in the internal subset of a
+ schema document to establish a namespace prefix -->
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % datatype "%p;datatype">
+<!ENTITY % maxExclusive "%p;maxExclusive">
+<!ENTITY % minExclusive "%p;minExclusive">
+<!ENTITY % maxInclusive "%p;maxInclusive">
+<!ENTITY % minInclusive "%p;minInclusive">
+<!ENTITY % precision "%p;precision">
+<!ENTITY % scale "%p;scale">
+<!ENTITY % length "%p;length">
+<!ENTITY % minlength "%p;minlength">
+<!ENTITY % maxlength "%p;maxlength">
+<!ENTITY % enumeration "%p;enumeration">
+<!ENTITY % pattern "%p;pattern">
+<!ENTITY % encoding "%p;encoding">
+<!ENTITY % period "%p;period">
+
+<!-- annotation elements -->
+<!ENTITY % annotation "%p;annotation">
+<!ENTITY % appinfo "%p;appinfo">
+<!ENTITY % info "%p;info">
+
+
+<!-- Define some entities for informative use as attribute types -->
+<!ENTITY % URI "CDATA">
+<!ENTITY % URIList "CDATA">
+<!ENTITY % QName "CDATA">
+<!ENTITY % NCName "NMTOKEN">
+<!ENTITY % non-negative-integer "NMTOKEN">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % derivationChoice "(restriction|extension)">
+<!ENTITY % derivationSet "CDATA">
+ <!-- #all or space-separated list drawn from derivationChoice -->
+<!ENTITY % exactSet "CDATA">
+ <!-- #all or space-separated list drawn from
+ derivationChoice + 'equivClass' -->
+
+<!-- Note that the use of 'facet' below is less restrictive than is
+ really intended: There should in fact be no more than one of each of
minInclusive, minExclusive, maxInclusive, maxExclusive,
- precision, scale, lexicalRepresentation, enumeration,
- length, maxLength within datatype -->
-<!ENTITY % minBound '(minInclusive | minExclusive)'>
-<!ENTITY % maxBound '(maxInclusive | maxExclusive)'>
+ precision, scale,
+ length, maxlength, minlength, encoding, period within datatype,
+ and the min- and max- variants of Inclusive and Exclusive are
+ mutually exclusive.
+ On the other hand, pattern and enumeration may repeat -->
+<!ENTITY % minBound '(%minInclusive; | %minExclusive;)'>
+<!ENTITY % maxBound '(%maxInclusive; | %maxExclusive;)'>
<!ENTITY % bounds '%minBound; | %maxBound;'>
-<!ENTITY % numeric 'precision | scale'>
-<!ENTITY % ordered '%bounds; | %numeric;'>
+<!ENTITY % numeric '%precision; | %scale;'>
+<!ENTITY % ordered '%bounds; | %numeric;'>
<!ENTITY % unordered
- 'lexicalRepresentation | enumeration | length | maxLength'>
-<!ENTITY % facets '%ordered; | %unordered;'>
-<!ELEMENT datatype (basetype, (%facets;)*)>
-<!ATTLIST datatype
- name NMTOKEN #REQUIRED
- export (true|false) 'true'>
-
-<!ELEMENT basetype EMPTY>
-<!ATTLIST basetype
- name NMTOKEN #REQUIRED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED>
-
-<!ELEMENT maxExclusive (#PCDATA)>
-<!ELEMENT minExclusive (#PCDATA)>
-<!ELEMENT maxInclusive (#PCDATA)>
-<!ELEMENT minInclusive (#PCDATA)>
-
-<!ELEMENT precision (#PCDATA)>
-<!ELEMENT scale (#PCDATA)>
-
-<!ELEMENT length (#PCDATA)>
-<!ELEMENT maxLength (#PCDATA)>
-<!ELEMENT enumeration (literal)+>
-<!ELEMENT literal (#PCDATA)>
-<!ELEMENT lexicalRepresentation (lexical)+>
-<!ELEMENT lexical (#PCDATA)>
+ '%pattern; | %enumeration; | %length; | %maxlength; | %minlength;
+ | %encoding; | %period;'>
+<!ENTITY % facet '%ordered; | %unordered;'>
+<!ENTITY % facetAttr 'value CDATA #REQUIRED'>
+<!ENTITY % facetModel '(%annotation;)?'>
+<!ELEMENT %datatype; ((%annotation;)?,(%facet;)*)>
+<!ATTLIST %datatype;
+ name %NCName; #IMPLIED
+ source %QName; #REQUIRED
+ final %derivationSet; ''
+ abstract %boolean; 'false'>
+<!-- name is required at top level -->
+
+<!ELEMENT %maxExclusive; %facetModel;>
+<!ATTLIST %maxExclusive; %facetAttr;>
+<!ELEMENT %minExclusive; %facetModel;>
+<!ATTLIST %minExclusive; %facetAttr;>
+
+<!ELEMENT %maxInclusive; %facetModel;>
+<!ATTLIST %maxInclusive; %facetAttr;>
+<!ELEMENT %minInclusive; %facetModel;>
+<!ATTLIST %minInclusive; %facetAttr;>
+
+<!ELEMENT %precision; %facetModel;>
+<!ATTLIST %precision; %facetAttr;>
+<!ELEMENT %scale; %facetModel;>
+<!ATTLIST %scale; %facetAttr;>
+
+<!ELEMENT %length; %facetModel;>
+<!ATTLIST %length; %facetAttr;>
+<!ELEMENT %minlength; %facetModel;>
+<!ATTLIST %minlength; %facetAttr;>
+<!ELEMENT %maxlength; %facetModel;>
+<!ATTLIST %maxlength; %facetAttr;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %enumeration; %facetModel;>
+<!ATTLIST %enumeration; %facetAttr;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %pattern; %facetModel;>
+<!ATTLIST %pattern; %facetAttr;>
+
+<!ELEMENT %encoding; %facetModel;>
+<!ATTLIST %encoding; %facetAttr;>
+<!ELEMENT %period; %facetModel;>
+<!ATTLIST %period; %facetAttr;>
+
+<!-- Annotation is either application information or documentation -->
+<!-- By having these here they are available for datatypes as well
+ as all the structures elements -->
+
+<!ELEMENT %annotation; (%appinfo; | %info;)*>
+
+<!-- User must define annotation elements in internal subset for this
+ to work -->
+<!ELEMENT %appinfo; ANY> <!-- too restrictive -->
+<!ATTLIST %appinfo;
+ source %URI; #IMPLIED>
+<!ELEMENT %info; ANY> <!-- too restrictive -->
+<!ATTLIST %info;
+ source %URI; #IMPLIED
+ xml:lang CDATA #IMPLIED>
1.2 +250 -203 xml-xerces/java/src/org/apache/xerces/validators/schema/structures.dtd
Index: structures.dtd
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/structures.dtd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- structures.dtd 1999/11/09 01:11:40 1.1
+++ structures.dtd 2000/01/29 00:26:59 1.2
@@ -1,220 +1,267 @@
-<!-- $Id: structures.dtd,v 1.1 1999/11/09 01:11:40 twl Exp $ -->
-<!ELEMENT schema ((import*, include*, export?,
- (comment | datatype | archetype | element
- | attrGroup | modelGroup | notation
- | textEntity | externalEntity | unparsedEntity)* ))>
-<!ATTLIST schema
- targetNS CDATA #IMPLIED
- version CDATA #IMPLIED
- xmlns CDATA 'http://www.w3.org/XML/Group/1999/09/23-xmlschema/'
- model (open|refinable|closed) 'closed' >
-
-<!ELEMENT import (component*) >
-
-<!ATTLIST import
- schemaAbbrev NMTOKEN #REQUIRED
- schemaName CDATA #REQUIRED
- datatypes (true|false) 'true'
- archetypes (true|false) 'true'
- elements (true|false) 'true'
- attrGroups (true|false) 'true'
- modelGroups (true|false) 'true'
- entities (true|false) 'true'
- notations (true|false) 'true' >
-
-<!ELEMENT component EMPTY >
-<!ATTLIST component name NMTOKEN #REQUIRED
- type (datatype|archetype|element|attrGroup|modelGroup|
- entity|notation) #REQUIRED>
-
-<!ELEMENT export EMPTY >
-<!ATTLIST export
- datatypes (true|false) 'true'
- archetypes (true|false) 'true'
- elements (true|false) 'true'
- attrGroups (true|false) 'true'
- modelGroups (true|false) 'true'
- entities (true|false) 'true'
- notations (true|false) 'true' >
-
-<!ELEMENT include (component*) >
-
-<!ATTLIST include
- schemaName CDATA #REQUIRED
- datatypes (true|false) 'true'
- archetypes (true|false) 'true'
- elements (true|false) 'true'
- attrGroups (true|false) 'true'
- modelGroups (true|false) 'true'
- entities (true|false) 'true'
- notations (true|false) 'true' >
-
-
-<!-- -->
-<!-- comments contain text -->
-<!-- -->
-<!ELEMENT comment (#PCDATA) >
-
-<!-- The datatype element is defined in XML Schema: Part 2: Datatypes -->
-<!-- for publication:
- http://www.w3.org/1999/05/06-xmlschema/datatypes.dtd -->
+<!-- DTD for XML Schemas: Part 1: Structures -->
+<!-- $Id: structures.dtd,v 1.2 2000/01/29 00:26:59 twl Exp $ -->
+<!-- Note this DTD is NOT the normative structures DTD - - the
+ prose copy in the structures REC is the normative version (which
+ shouldn't differ from this one except for this comment and entity
+ expansions, but just in case -->
+<!ENTITY % versionEntities SYSTEM "versionInfo.ent">
+%versionEntities; <!-- get path and date entities -->
+
+<!-- The the datatype element and its components
+ are defined in XML Schema: Part 2: Datatypes -->
+<!-- Note %p is defined in datatypes.dtd -->
<!ENTITY % xs-datatypes PUBLIC 'datatypes'
- '../datatypes/datatypes.dtd' >
+ "http://www.w3.org/TR/1999/WD-xmlschema-2-19991217/datatypes.dtd" >
%xs-datatypes;
-<!-- -->
-<!-- an archetype is a named content type specification with attribute
+<!ENTITY % s ''> <!-- if %p is defined (e.g. as foo:) then you must
+ also define %s as the suffix for the appropriate
+ namespace declaration (e.g. :foo) -->
+<!ENTITY % nds 'xmlns%s;'>
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % schema "%p;schema">
+<!ENTITY % type "%p;type">
+<!ENTITY % restrictions "%p;restrictions">
+<!ENTITY % element "%p;element">
+<!ENTITY % unique "%p;unique">
+<!ENTITY % key "%p;key">
+<!ENTITY % keyref "%p;keyref">
+<!ENTITY % selector "%p;selector">
+<!ENTITY % field "%p;field">
+<!ENTITY % group "%p;group">
+<!ENTITY % any "%p;any">
+<!ENTITY % anyAttribute "%p;anyAttribute">
+<!ENTITY % sic "%p;sic">
+<!ENTITY % attribute "%p;attribute">
+<!ENTITY % attributeGroup "%p;attributeGroup">
+<!ENTITY % include "%p;include">
+<!ENTITY % import "%p;import">
+<!ENTITY % notation "%p;notation">
+
+<!-- the duplication below is to produce an unambiguous content model
+ which allows annotation everywhere -->
+<!-- This has the unfortunate consequence of disallowing a schema with
+ only import/includes, this should be fixed -->
+<!ELEMENT %schema; ((%include; | %import; | %annotation;)*,
+ (%datatype; | %type;
+ | %element;
+ | %attributeGroup; | %group;
+ | %notation; ),
+ (%annotation;
+ | %datatype; | %type;
+ | %element;
+ | %attributeGroup; | %group;
+ | %notation;
+ | %unique; | %key; | %keyref; )* )>
+<!ATTLIST %schema;
+ targetNamespace %URI; #IMPLIED
+ version CDATA #IMPLIED
+ %nds; %URI; #FIXED '&XMLSchemaNS;'
+ finalDefault %derivationSet; ''
+ exactDefault %exactSet; ''>
+<!-- Note the xmlns declaration is NOT in the Schema for Schemas,
+ because at the Infoset level where schemas operate,
+ xmlns(:prefix) is NOT an attribute! -->
+
+
+<!-- a type is a named content type specification which allows attribute
declarations-->
<!-- -->
-<!ELEMENT archetype (refines*,
- ((element|group|modelGroupRef)*|datatypeQual?),
- (attribute|attrGroupRef)*)>
-
-<!-- note that datatypeQual only if type attr present -->
-
-<!ATTLIST archetype
- name NMTOKEN #IMPLIED
- content (elemOnly|textOnly|mixed|empty|any) 'elemOnly'
- model (open|refinable|closed) #IMPLIED
- order (choice|seq|all) 'seq'
- type NMTOKEN #IMPLIED
- default CDATA #IMPLIED
- fixed CDATA #IMPLIED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED >
-
-<!-- Note that schemaAbbrev/Name, default|fixed only if type,
- type iff content='textOnly', in which case must name a datatype -->
-<!-- Note that if order is 'all', group/groupRef is not allowed -->
-
-<!ELEMENT refines EMPTY>
-<!ATTLIST refines
- name NMTOKEN #REQUIRED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED >
+<!ELEMENT %type; ((%annotation;)?,
+ (%restrictions; |
+ ((%element;| %group;| %any;)*,
+ (%attribute;| %attributeGroup;)*,
+ (%anyAttribute;)?)))>
+
+<!ATTLIST %type;
+ name %NCName; #IMPLIED
+ content (textOnly|mixed|elementOnly|empty) #IMPLIED
+ abstract %boolean; 'false'
+ final %derivationSet; ''
+ exact %derivationSet; ''
+ derivedBy %derivationChoice; #IMPLIED
+ source %QName; #IMPLIED>
+
+<!-- restrictions iff derivedBy='restriction' -->
+<!-- (element|group|any) only if content=mixed or =elementOnly
+ and NO derivedBy at all, i.e. a root type -->
+<!-- content defaults to source's if there is a complex source,
+ textonly if there's a simple source,
+ 'mixed' if no source (because that's the urType's content)
+ and no content daughters,
+ 'elementOnly' otherwise -->
+<!-- should we replace content='empty' with content='elementOnly'
+ final='#all' plus no content? -->
+
+<!-- If one top-level group, that IS the content model, otherwise
+ an implicit group obtains.
+ This is
+ <group order='seq' minOccurs='1' maxOccurs='1'>
+ unless content='mixed', in which case it's
+ <group order='choice' minOccurs='0' maxOccurs='*'> -->
+
+<!-- If anyAttribute appears in one or more referenced attributeGroups
+ and/or explicitly, the intersection of the permissions is used -->
+
+<!-- A text-only type with no attributes differs from a datatype with
+ the same source qualified the same way in regard to the impact on
+ attributes of anyAttribute -->
+
+<!ELEMENT %restrictions; ((%annotation;)?,
+ ((%facet;)*|
+ (%element;| %group;| %any;| %sic;)*),
+ (%attribute;| %attributeGroup;)*,
+ (%anyAttribute;)?)>
+
+<!-- this contains material for restricting components of inherited types -->
+<!-- (element|group|any|sic) allowed only if source refers to an
+ elementOnly or mixed type, the sequence and GI must match point for
+ point with (an initial sub-sequence of) the content model of
+ the basetype, restricting in each case, except that 'sic' is
+ allowed to "copy through" a single particle.
+ Only the top-level content model can be restricted,
+ e.g. the content model of an anonymous embedded 'type' within
+ an 'element' particle cannot be restricted piecemeal. -->
+<!-- attributes to be restricted are identified by name, without order
+ constraints.
+ Attributes incorporated into sources via attributeGroups may be
+ restricted by name. -->
+<!-- If anyAttribute appears in one or more referenced attributeGroups
+ and/or explicitly, the intersection of the permissions with the
+ inherited permission (which must exist) is used -->
-<!-- -->
+<!-- facets are allowed only if source refers to a textonly type -->
+
<!-- an element is declared by either:
a name and a type (either nested or referenced via the type attribute)
or:
- a ref to an existing element declaration -->
-<!-- -->
-<!ELEMENT element ((archetype|datatype)?)>
-<!-- archetype or datatype only if no type|ref|archRef attribute -->
-<!-- ref|archRef not allowed at top level -->
-<!ATTLIST element
- name NMTOKEN #IMPLIED
- ref NMTOKEN #IMPLIED
- archRef NMTOKEN #IMPLIED
- type NMTOKEN #IMPLIED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED
- minOccurs CDATA '1'
- maxOccurs CDATA #IMPLIED
- export (true|false) 'true'
- default CDATA #IMPLIED
- fixed CDATA #IMPLIED>
-<!-- type, ref and archRef are mutually exclusive. schemaName/Abbrev applies
- to whichever is there, not allowed if neither.
- If name is absent, ref is required -->
-<!-- maxOccurs defaults to 1 or minOccurs, whichever is greater -->
-
-<!ELEMENT group (element|group|modelGroupRef)+>
-<!ATTLIST group
- name NMTOKEN #IMPLIED
- collection (no|list) 'no'
- minOccurs CDATA '1'
- maxOccurs CDATA #IMPLIED
- order (choice|seq|all) 'seq' >
-<!-- Note that if order is 'all', group/groupRef is not allowed -->
-
-<!-- -->
-<!-- a model group is a named content model (without attributes) -->
-<!-- -->
-<!ELEMENT modelGroup (element|group|modelGroupRef)+ >
-<!ATTLIST modelGroup
- name NMTOKEN #REQUIRED
- order (choice|seq|all) 'seq'
- export (true|false) 'true' >
-<!-- Note that if order is 'all', group/groupRef is not allowed -->
-
-<!ELEMENT modelGroupRef EMPTY >
-<!ATTLIST modelGroupRef
- name NMTOKEN #REQUIRED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED
- minOccurs CDATA '1'
- maxOccurs CDATA #IMPLIED >
+ a ref to an existing element declaration -->
-<!-- the entity reference below is discharged in datatypes.dtd -->
-<!ELEMENT datatypeQual (%facets;)*>
+<!ELEMENT %element; ((%annotation;)?, (%type;| %datatype;)?,
+ (%unique; | %key; | %keyref;)*)>
+<!-- type or datatype only if no type|ref attribute -->
+<!-- ref not allowed at top level -->
+<!ATTLIST %element;
+ name %NCName; #IMPLIED
+ ref %QName; #IMPLIED
+ type %QName; #IMPLIED
+ minOccurs %non-negative-integer; '1'
+ maxOccurs CDATA #IMPLIED
+ nullable %boolean; 'false'
+ equivClass %QName; #IMPLIED
+ abstract %boolean; 'false'
+ final %boolean; 'false'
+ exact %exactSet; ''
+ default CDATA #IMPLIED
+ fixed CDATA #IMPLIED>
+<!-- type and ref are mutually exclusive.
+ name and ref are mutually exculsive, one is required -->
+<!-- In the absence of type AND ref, type defaults to type of
+ equivClass, if any, else the ur-type, i.e. unconstrained -->
+<!-- maxOccurs defaults to 1 or minOccurs, whichever is greater -->
+<!-- default and fixed are mutually exclusive -->
-<!-- -->
-<!-- an attribute declaration names an attribute specification -->
-<!-- -->
-<!ELEMENT attribute (%facets;)*>
-<!ATTLIST attribute
- name NMTOKEN #REQUIRED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED
- type CDATA 'string'
- maxOccurs CDATA #FIXED '1'
- minOccurs (0|1) '0'
- default CDATA #IMPLIED
- fixed CDATA #IMPLIED>
-
-<!-- an attrGroup is a named collection of attribute decls -->
-<!ELEMENT attrGroup (attribute | attrGroupRef)+ >
-<!ATTLIST attrGroup
- name NMTOKEN #REQUIRED
- export (true|false) 'true' >
-
-<!ELEMENT attrGroupRef EMPTY >
-<!ATTLIST attrGroupRef
- name NMTOKEN #REQUIRED
- schemaAbbrev NMTOKEN #IMPLIED
- schemaName CDATA #IMPLIED >
-
-<!-- -->
-<!-- Entities and notations in XML Schema -->
-<!-- -->
-
-<!-- a textEntity can be referenced in documents of this type -->
-<!ELEMENT textEntity (#PCDATA) >
-<!ATTLIST textEntity
- name NMTOKEN #REQUIRED
- export (true|false) #FIXED 'true' >
-
-<!-- an externalEntity can be referenced in documents of this type -->
-<!ELEMENT externalEntity EMPTY >
-<!ATTLIST externalEntity
- name NMTOKEN #REQUIRED
- export (true|false) #FIXED 'true'
- public CDATA #IMPLIED
- system CDATA #REQUIRED
- notation NMTOKEN #FIXED 'XML'>
-
-<!-- declares notation to be a 1st class element or entity content types -->
-<!ELEMENT notation EMPTY >
-<!ATTLIST notation
- name NMTOKEN #REQUIRED
- export (true|false) #FIXED 'true'
+<!ELEMENT %group; ((%annotation;)?, (%element;| %group;| %any;)*)>
+<!ATTLIST %group;
+ minOccurs %non-negative-integer; '1'
+ maxOccurs CDATA #IMPLIED
+ order (choice|seq|all) 'seq'
+ name %NCName; #IMPLIED
+ ref %QName; #IMPLIED>
+
+
+<!-- an anonymous grouping in a model, or
+ a top-level named group definition, or a reference to same -->
+
+<!-- Note that if order is 'all', group is not allowed inside.
+ If order is 'all' THIS group must be alone (or referenced alone) at
+ the top level of a content model -->
+<!-- If order is 'all', minOccurs==maxOccurs==1 on element/any inside -->
+<!-- Should allow minOccurs=0 inside order='all' . . . -->
+
+<!ELEMENT %any; EMPTY>
+<!ATTLIST %any;
+ namespace CDATA '##any'
+ minOccurs %non-negative-integer; '1'
+ maxOccurs CDATA #IMPLIED>
+
+<!-- namespace is interpreted as follows:
+ ##any - - any non-conflicting WFXML at all
+
+ ##other - - any non-conflicting WFXML from namespace other
+ than targetNamespace
+
+ one or - - any non-conflicting WFXML from
+ more URI the listed namespaces
+ references
+
+ ##targetNamespace may appear in the above list, with the
+ obvious meaning -->
+
+<!ELEMENT %anyAttribute; EMPTY>
+<!ATTLIST %anyAttribute;
+ namespace CDATA '##any'>
+<!-- namespace is interpreted as for 'any' above -->
+
+
+<!-- for use inside basetype to copy down corresponding content
+ model particle from the basetype's content model -->
+<!ELEMENT %sic; EMPTY>
+
+<!ELEMENT %attribute; ((%annotation;)?, (%datatype;)?)>
+<!ATTLIST %attribute;
+ name %NCName; #REQUIRED
+ type %QName; #IMPLIED
+ maxOccurs (0|1) '1'
+ minOccurs (0|1) '0'
+ default CDATA #IMPLIED
+ fixed CDATA #IMPLIED>
+<!-- default and fixed are mutually exclusive -->
+<!-- type attr and datatype content are mutually exclusive -->
+
+<!-- an attributeGroup is a named collection of attribute decls, or a
+ reference thereto -->
+<!ELEMENT %attributeGroup; ((%annotation;)?,
+ (%attribute; | %attributeGroup;)*,
+ (%anyAttribute;)?) >
+<!ATTLIST %attributeGroup;
+ name %NCName; #IMPLIED
+ ref %QName; #IMPLIED>
+
+<!-- ref iff no content, no name. ref iff not top level -->
+
+<!-- better reference mechanisms -->
+<!ELEMENT %unique; (%selector;, (%field;)+)>
+<!ATTLIST %unique; name %NCName; #REQUIRED>
+
+<!ELEMENT %key; (%selector;, (%field;)+)>
+<!ATTLIST %key; name %NCName; #REQUIRED>
+
+<!ELEMENT %keyref; (%selector;, (%field;)+)>
+<!ATTLIST %keyref;
+ name %NCName; #REQUIRED
+ refer %QName; #REQUIRED>
+
+<!ELEMENT %selector; (#PCDATA)>
+<!ELEMENT %field; (#PCDATA)>
+
+<!-- Schema combination mechanisms -->
+<!ELEMENT %include; EMPTY>
+<!ATTLIST %include; schemaLocation %URI; #REQUIRED>
+
+<!ELEMENT %import; EMPTY>
+<!ATTLIST %import; namespace %URI; #REQUIRED
+ schemaLocation %URI; #IMPLIED>
+
+<!ELEMENT %notation; EMPTY>
+<!ATTLIST %notation;
+ name %NCName; #REQUIRED
public CDATA #REQUIRED
- system CDATA #IMPLIED>
-
-<!-- an unparsedEntity can be referenced in documents of this type -->
-<!ELEMENT unparsedEntity EMPTY >
-<!ATTLIST unparsedEntity
- name NMTOKEN #REQUIRED
- export (true|false) #FIXED 'true'
- public CDATA #IMPLIED
- system CDATA #REQUIRED
- notation NMTOKEN #REQUIRED >
+ system %URI; #IMPLIED>
-<!--
<!NOTATION XMLSchemaStructures PUBLIC 'structures'
- 'http://www.w3.org/1999/09/23-xmlschema/structures/structures.xsd' >
+ '&XSP1.URI;.xsd' >
<!NOTATION XML PUBLIC 'REC-xml-1998-0210'
'http://www.w3.org/TR/1998/REC-xml-19980210' >
--->
1.1 xml-xerces/java/src/org/apache/xerces/validators/schema/versionInfo.ent
Index: versionInfo.ent
===================================================================
<!-- Path and date information for XML Schema recommendation documents -->
<!-- $Id: versionInfo.ent,v 1.1 2000/01/29 00:26:59 twl Exp $ -->
<!ENTITY draft.year "1999">
<!ENTITY draft.YY "1999">
<!ENTITY draft.month "December">
<!ENTITY draft.MM "12">
<!ENTITY draft.day "17">
<!ENTITY draft.DD "17">
<!ENTITY draft.base "http://www.w3.org/TR/1999/WD-xmlschema">
<!ENTITY WD-XSP1 "structures">
<!ENTITY XSP1.base "&draft.base;-1-&draft.YY;&draft.MM;&draft.DD;">
<!ENTITY XSP1.URI "&XSP1.base;/structures">
<!ENTITY WD-XSP2 "datatypes">
<!ENTITY XSP2.base "&draft.base;-2-&draft.YY;&draft.MM;&draft.DD;">
<!ENTITY XSP2.URI "&XSP2.base;/datatypes">
<!ENTITY XMLSchemaNS "http://www.w3.org/1999/XMLSchema">
<!ENTITY % reldatadtd "../WD-xmlschema-2-19991217/datatypes.dtd">