You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by da...@apache.org on 2004/01/23 23:36:08 UTC
cvs commit: xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/schema StscTranslator.java
daveremy 2004/01/23 14:36:08
Modified: v1/src/typeimpl/org/apache/xmlbeans/impl/schema Tag:
xmlbeans-1-0-1_branch StscTranslator.java
Log:
Submitted by: Kevin Krouse
Reviewed by: David Bau
Add a warning for nillable, etc. on a element reference.
DRTs: passed
Revision Changes Path
No revision
No revision
1.2.2.1 +34 -3 xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java
Index: StscTranslator.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- StscTranslator.java 24 Sep 2003 23:31:07 -0000 1.2
+++ StscTranslator.java 23 Jan 2004 22:36:08 -0000 1.2.2.1
@@ -458,6 +458,8 @@
/**
* Translates a local or global schema element.
*/
+ // check rule 3.3.3
+ // http://www.w3c.org/TR/#section-Constraints-on-XML-Representations-of-Element-Declarations
public static SchemaLocalElementImpl translateElement(
Element xsdElt, String targetNamespace, boolean chameleon,
List anonymousTypes, SchemaType outerType)
@@ -480,7 +482,6 @@
QName ref = xsdElt.getRef();
-
if (ref != null && name != null)
{
// if (name.equals(ref.getLocalPart()) && uriMatch(targetNamespace, ref.getNamespaceURI()))
@@ -506,14 +507,44 @@
{
if (xsdElt.getType() != null || xsdElt.getSimpleType() != null || xsdElt.getComplexType() != null)
{
- state.error("Element reference cannot also specify a type", XmlErrorContext.INVALID_NAME, xsdElt.xgetName());
+ state.error("Element reference cannot also specify a type", XmlErrorContext.INVALID_NAME, xsdElt);
// recovery: let the name go through anyway.
}
if (xsdElt.getForm() != null)
{
- state.error("Element reference cannot also specify form", XmlErrorContext.INVALID_NAME, xsdElt.xgetName());
+ state.error("Element reference cannot also specify form", XmlErrorContext.INVALID_NAME, xsdElt);
// recovery: let the name go through anyway.
+ }
+
+ if (xsdElt.sizeOfKeyArray() > 0 || xsdElt.sizeOfKeyrefArray() > 0 || xsdElt.sizeOfUniqueArray() > 0)
+ {
+ state.warning("Element reference cannot also contain key, keyref, or unique", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetDefault())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify default", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetFixed())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify fixed", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetBlock())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify block", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetNillable())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify nillable", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
}
assert(xsdElt instanceof LocalElement);
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org