Author: mukulg
Date: Mon Mar 28 15:27:49 2011
New Revision: 1086271
URL: http://svn.apache.org/viewvc?rev=1086271&view=rev
Log:
committing few improvements to inheritable attributes processing. now doing
some of its computations in XMLSchemaValidator instead of
XSDTypeAlternativeValidator, which helps us in setting the [inherited
attributes] PSVI results for element information items (ref
http://www.w3.org/TR/xmlschema11-1/#Inherited_attributes, PSVI Contributions
for element information items -> [inherited attributes]). inherited attributes
processing in CTA behave as earlier, but codebase of that has changed slightly.
as a consequence of this change, PSVI results for element information items ->
[inherited attributes] is now implemented which seems to be working fine.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/PSVIElementNSImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/ElementPSVImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ElementPSVI.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSAttributeUse.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/PSVIElementNSImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/PSVIElementNSImpl.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/PSVIElementNSImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/PSVIElementNSImpl.java
Mon Mar 28 15:27:49 2011
@@ -29,6 +29,7 @@ import org.apache.xerces.xs.ElementPSVI;
import org.apache.xerces.xs.ItemPSVI;
import org.apache.xerces.xs.ShortList;
import org.apache.xerces.xs.StringList;
+import org.apache.xerces.xs.XSAttributeUse;
import org.apache.xerces.xs.XSComplexTypeDefinition;
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.XSModel;
@@ -106,6 +107,9 @@ public class PSVIElementNSImpl extends E
/** the schema information property */
protected XSModel fSchemaInformation = null;
+ /** inherited attributes **/
+ protected XSAttributeUse[] fInheritedAttributes = null;
+
//
// ElementPSVI methods
//
@@ -267,6 +271,15 @@ public class PSVIElementNSImpl extends E
}
/**
+ * Inherited attributes.
+ *
+ * @return an array of inherited attribute, XSAttributeUse components.
null if no inherited attributes were found.
+ */
+ public XSAttributeUse[] getInheritedAttributes() {
+ return fInheritedAttributes;
+ }
+
+ /**
* Copy PSVI properties from another psvi item.
*
* @param elem the source of element PSVI items
@@ -291,6 +304,7 @@ public class PSVIElementNSImpl extends E
}
this.fSpecified = elem.getIsSchemaSpecified();
this.fNil = elem.getNil();
+ this.fInheritedAttributes = elem.getInheritedAttributes();
}
/* (non-Javadoc)
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/ElementPSVImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/ElementPSVImpl.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/ElementPSVImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/ElementPSVImpl.java
Mon Mar 28 15:27:49 2011
@@ -23,6 +23,7 @@ import org.apache.xerces.xs.ElementPSVI;
import org.apache.xerces.xs.ItemPSVI;
import org.apache.xerces.xs.ShortList;
import org.apache.xerces.xs.StringList;
+import org.apache.xerces.xs.XSAttributeUse;
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.XSModel;
import org.apache.xerces.xs.XSNotationDeclaration;
@@ -88,6 +89,9 @@ public class ElementPSVImpl implements E
/** true if this object is immutable **/
protected boolean fIsConstant;
+ /** inherited attributes **/
+ protected XSAttributeUse[] fInheritedAttributes = null;
+
public ElementPSVImpl() {}
public ElementPSVImpl(boolean isConstant, ElementPSVI elementPSVI) {
@@ -100,6 +104,7 @@ public class ElementPSVImpl implements E
fValidationAttempted = elementPSVI.getValidationAttempted();
fValidity = elementPSVI.getValidity();
fValidationContext = elementPSVI.getValidationContext();
+ fInheritedAttributes = elementPSVI.getInheritedAttributes();
if (elementPSVI instanceof ElementPSVImpl) {
final ElementPSVImpl elementPSVIImpl = (ElementPSVImpl)
elementPSVI;
fErrors = (elementPSVIImpl.fErrors != null) ?
@@ -318,6 +323,15 @@ public class ElementPSVImpl implements E
}
/**
+ * Inherited attributes.
+ *
+ * @return an array of inherited attribute, XSAttributeUse components.
null if no inherited attributes were found.
+ */
+ public XSAttributeUse[] getInheritedAttributes() {
+ return fInheritedAttributes;
+ }
+
+ /**
* Reset() should be called in validator startElement(..) method.
*/
public void reset() {
@@ -331,6 +345,7 @@ public class ElementPSVImpl implements E
fErrors = null;
fValidationContext = null;
fValue.reset();
+ fInheritedAttributes = null;
}
public void copySchemaInformationTo(ElementPSVImpl target) {
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Mon Mar 28 15:27:49 2011
@@ -51,6 +51,7 @@ import org.apache.xerces.impl.xs.identit
import org.apache.xerces.impl.xs.models.CMBuilder;
import org.apache.xerces.impl.xs.models.CMNodeFactory;
import org.apache.xerces.impl.xs.models.XSCMValidator;
+import org.apache.xerces.impl.xs.util.XSObjectListImpl;
import org.apache.xerces.impl.xs.util.XSTypeHelper;
import org.apache.xerces.util.AugmentationsImpl;
import org.apache.xerces.util.IntStack;
@@ -81,6 +82,8 @@ import org.apache.xerces.xs.AttributePSV
import org.apache.xerces.xs.ElementPSVI;
import org.apache.xerces.xs.ShortList;
import org.apache.xerces.xs.StringList;
+import org.apache.xerces.xs.XSAttributeDeclaration;
+import org.apache.xerces.xs.XSAttributeUse;
import org.apache.xerces.xs.XSConstants;
import org.apache.xerces.xs.XSObjectList;
import org.apache.xerces.xs.XSSimpleTypeDefinition;
@@ -1365,6 +1368,12 @@ public class XMLSchemaValidator
// 'type alternative' validator subcomponent
private XSDTypeAlternativeValidator fTypeAlternativeValidator = null;
+
+ // a Vector list storing inheritable attributes
+ private Vector fInheritableAttrList = new Vector();
+
+ // a Stack storing inheritable attribute count for the elements
+ private IntStack fInhrAttrCountStack = new IntStack();
//
// Constructors
@@ -2177,7 +2186,7 @@ public class XMLSchemaValidator
//process type alternatives
if (fTypeAlternativesChecking && fCurrentElemDecl != null) {
- XSTypeDefinition currentType =
fTypeAlternativeValidator.getCurrentType(fCurrentElemDecl, element,
attributes);
+ XSTypeDefinition currentType =
fTypeAlternativeValidator.getCurrentType(fCurrentElemDecl, element, attributes,
fInheritableAttrList);
if (currentType != null) {
fCurrentType = currentType;
}
@@ -2403,9 +2412,19 @@ public class XMLSchemaValidator
fIDContext.setCurrentScopeToParent();
}
- // delegate to 'type alternative' validator subcomponent
+ // inheritable attributes processing
+ XSAttributeUse[] inheritedAttributesPsvi = null; // for copying into
the ElementPSVI
if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
- fTypeAlternativeValidator.handleStartElement(fCurrentElemDecl,
attributes);
+ fInhrAttrCountStack.push(fInheritableAttrList.size());
+ if (fInheritableAttrList.size() > 0) {
+ inheritedAttributesPsvi = new
XSAttributeUse[fInheritableAttrList.size()];
+ for (int inhrAttrIdx = 0; inhrAttrIdx <
fInheritableAttrList.size(); inhrAttrIdx++) {
+ inheritedAttributesPsvi[inhrAttrIdx] =
((InheritableAttribute)
fInheritableAttrList.get(inhrAttrIdx)).getAttributeUse();
+ }
+ }
+ // find attributes among the attributes of the current element,
which are declared inheritable and store them for later processing.
+ // one of the uses of inherited attributes is in type alternatives
processing.
+ saveInheritableAttributes(fCurrentElemDecl, attributes);
}
// call all active identity constraints
@@ -2428,6 +2447,10 @@ public class XMLSchemaValidator
fCurrentPSVI.fNotation = fNotation;
// PSVI: add nil
fCurrentPSVI.fNil = fNil;
+ if (inheritedAttributesPsvi != null) {
+ // PSVI: add inherited attributes
+ fCurrentPSVI.fInheritedAttributes = inheritedAttributesPsvi;
+ }
}
// delegate to assertions validator subcomponent
@@ -2456,9 +2479,9 @@ public class XMLSchemaValidator
System.out.println("==>handleEndElement:" + element);
}
- // delegate to 'type alternative' validator subcomponent
- if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
- fTypeAlternativeValidator.handleEndElement();
+ // inheritable attributes processing
+ if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1 &&
fInhrAttrCountStack.size() > 0) {
+ fInheritableAttrList.setSize(fInhrAttrCountStack.pop());
}
// if we are skipping, return
@@ -4864,4 +4887,53 @@ public class XMLSchemaValidator
}
} // extraCheckForSTUnionAsserts
+ /*
+ * For the current element being handled by the XML Schema validator, find
all inheritable attributes for this element.
+ * Save these inheritable attributes, into a global Vector list for later
processing.
+ */
+ private void saveInheritableAttributes(XSElementDecl currentElemDecl,
XMLAttributes attributes) {
+
+ if (currentElemDecl != null && currentElemDecl.fType instanceof
XSComplexTypeDecl) {
+ XSComplexTypeDecl complexTypeDecl = (XSComplexTypeDecl)
currentElemDecl.fType;
+ XSObjectListImpl attributeUses = (XSObjectListImpl)
complexTypeDecl.getAttributeUses();
+ // iterate all the attribute declarations of the complex type, for
the current element
+ for (int attrUsesIndx = 0; attrUsesIndx <
attributeUses.getLength(); attrUsesIndx++) {
+ XSAttributeUse attrUse = (XSAttributeUse)
attributeUses.get(attrUsesIndx);
+ if (attrUse.getInheritable()) {
+ // this is an inheritable attribute. copy this into an
global Vector list.
+ XSAttributeDeclaration attrDecl = (XSAttributeDeclaration)
attrUse.getAttrDeclaration();
+ String attrVal =
attributes.getValue(attrDecl.getNamespace(), attrDecl.getName());
+ if (attrVal != null) {
+ fInheritableAttrList.add(new
InheritableAttribute(attrUse, attrVal));
+ }
+ }
+ }
+ }
+
+ } // saveInheritableAttributes
+
+ /*
+ * A class representing an inheritable attribute. An instance of this
class is used as an intermediate storage,
+ * for inheritable attribute information.
+ */
+ final class InheritableAttribute {
+
+ private final XSAttributeUse attrUse;
+ private final String value;
+
+ public InheritableAttribute(XSAttributeUse attrUse, String value) {
+ this.attrUse = attrUse;
+ this.value = value;
+ }
+
+ public XSAttributeUse getAttributeUse() {
+ return attrUse;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ } // class InheritableAttribute
+
} // class XMLSchemaValidator
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java
Mon Mar 28 15:27:49 2011
@@ -48,7 +48,7 @@ public class XSAttributeUseImpl implemen
public ValidatedInfo fDefault = null;
// optional annotation
public XSObjectList fAnnotations = null;
-
+ // inheritable attribute flag
public boolean fInheritable = false;
public void reset(){
@@ -155,6 +155,9 @@ public class XSAttributeUseImpl implemen
return (fAnnotations != null) ? fAnnotations :
XSObjectListImpl.EMPTY_LIST;
}
+ /**
+ * Tells whether this attribute is declared inheritable.
+ */
public boolean getInheritable() {
return fInheritable;
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
Mon Mar 28 15:27:49 2011
@@ -19,11 +19,10 @@ package org.apache.xerces.impl.xs;
import java.util.Vector;
+import org.apache.xerces.impl.xs.XMLSchemaValidator.InheritableAttribute;
import org.apache.xerces.impl.xs.alternative.Test;
import org.apache.xerces.impl.xs.alternative.XSTypeAlternativeImpl;
-import org.apache.xerces.impl.xs.util.XSObjectListImpl;
import org.apache.xerces.impl.xs.util.XSTypeHelper;
-import org.apache.xerces.util.IntStack;
import org.apache.xerces.util.XMLAttributesImpl;
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLAttributes;
@@ -39,50 +38,37 @@ import org.apache.xerces.xs.XSTypeDefini
* @author Mukul Gandhi IBM
* @version $Id$
*/
-public class XSDTypeAlternativeValidator {
-
- // a Vector list storing inheritable attributes
- private Vector fInheritableAttrList = new Vector();
-
- // a Stack storing inheritable attribute count for the elements
- private IntStack fInhrAttrCountStack = new IntStack();
-
- // temporary qname
- private final QName fTempQName = new QName();
+public class XSDTypeAlternativeValidator {
/*
* Class constructor.
*/
public XSDTypeAlternativeValidator() {
- // NO OP ...
+ // NO OP ...
}
/*
* Determine the schema type applicable for an element declaration, using
type alternative information.
*/
- public XSTypeDefinition getCurrentType(XSElementDecl currentElemDecl,
QName element, XMLAttributes attributes) {
+ public XSTypeDefinition getCurrentType(XSElementDecl currentElemDecl,
QName element, XMLAttributes attributes, Vector inheritableAttrList) {
XSTypeDefinition currentType = null;
- boolean typeSelected = false;
-
- XSTypeAlternativeImpl[] typeAlternatives =
currentElemDecl.getTypeAlternatives();
+ XSTypeAlternativeImpl[] typeAlternatives =
currentElemDecl.getTypeAlternatives();
if (typeAlternatives != null) {
// Construct a list of attributes needed for CTA processing. This
includes inherited attributes as well.
- XMLAttributes ctaAttributes = getAttributesForCTA(attributes);
-
+ XMLAttributes ctaAttributes = getAttributesForCTA(attributes,
inheritableAttrList);
for (int typeAltIdx = 0; typeAltIdx < typeAlternatives.length;
typeAltIdx++) {
- Test test = typeAlternatives[typeAltIdx].getTest();
- if (test != null && test.evaluateTest(element, ctaAttributes))
{
+ Test ctaTest = typeAlternatives[typeAltIdx].getTest();
+ if (ctaTest != null && ctaTest.evaluateTest(element,
ctaAttributes)) {
currentType =
typeAlternatives[typeAltIdx].getTypeDefinition();
- typeSelected = true;
break;
}
}
- //if a type is not selected try to assign the default type
- if (!typeSelected) {
+ //if a type is not selected by xs:alternative components, try to
assign the default type
+ if (currentType == null) {
XSTypeAlternativeImpl defType =
currentElemDecl.getDefaultTypeDefinition();
if (defType != null) {
currentType = defType.getTypeDefinition();
@@ -94,113 +80,46 @@ public class XSDTypeAlternativeValidator
} // getCurrentType
-
- /*
- * Type alternative processing interface during the XNI event
'handleStartElement' in XMLSchemaValidator.
- */
- public void handleStartElement(XSElementDecl currentElemDecl,
XMLAttributes attributes) {
-
- fInhrAttrCountStack.push(fInheritableAttrList.size());
-
- // Find attributes among the attributes of the current element, which
are declared inheritable.
- // The inheritable attributes will later be used for processing "type
alternative" instruction.
- if (attributes.getLength() > 0) {
- // get inheritable attributes, only if an element has a complex
type (i.e, has > 0 attributes).
- saveInheritableAttributes(currentElemDecl, attributes);
- }
-
- } // handleStartElement
-
-
- /*
- * Type alternative processing interface during the XNI event
'handleEndElement' in XMLSchemaValidator.
- */
- public void handleEndElement() {
-
- // modify the Vector list 'fInheritableAttrList' and pop the stack,
'fInhrAttrCountStack', to reflect
- // inheritable attributes processing.
- if (fInhrAttrCountStack.size() > 0) {
- fInheritableAttrList.setSize(fInhrAttrCountStack.pop());
- }
-
- } // handleEndElement
-
/*
* Construct a list of attributes, needed for CTA processing. This
includes inherited attributes as well.
*/
- private XMLAttributes getAttributesForCTA(XMLAttributes attributes) {
+ private XMLAttributes getAttributesForCTA(XMLAttributes attributes, Vector
inheritableAttrList) {
// copy attributes from the original list of attributes
XMLAttributes ctaAttributes = new XMLAttributesImpl();
for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
- QName qName = new QName();
- attributes.getName(attrIndx, qName);
- ctaAttributes.addAttribute(qName, attributes.getType(attrIndx),
attributes.getValue(attrIndx));
+ QName attrQName = new QName();
+ attributes.getName(attrIndx, attrQName);
+ ctaAttributes.addAttribute(attrQName,
attributes.getType(attrIndx), attributes.getValue(attrIndx));
}
- // Traverse up the XML tree, to find inheritable attributes.
Attributes only from the nearest ancestor,
- // are added to the list (since there is recursive inclusion of
inheritable attributes in an XML tree).
- for (int elemIndx = fInheritableAttrList.size() - 1; elemIndx > -1;
elemIndx--) {
- InheritableAttribute inhAttr = (InheritableAttribute)
fInheritableAttrList.elementAt(elemIndx);
- // if an inheritable attribute doesn't already exist in the
attributes list, add it to the list
- if (!attributeExists(ctaAttributes, inhAttr)) {
- String rawName = "".equals(inhAttr.getPrefix()) ?
inhAttr.getLocalName() : inhAttr.getPrefix() + ":" + inhAttr.getLocalName();
- fTempQName.setValues(inhAttr.getPrefix(),
inhAttr.getLocalName(), rawName, inhAttr.getUri());
- ctaAttributes.addAttribute(fTempQName, inhAttr.getType(),
inhAttr.getValue());
+ // Add inherited attributes to the CTA attributes list
+ for (int elemIndx = inheritableAttrList.size() - 1; elemIndx > -1;
elemIndx--) {
+ InheritableAttribute inhAttr = (InheritableAttribute)
inheritableAttrList.elementAt(elemIndx);
+ XSAttributeDeclaration inhrAttrDecl =
inhAttr.getAttributeUse().getAttrDeclaration();
+ // if an inherited attribute is not overridden by the current
element, add it to the CTA attributes list
+ if (!isInheritedAttributeOverridden(ctaAttributes, inhrAttrDecl))
{
+ QName attrQName = new QName();
+ attrQName.setValues(null, inhrAttrDecl.getName(),
inhrAttrDecl.getName(), inhrAttrDecl.getNamespace());
+ ctaAttributes.addAttribute(attrQName, null,
inhAttr.getValue());
}
}
return ctaAttributes;
} // getAttributesForCTA
-
-
- /*
- * For the current element being handled by the Schema validator, find all
inheritable attributes for this element.
- * Save these inheritable attributes, to a global Vector list.
- */
- private void saveInheritableAttributes(XSElementDecl currentElemDecl,
XMLAttributes attributes) {
-
- if (currentElemDecl != null && currentElemDecl.fType instanceof
XSComplexTypeDecl) {
- XSComplexTypeDecl currentComplexType = (XSComplexTypeDecl)
currentElemDecl.fType;
- XSObjectListImpl attributeUses = (XSObjectListImpl)
currentComplexType.getAttributeUses();
-
- // iterate all the attributes, being passed to this method
- for (int attrIndx = 0; attrIndx < attributes.getLength();
attrIndx++) {
- String attrName = attributes.getLocalName(attrIndx);
- String attrUri = attributes.getURI(attrIndx);
- // iterate all the attribute declarations of a complex type,
for the current element
- for (int attrUsesIndx = 0; attrUsesIndx <
attributeUses.getLength(); attrUsesIndx++) {
- XSAttributeUseImpl attrUseImpl = (XSAttributeUseImpl)
attributeUses.get(attrUsesIndx);
- XSAttributeDeclaration attrDecl =
attrUseImpl.getAttrDeclaration();
- // the current element, has an inheritable attribute
- if (attrName.equals(attrDecl.getName()) &&
XSTypeHelper.isURIEqual(attrUri, attrDecl.getNamespace()) &&
attrUseImpl.getInheritable()) {
- InheritableAttribute inhrAttr = new
InheritableAttribute(attributes.getLocalName(attrIndx),
-
attributes.getPrefix(attrIndx),
-
attributes.getURI(attrIndx),
-
attributes.getValue(attrIndx),
-
attributes.getType(attrIndx)) ;
- fInheritableAttrList.add(inhrAttr);
- }
- }
- }
- }
-
- } // saveInheritableAttributes
-
+
/*
- * Check if an inheritable attribute, exists in the attributes list.
+ * Check if an inherited attribute already exists in the current
attributes list.
*/
- private boolean attributeExists(XMLAttributes attributes,
InheritableAttribute inhAttr) {
+ private boolean isInheritedAttributeOverridden(XMLAttributes attributes,
XSAttributeDeclaration inhrAttrDecl) {
boolean attrExists = false;
- for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
- String localName = attributes.getLocalName(attrIndx);
- String uri = attributes.getURI(attrIndx);
- if (localName.equals(inhAttr.getLocalName()) &&
XSTypeHelper.isURIEqual(uri, inhAttr.getUri())) {
+ for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++)
{
+ if
((attributes.getLocalName(attrIndx)).equals(inhrAttrDecl.getName()) &&
XSTypeHelper.isURIEqual(attributes.getURI(attrIndx),
inhrAttrDecl.getNamespace())) {
attrExists = true;
break;
}
@@ -208,49 +127,6 @@ public class XSDTypeAlternativeValidator
return attrExists;
- } // attributeExists
-
-
- /*
- * A class representing an inheritable attribute. An instance of this
class is used as an intermediate storage,
- * for inheritable attribute information.
- */
- final class InheritableAttribute {
-
- private final String localName;
- private final String prefix;
- private final String uri;
- private final String value;
- private final String type;
-
- public InheritableAttribute(String localName, String prefix, String
uri, String value, String type) {
- this.localName = localName;
- this.prefix = prefix;
- this.uri = uri;
- this.value = value;
- this.type = type;
- }
-
- public String getLocalName() {
- return localName;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getUri() {
- return uri;
- }
-
- public String getValue() {
- return value;
- }
-
- public String getType() {
- return type;
- }
-
- } // class InheritableAttribute
+ } // isInheritedAttributeOverridden
} // class XSDTypeAlternativeValidator
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ElementPSVI.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ElementPSVI.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ElementPSVI.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ElementPSVI.java
Mon Mar 28 15:27:49 2011
@@ -43,5 +43,10 @@ public interface ElementPSVI extends Ite
* validation root, <code>null</code> otherwise.
*/
public XSModel getSchemaInformation();
+
+ /**
+ * [inherited attributes]: inherited attributes.
+ */
+ public XSAttributeUse[] getInheritedAttributes();
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSAttributeUse.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSAttributeUse.java?rev=1086271&r1=1086270&r2=1086271&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSAttributeUse.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSAttributeUse.java
Mon Mar 28 15:27:49 2011
@@ -100,5 +100,8 @@ public interface XSAttributeUse extends
*/
public XSObjectList getAnnotations();
+ /**
+ * Tells whether this attribute is declared inheritable.
+ */
public boolean getInheritable();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]