[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: svn commit: r658446 - in /xerces/java/trunk/src/org/apache/xerces/impl:
From: mrglavas () apache ! org
Date: 2008-05-20 21:37:22
Message-ID: 20080520213723.6217C23889F3 () eris ! apache ! org
[Download RAW message or body]
Author: mrglavas
Date: Tue May 20 14:37:22 2008
New Revision: 658446
URL: http://svn.apache.org/viewvc?rev=658446&view=rev
Log:
Fixing JIRA Issue #1308:
http://issues.apache.org/jira/browse/XERCESJ-1308
Somehow we forgot to implement XSObject.getNamespaceItem(). Should be complete and \
working now.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSElementDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSGroupDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSNotationDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/XSWildcardDecl.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java \
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Tue May \
20 14:37:22 2008 @@ -294,6 +294,10 @@
private boolean fFinite;
private boolean fBounded;
private boolean fNumeric;
+
+ // The namespace schema information item corresponding to the target namespace
+ // of the simple type definition, if it is globally declared; or null otherwise.
+ private XSNamespaceItem fNamespaceItem = null;
// default constructor
public XSSimpleTypeDecl(){}
@@ -2931,12 +2935,16 @@
// REVISIT: reset for fundamental facets
}
+
/**
* @see org.apache.xerces.xs.XSObject#getNamespaceItem()
*/
public XSNamespaceItem getNamespaceItem() {
- // REVISIT: implement
- return null;
+ return fNamespaceItem;
+ }
+
+ public void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
}
/**
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Tue May 20 \
14:37:22 2008 @@ -24,6 +24,7 @@
import org.apache.xerces.impl.dv.SchemaDVFactory;
import org.apache.xerces.impl.dv.ValidatedInfo;
import org.apache.xerces.impl.dv.XSSimpleType;
+import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
import org.apache.xerces.impl.xs.identity.IdentityConstraint;
import org.apache.xerces.impl.xs.util.SimpleLocator;
import org.apache.xerces.impl.xs.util.StringListImpl;
@@ -179,6 +180,19 @@
// get all built-in types
fGlobalTypeDecls = schemaFactory.getBuiltInTypes();
+
+ // assign the built-in schema grammar as the XSNamespaceItem
+ // for each of the built-in simple type definitions.
+ int length = fGlobalTypeDecls.getLength();
+ XSTypeDefinition [] typeDefinitions = new XSTypeDefinition[length];
+ fGlobalTypeDecls.getValues(typeDefinitions, 0);
+ for (int i = 0; i < length; ++i) {
+ XSTypeDefinition xtd = typeDefinitions[i];
+ if (xtd instanceof XSSimpleTypeDecl) {
+ ((XSSimpleTypeDecl) xtd).setNamespaceItem(this);
+ }
+ }
+
// add anyType
fGlobalTypeDecls.put(fAnyType.getName(), fAnyType);
}
@@ -262,6 +276,12 @@
public void addGlobalTypeDecl(XSTypeDefinition decl) {
// ignore
}
+ public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl) {
+ // ignore
+ }
+ public void addGlobalSimpleTypeDecl(XSSimpleType decl) {
+ // ignore
+ }
public void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator \
locator) { // ignore
}
@@ -455,6 +475,12 @@
public void addGlobalTypeDecl(XSTypeDefinition decl) {
// ignore
}
+ public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl) {
+ // ignore
+ }
+ public void addGlobalSimpleTypeDecl(XSSimpleType decl) {
+ // ignore
+ }
public void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator \
locator) { // ignore
}
@@ -567,6 +593,7 @@
*/
public void addGlobalAttributeDecl(XSAttributeDecl decl) {
fGlobalAttrDecls.put(decl.fName, decl);
+ decl.setNamespaceItem(this);
}
/**
@@ -574,6 +601,7 @@
*/
public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl) {
fGlobalAttrGrpDecls.put(decl.fName, decl);
+ decl.setNamespaceItem(this);
}
/**
@@ -581,6 +609,7 @@
*/
public void addGlobalElementDecl(XSElementDecl decl) {
fGlobalElemDecls.put(decl.fName, decl);
+ decl.setNamespaceItem(this);
// if there is a substitution group affiliation, store in an array,
// for further constraint checking: UPA, PD, EDC
@@ -596,6 +625,7 @@
*/
public void addGlobalGroupDecl(XSGroupDecl decl) {
fGlobalGroupDecls.put(decl.fName, decl);
+ decl.setNamespaceItem(this);
}
/**
@@ -603,6 +633,7 @@
*/
public void addGlobalNotationDecl(XSNotationDecl decl) {
fGlobalNotationDecls.put(decl.fName, decl);
+ decl.setNamespaceItem(this);
}
/**
@@ -610,6 +641,30 @@
*/
public void addGlobalTypeDecl(XSTypeDefinition decl) {
fGlobalTypeDecls.put(decl.getName(), decl);
+ if (decl instanceof XSComplexTypeDecl) {
+ ((XSComplexTypeDecl) decl).setNamespaceItem(this);
+ }
+ else if (decl instanceof XSSimpleTypeDecl) {
+ ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
+ }
+ }
+
+ /**
+ * register one global complex type
+ */
+ public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl) {
+ fGlobalTypeDecls.put(decl.getName(), decl);
+ decl.setNamespaceItem(this);
+ }
+
+ /**
+ * register one global simple type
+ */
+ public void addGlobalSimpleTypeDecl(XSSimpleType decl) {
+ fGlobalTypeDecls.put(decl.getName(), decl);
+ if (decl instanceof XSSimpleTypeDecl) {
+ ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
+ }
}
/**
@@ -879,6 +934,10 @@
public XSObjectList getAnnotations() {
return null;
}
+
+ public XSNamespaceItem getNamespaceItem() {
+ return SG_SchemaNS;
+ }
}
private static class BuiltinAttrDecl extends XSAttributeDecl {
public BuiltinAttrDecl(String name, String tns,
@@ -898,9 +957,15 @@
public void reset () {
// also ignore this call.
}
+
public XSAnnotation getAnnotation() {
return null;
}
+
+ public XSNamespaceItem getNamespaceItem() {
+ return SG_XSI;
+ }
+
} // class BuiltinAttrDecl
// the grammars to hold components of the schema namespace
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeDecl.java Tue May 20 \
14:37:22 2008 @@ -55,6 +55,9 @@
XSObjectList fAnnotations = null;
// value constraint value
ValidatedInfo fDefault = null;
+ // The namespace schema information item corresponding to the target namespace
+ // of the attribute declaration, if it is globally declared; or null otherwise.
+ private XSNamespaceItem fNamespaceItem = null;
public void setValues(String name, String targetNamespace,
XSSimpleType simpleType, short constraintType, short scope,
@@ -166,12 +169,16 @@
public ValidatedInfo getValInfo() {
return fDefault;
}
+
/**
* @see org.apache.xerces.xs.XSObject#getNamespaceItem()
*/
public XSNamespaceItem getNamespaceItem() {
- // REVISIT: implement
- return null;
+ return fNamespaceItem;
+ }
+
+ void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
}
public Object getActualVC() {
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java \
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java Tue May \
20 14:37:22 2008 @@ -58,6 +58,10 @@
public XSObjectList fAnnotations;
protected XSObjectListImpl fAttrUses = null;
+
+ // The namespace schema information item corresponding to the target namespace
+ // of the attribute group definition, if it is globally declared; or null \
otherwise. + private XSNamespaceItem fNamespaceItem = null;
// add an attribute use
// if the type is derived from ID, but there is already another attribute
@@ -357,12 +361,15 @@
return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
- /**
- * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
- */
- public XSNamespaceItem getNamespaceItem() {
- //REVISIT: implement
- return null;
- }
+ /**
+ * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
+ */
+ public XSNamespaceItem getNamespaceItem() {
+ return fNamespaceItem;
+ }
+
+ void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
+ }
} // class XSAttributeGroupDecl
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java Tue May 20 \
14:37:22 2008 @@ -79,6 +79,10 @@
// list of annotations affiliated with this type
XSObjectListImpl fAnnotations = null;
+
+ // The namespace schema information item corresponding to the target namespace
+ // of the complex type definition, if it is globally declared; or null \
otherwise. + private XSNamespaceItem fNamespaceItem = null;
// DOM Level 3 TypeInfo Derivation Method constants
static final int DERIVATION_ANY = 0;
@@ -691,13 +695,16 @@
return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
- /**
- * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
- */
- public XSNamespaceItem getNamespaceItem() {
- // REVISIT: implement
- return null;
- }
+ /**
+ * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
+ */
+ public XSNamespaceItem getNamespaceItem() {
+ return fNamespaceItem;
+ }
+
+ void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
+ }
/* (non-Javadoc)
* @see org.apache.xerces.xs.XSComplexTypeDefinition#getAttributeUse(java.lang.String, \
java.lang.String)
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSElementDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSElementDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSElementDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSElementDecl.java Tue May 20 \
14:37:22 2008 @@ -73,6 +73,9 @@
static final int INITIAL_SIZE = 2;
int fIDCPos = 0;
IdentityConstraint[] fIDConstraints = new IdentityConstraint[INITIAL_SIZE];
+ // The namespace schema information item corresponding to the target namespace
+ // of the element declaration, if it is globally declared; or null otherwise.
+ private XSNamespaceItem fNamespaceItem = null;
private static final short CONSTRAINT_MASK = 3;
private static final short NILLABLE = 4;
@@ -351,8 +354,11 @@
* @see org.apache.xerces.xs.XSObject#getNamespaceItem()
*/
public XSNamespaceItem getNamespaceItem() {
- // REVISIT: implement
- return null;
+ return fNamespaceItem;
+ }
+
+ void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
}
public Object getActualVC() {
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSGroupDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSGroupDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSGroupDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSGroupDecl.java Tue May 20 \
14:37:22 2008 @@ -39,6 +39,9 @@
public XSModelGroupImpl fModelGroup = null;
// optional annotations
public XSObjectList fAnnotations = null;
+ // The namespace schema information item corresponding to the target namespace
+ // of the model group definition, if it is globally declared; or null otherwise.
+ private XSNamespaceItem fNamespaceItem = null;
/**
* Get the type of the object, i.e ELEMENT_DECLARATION.
@@ -85,12 +88,15 @@
return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
- /**
- * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
- */
- public XSNamespaceItem getNamespaceItem() {
- // REVISIT: implement
- return null;
- }
+ /**
+ * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
+ */
+ public XSNamespaceItem getNamespaceItem() {
+ return fNamespaceItem;
+ }
+
+ void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
+ }
} // class XSGroupDecl
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSNotationDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSNotationDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSNotationDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSNotationDecl.java Tue May 20 \
14:37:22 2008 @@ -45,7 +45,11 @@
public String fSystemId = null;
// optional annotation
- public XSObjectList fAnnotations = null;
+ public XSObjectList fAnnotations = null;
+
+ // The namespace schema information item corresponding to the target namespace
+ // of the notation declaration, if it is globally declared; or null otherwise.
+ private XSNamespaceItem fNamespaceItem = null;
/**
* Get the type of the object, i.e ELEMENT_DECLARATION.
@@ -100,11 +104,15 @@
return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
- /**
- * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
- */
- public XSNamespaceItem getNamespaceItem() {
- return null;
- }
+ /**
+ * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
+ */
+ public XSNamespaceItem getNamespaceItem() {
+ return fNamespaceItem;
+ }
+
+ void setNamespaceItem(XSNamespaceItem namespaceItem) {
+ fNamespaceItem = namespaceItem;
+ }
} // class XSNotationDecl
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSWildcardDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSWildcardDecl.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSWildcardDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSWildcardDecl.java Tue May 20 \
14:37:22 2008 @@ -586,12 +586,11 @@
return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
- /**
- * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
- */
- public XSNamespaceItem getNamespaceItem() {
- // REVISIT: implement
- return null;
- }
+ /**
+ * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
+ */
+ public XSNamespaceItem getNamespaceItem() {
+ return null;
+ }
} // class XSWildcardDecl
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java \
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java \
Tue May 20 14:37:22 2008 @@ -165,7 +165,7 @@
if (complexTypeName == null) {
reportSchemaError("s4s-att-must-appear", new \
Object[]{SchemaSymbols.ELT_COMPLEXTYPE, SchemaSymbols.ATT_NAME}, complexTypeNode); } \
else {
- grammar.addGlobalTypeDecl(type);
+ grammar.addGlobalComplexTypeDecl(type);
}
// need to add the type to the grammar for later constraint checking
grammar.addComplexTypeDecl(type, \
fSchemaHandler.element2Locator(complexTypeNode));
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java?rev=658446&r1=658445&r2=658446&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java \
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java \
Tue May 20 14:37:22 2008 @@ -112,7 +112,7 @@
// don't add global components without name to the grammar
if (type != null) {
- grammar.addGlobalTypeDecl(type);
+ grammar.addGlobalSimpleTypeDecl(type);
}
return type;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic