Author: mukulg
Date: Sat Nov 28 08:42:23 2009
New Revision: 885076
URL: http://svn.apache.org/viewvc?rev=885076&view=rev
Log:
some fixes to typed value of xpath2 variable, $value. found this bug while
testing for asserts, in ComplexType -> SimpleContent -> restriction.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=885076&r1=885075&r2=885076&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Sat Nov 28 08:42:23 2009
@@ -278,21 +278,25 @@
private void setValueOf$value(String value) {
PSVIElementNSImpl currentAssertPSVINode = (PSVIElementNSImpl)
currentAssertDomNode;
- String typeName = "";
- if
(Constants.NS_XMLSCHEMA.equals(currentAssertPSVINode.getTypeNamespace())) {
- typeName = currentAssertPSVINode.getTypeDefinition().getName();
- } else if (Constants.NS_XMLSCHEMA.equals(currentAssertPSVINode.
- getTypeDefinition().
- getBaseType().getNamespace())) {
- typeName = currentAssertPSVINode.getTypeDefinition().getBaseType().
- getName();
- }
-
+ String xsdTypeName =
getXSDtypeOf$Value(currentAssertPSVINode.getTypeDefinition());
Object psychoPathType = abstrPsychopathImpl.getPsychoPathTypeForXSDType
- (typeName, value);
-
+ (xsdTypeName, value);
fDynamicContext.set_variable(
new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
"value"), (AnyType) psychoPathType);
}
+
+ /*
+ Find the built in XSD type for XPath2 variable, $value. This function
+ recursively searches the XSD type hierarchy navigating up the base
+ types, to find the needed built-in type.
+ */
+ private String getXSDtypeOf$Value(XSTypeDefinition elementType) {
+ if (Constants.NS_XMLSCHEMA.equals(elementType.getNamespace())) {
+ return elementType.getName();
+ }
+ else {
+ return getXSDtypeOf$Value(elementType.getBaseType());
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]