Author: mukulg
Date: Sat Apr 2 04:46:49 2011
New Revision: 1087961
URL: http://svn.apache.org/viewvc?rev=1087961&view=rev
Log:
committing few improvements for inheritable attributes PSVI results.
creating a new class (XMLAttribute) to store attribute declaration and it's
value to produce information for inherited attributes PSVI results. i did not
use XMLAttributes class for this purpose, since it has lot of information
that's unnecessary for this purpose, and may require more lines-of-code by
applications using the PSVI results.
The inner class InheritableAttribute in XMLSchemaValidator is not needed as a
consequence of this change and is now deleted.
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
(with props)
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=1087961&r1=1087960&r2=1087961&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
Sat Apr 2 04:46:49 2011
@@ -25,11 +25,11 @@ 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;
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;
@@ -108,7 +108,7 @@ public class PSVIElementNSImpl extends E
protected XSModel fSchemaInformation = null;
/** inherited attributes */
- protected XSAttributeUse[] fInheritedAttributes = null;
+ protected XMLAttribute[] fInheritedAttributes = null;
//
// ElementPSVI methods
@@ -273,9 +273,9 @@ public class PSVIElementNSImpl extends E
/**
* Inherited attributes.
*
- * @return an array of inherited attribute, XSAttributeUse components.
null if no inherited attributes were found.
+ * @return an array of inherited attributes. null if no inherited
attributes were found.
*/
- public XSAttributeUse[] getInheritedAttributes() {
+ public XMLAttribute[] 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=1087961&r1=1087960&r2=1087961&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
Sat Apr 2 04:46:49 2011
@@ -19,11 +19,11 @@ 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;
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;
@@ -90,7 +90,7 @@ public class ElementPSVImpl implements E
protected boolean fIsConstant;
/** inherited attributes **/
- protected XSAttributeUse[] fInheritedAttributes = null;
+ protected XMLAttribute[] fInheritedAttributes = null;
public ElementPSVImpl() {}
@@ -325,9 +325,9 @@ public class ElementPSVImpl implements E
/**
* Inherited attributes.
*
- * @return an array of inherited attribute, XSAttributeUse components.
null if no inherited attributes were found.
+ * @return an array of inherited attributes. null if no inherited
attributes were found.
*/
- public XSAttributeUse[] getInheritedAttributes() {
+ public XMLAttribute[] 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=1087961&r1=1087960&r2=1087961&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
Sat Apr 2 04:46:49 2011
@@ -63,6 +63,7 @@ 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;
@@ -2420,7 +2421,7 @@ public class XMLSchemaValidator
}
// inheritable attributes processing
- XSAttributeUse[] inheritedAttributesForPsvi = null;
+ XMLAttribute[] inheritedAttributesForPsvi = null;
if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
fInhrAttrCountStack.push(fInheritableAttrList.size());
inheritedAttributesForPsvi = getInheritedAttributesForPsvi();
@@ -2688,7 +2689,7 @@ public class XMLSchemaValidator
fCurrentPSVI.fNotation = this.fNotation;
fCurrentPSVI.fValidationContext = this.fValidationRoot;
fCurrentPSVI.fNil = this.fNil;
- XSAttributeUse[] inheritedAttributesForPsvi = null;
+ XMLAttribute[] inheritedAttributesForPsvi = null;
if (fInhrAttrCountStack.size() > 0) {
fInheritableAttrList.setSize(fInhrAttrCountStack.pop());
inheritedAttributesForPsvi = getInheritedAttributesForPsvi();
@@ -4898,7 +4899,7 @@ public class XMLSchemaValidator
XSAttributeDeclaration attrDecl = (XSAttributeDeclaration)
attrUse.getAttrDeclaration();
String attrVal =
attributes.getValue(attrDecl.getNamespace(), attrDecl.getName());
if (attrVal != null) {
- fInheritableAttrList.add(new
InheritableAttribute(attrUse, attrVal));
+ fInheritableAttrList.add(new XMLAttribute(attrDecl,
attrVal));
}
}
}
@@ -4907,38 +4908,14 @@ public class XMLSchemaValidator
} // 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
-
- /*
* Get inherited attributes for copying into an element PSVI.
*/
- private XSAttributeUse[] getInheritedAttributesForPsvi() {
- XSAttributeUse[] inheritedAttributes = null;
+ private XMLAttribute[] getInheritedAttributesForPsvi() {
+ XMLAttribute[] inheritedAttributes = null;
if (fInheritableAttrList.size() > 0) {
- inheritedAttributes = new
XSAttributeUse[fInheritableAttrList.size()];
+ inheritedAttributes = new
XMLAttribute[fInheritableAttrList.size()];
for (int inhrAttrIdx = 0; inhrAttrIdx <
fInheritableAttrList.size(); inhrAttrIdx++) {
- inheritedAttributes[inhrAttrIdx] = ((InheritableAttribute)
fInheritableAttrList.get(inhrAttrIdx)).getAttributeUse();
+ inheritedAttributes[inhrAttrIdx] = (XMLAttribute)
fInheritableAttrList.get(inhrAttrIdx);
}
}
return inheritedAttributes;
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=1087961&r1=1087960&r2=1087961&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
Sat Apr 2 04:46:49 2011
@@ -19,12 +19,12 @@ 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.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.XSAttributeDeclaration;
import org.apache.xerces.xs.XSTypeDefinition;
@@ -96,13 +96,13 @@ public class XSDTypeAlternativeValidator
// 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();
+ XMLAttribute inhAttr = (XMLAttribute)
inheritableAttrList.elementAt(elemIndx);
+ XSAttributeDeclaration inhrAttrDecl = inhAttr.getAttrDecl();
// 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());
+ ctaAttributes.addAttribute(attrQName, null,
inhAttr.getAttrValue());
}
}
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java?rev=1087961&view=auto
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
(added)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
Sat Apr 2 04:46:49 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.xni;
+
+import org.apache.xerces.xs.XSAttributeDeclaration;
+
+/**
+ * An object of this class stores a typed attribute information (an
attribute's value and it's XSModel declaration)
+ * at runtime. This class is used for example to represent inheritable
attribute PSVI information.
+ *
+ * @author Mukul Gandhi IBM
+ * @version $Id$
+ */
+public class XMLAttribute {
+
+ private XSAttributeDeclaration fAttrDecl = null;
+ private String fAttrValue = null;
+
+ // Class constructor
+ public XMLAttribute(XSAttributeDeclaration attrDecl, String attrValue) {
+ fAttrDecl = attrDecl;
+ fAttrValue = attrValue;
+ }
+
+ /**
+ * @return the fAttrDecl
+ */
+ public XSAttributeDeclaration getAttrDecl() {
+ return fAttrDecl;
+ }
+
+ /**
+ * @return the fAttrValue
+ */
+ public String getAttrValue() {
+ return fAttrValue;
+ }
+
+} // class XMLAttribute
Propchange:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/XMLAttribute.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
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=1087961&r1=1087960&r2=1087961&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
Sat Apr 2 04:46:49 2011
@@ -17,6 +17,8 @@
package org.apache.xerces.xs;
+import org.apache.xerces.xni.XMLAttribute;
+
/**
* Represents a PSVI item for one element information item.
*/
@@ -47,6 +49,6 @@ public interface ElementPSVI extends Ite
/**
* [inherited attributes]: inherited attributes.
*/
- public XSAttributeUse[] getInheritedAttributes();
+ public XMLAttribute[] getInheritedAttributes();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]