You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2011/04/20 17:57:21 UTC
svn commit: r1095443 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: dom/
impl/xs/ xni/ xs/
Author: mukulg
Date: Wed Apr 20 15:57:20 2011
New Revision: 1095443
URL: http://svn.apache.org/viewvc?rev=1095443&view=rev
Log:
committing improvements to incorporate Michael's suggestions (regarding improvements to inheritable attribute PSVI results) for SVN svn commit: r1087961
Removed:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
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/XSDTypeAlternativeValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ElementPSVI.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=1095443&r1=1095442&r2=1095443&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 Wed Apr 20 15:57:20 2011
@@ -25,7 +25,6 @@ import java.io.ObjectOutputStream;
import org.apache.xerces.impl.dv.ValidatedInfo;
import org.apache.xerces.impl.xs.ElementPSVImpl;
import org.apache.xerces.impl.xs.util.StringListImpl;
-import org.apache.xerces.xni.XMLAttribute;
import org.apache.xerces.xs.ElementPSVI;
import org.apache.xerces.xs.ItemPSVI;
import org.apache.xerces.xs.ShortList;
@@ -37,6 +36,7 @@ import org.apache.xerces.xs.XSNotationDe
import org.apache.xerces.xs.XSSimpleTypeDefinition;
import org.apache.xerces.xs.XSTypeDefinition;
import org.apache.xerces.xs.XSValue;
+import org.apache.xerces.xs.datatypes.ObjectList;
/**
* Element namespace implementation; stores PSVI element items.
@@ -108,7 +108,7 @@ public class PSVIElementNSImpl extends E
protected XSModel fSchemaInformation = null;
/** inherited attributes */
- protected XMLAttribute[] fInheritedAttributes = null;
+ protected ObjectList fInheritedAttributes = null;
//
// ElementPSVI methods
@@ -273,9 +273,9 @@ public class PSVIElementNSImpl extends E
/**
* Inherited attributes.
*
- * @return an array of inherited attributes. null if no inherited attributes were found.
+ * @return inherited attributes list. null if no inherited attributes were found.
*/
- public XMLAttribute[] getInheritedAttributes() {
+ public ObjectList getInheritedAttributes() {
return fInheritedAttributes;
}
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=1095443&r1=1095442&r2=1095443&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 Wed Apr 20 15:57:20 2011
@@ -19,7 +19,6 @@ package org.apache.xerces.impl.xs;
import org.apache.xerces.impl.dv.ValidatedInfo;
import org.apache.xerces.impl.xs.util.StringListImpl;
-import org.apache.xerces.xni.XMLAttribute;
import org.apache.xerces.xs.ElementPSVI;
import org.apache.xerces.xs.ItemPSVI;
import org.apache.xerces.xs.ShortList;
@@ -30,6 +29,7 @@ import org.apache.xerces.xs.XSNotationDe
import org.apache.xerces.xs.XSSimpleTypeDefinition;
import org.apache.xerces.xs.XSTypeDefinition;
import org.apache.xerces.xs.XSValue;
+import org.apache.xerces.xs.datatypes.ObjectList;
/**
* Element PSV infoset augmentations implementation.
@@ -90,7 +90,7 @@ public class ElementPSVImpl implements E
protected boolean fIsConstant;
/** inherited attributes **/
- protected XMLAttribute[] fInheritedAttributes = null;
+ protected ObjectList fInheritedAttributes = null;
public ElementPSVImpl() {}
@@ -325,9 +325,9 @@ public class ElementPSVImpl implements E
/**
* Inherited attributes.
*
- * @return an array of inherited attributes. null if no inherited attributes were found.
+ * @return inherited attributes list. null if no inherited attributes were found.
*/
- public XMLAttribute[] getInheritedAttributes() {
+ public ObjectList getInheritedAttributes() {
return fInheritedAttributes;
}
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=1095443&r1=1095442&r2=1095443&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 Wed Apr 20 15:57:20 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.ObjectListImpl;
import org.apache.xerces.impl.xs.util.XSObjectListImpl;
import org.apache.xerces.impl.xs.util.XSTypeHelper;
import org.apache.xerces.util.AugmentationsImpl;
@@ -63,7 +64,6 @@ import org.apache.xerces.util.URI.Malfor
import org.apache.xerces.xni.Augmentations;
import org.apache.xerces.xni.NamespaceContext;
import org.apache.xerces.xni.QName;
-import org.apache.xerces.xni.XMLAttribute;
import org.apache.xerces.xni.XMLAttributes;
import org.apache.xerces.xni.XMLDocumentHandler;
import org.apache.xerces.xni.XMLLocator;
@@ -89,6 +89,7 @@ import org.apache.xerces.xs.XSConstants;
import org.apache.xerces.xs.XSObjectList;
import org.apache.xerces.xs.XSSimpleTypeDefinition;
import org.apache.xerces.xs.XSTypeDefinition;
+import org.apache.xerces.xs.datatypes.ObjectList;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
@@ -2432,7 +2433,7 @@ public class XMLSchemaValidator
}
// inheritable attributes processing
- XMLAttribute[] inheritedAttributesForPsvi = null;
+ ObjectList inheritedAttributesForPsvi = null;
if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
fInhrAttrCountStack.push(fInheritableAttrList.size());
inheritedAttributesForPsvi = getInheritedAttributesForPSVI();
@@ -2725,7 +2726,7 @@ public class XMLSchemaValidator
fCurrentPSVI.fNotation = this.fNotation;
fCurrentPSVI.fValidationContext = this.fValidationRoot;
fCurrentPSVI.fNil = this.fNil;
- XMLAttribute[] inheritedAttributesForPsvi = null;
+ ObjectList inheritedAttributesForPsvi = null;
if (fInhrAttrCountStack.size() > 0) {
fInheritableAttrList.setSize(fInhrAttrCountStack.pop());
inheritedAttributesForPsvi = getInheritedAttributesForPSVI();
@@ -4931,11 +4932,11 @@ public class XMLSchemaValidator
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.
+ // this is an inheritable attribute. copy into an global Vector list.
XSAttributeDeclaration attrDecl = (XSAttributeDeclaration) attrUse.getAttrDeclaration();
- String attrVal = attributes.getValue(attrDecl.getNamespace(), attrDecl.getName());
- if (attrVal != null) {
- fInheritableAttrList.add(new XMLAttribute(attrDecl, attrVal));
+ Augmentations attrAugs = attributes.getAugmentations(attrDecl.getNamespace(), attrDecl.getName());
+ if (attrAugs != null) {
+ fInheritableAttrList.add((AttributePSVI)attrAugs.getItem(Constants.ATTRIBUTE_PSVI));
}
}
}
@@ -4946,15 +4947,20 @@ public class XMLSchemaValidator
/*
* Get inherited attributes for copying into an element PSVI.
*/
- private XMLAttribute[] getInheritedAttributesForPSVI() {
- XMLAttribute[] inheritedAttributes = null;
+ private ObjectList getInheritedAttributesForPSVI() {
+
+ ObjectList inheritedAttributesList = null;
+
if (fInheritableAttrList.size() > 0) {
- inheritedAttributes = new XMLAttribute[fInheritableAttrList.size()];
+ Object[] inheritedAttributesArray = new Object[fInheritableAttrList.size()];
for (int inhrAttrIdx = 0; inhrAttrIdx < fInheritableAttrList.size(); inhrAttrIdx++) {
- inheritedAttributes[inhrAttrIdx] = (XMLAttribute) fInheritableAttrList.get(inhrAttrIdx);
+ inheritedAttributesArray[inhrAttrIdx] = fInheritableAttrList.get(inhrAttrIdx);
}
- }
- return inheritedAttributes;
+ inheritedAttributesList = new ObjectListImpl(inheritedAttributesArray, inheritedAttributesArray.length);
+ }
+
+ return inheritedAttributesList;
+
} // getInheritedAttributesForPSVI
} // class XMLSchemaValidator
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=1095443&r1=1095442&r2=1095443&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 Wed Apr 20 15:57:20 2011
@@ -24,8 +24,8 @@ import org.apache.xerces.impl.xs.alterna
import org.apache.xerces.impl.xs.util.XSTypeHelper;
import org.apache.xerces.util.XMLAttributesImpl;
import org.apache.xerces.xni.QName;
-import org.apache.xerces.xni.XMLAttribute;
import org.apache.xerces.xni.XMLAttributes;
+import org.apache.xerces.xs.AttributePSVI;
import org.apache.xerces.xs.XSAttributeDeclaration;
import org.apache.xerces.xs.XSTypeDefinition;
@@ -58,7 +58,7 @@ public class XSDTypeAlternativeValidator
XSTypeAlternativeImpl[] typeAlternatives = currentElemDecl.getTypeAlternatives();
if (typeAlternatives != null) {
- // Construct a list of attributes needed for CTA processing. This includes inheritable attributes as well.
+ // Construct a list of attributes needed for CTA processing. This includes inherited attributes as well.
XMLAttributes ctaAttributes = getAttributesForCTA(attributes, inheritableAttrList);
for (int typeAltIdx = 0; typeAltIdx < typeAlternatives.length; typeAltIdx++) {
Test ctaTest = typeAlternatives[typeAltIdx].getTest();
@@ -82,12 +82,13 @@ public class XSDTypeAlternativeValidator
/*
- * Construct a list of attributes, needed for CTA processing. This includes inheritable attributes as well.
+ * Construct a list of attributes, needed for CTA processing. This includes inherited attributes as well.
*/
private XMLAttributes getAttributesForCTA(XMLAttributes attributes, Vector inheritableAttrList) {
- // copy attributes from the original list of attributes
XMLAttributes ctaAttributes = new XMLAttributesImpl();
+
+ // copy attributes from the original list of attributes
for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
QName attrQName = new QName();
attributes.getName(attrIndx, attrQName);
@@ -96,13 +97,13 @@ public class XSDTypeAlternativeValidator
// add inherited attributes to the CTA attributes list
for (int elemIndx = inheritableAttrList.size() - 1; elemIndx > -1; elemIndx--) {
- XMLAttribute inhAttr = (XMLAttribute) inheritableAttrList.elementAt(elemIndx);
- XSAttributeDeclaration inhrAttrDecl = inhAttr.getAttrDecl();
+ AttributePSVI inhAttrPsvi = (AttributePSVI) inheritableAttrList.elementAt(elemIndx);
+ XSAttributeDeclaration inhrAttrDecl = inhAttrPsvi.getAttributeDeclaration();
// 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.getAttrValue());
+ attrQName.setValues(null, inhrAttrDecl.getName(), inhrAttrDecl.getName(), inhrAttrDecl.getNamespace());
+ ctaAttributes.addAttribute(attrQName, null, inhAttrPsvi.getSchemaValue().getNormalizedValue());
}
}
@@ -114,19 +115,15 @@ public class XSDTypeAlternativeValidator
/*
* Check if an inherited attribute already exists in the current attributes list.
*/
- private boolean isInheritedAttributeOverridden(XMLAttributes attributes, XSAttributeDeclaration inhrAttrDecl) {
-
+ private boolean isInheritedAttributeOverridden(XMLAttributes attributes, XSAttributeDeclaration inhrAttrDecl) {
boolean attrExists = false;
-
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;
}
}
-
- return attrExists;
-
+ return attrExists;
} // 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=1095443&r1=1095442&r2=1095443&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 Wed Apr 20 15:57:20 2011
@@ -17,7 +17,7 @@
package org.apache.xerces.xs;
-import org.apache.xerces.xni.XMLAttribute;
+import org.apache.xerces.xs.datatypes.ObjectList;
/**
* Represents a PSVI item for one element information item.
@@ -49,6 +49,6 @@ public interface ElementPSVI extends Ite
/**
* [inherited attributes]: inherited attributes.
*/
- public XMLAttribute[] getInheritedAttributes();
+ public ObjectList getInheritedAttributes();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org