Author: jonathan
Date: Mon Jan 21 18:49:38 2008
New Revision: 12664
Log:
MASHUP-533: Added support for QName-typed return values.
Note that arrays of QNames aren't supported, neither are QName input values yet.
Modified:
trunk/commons/dynamic-codegen/src/jsstub.xslt
Modified: trunk/commons/dynamic-codegen/src/jsstub.xslt
==============================================================================
--- trunk/commons/dynamic-codegen/src/jsstub.xslt (original)
+++ trunk/commons/dynamic-codegen/src/jsstub.xslt Mon Jan 21 18:49:38 2008
@@ -317,7 +317,8 @@
type = "xml";
} else {
type = type.toString();
- }switch (type) {
+ }
+ switch (type) {
case "string":
return extractedValue;
break;
@@ -535,10 +536,7 @@
</xsl:template>
- <!-- Note that QName is treated lexically at this point, although the
prefix is meaningless
- outside the appropriate namespace context. Before bothering to fix
it, we should ensure
- that QName parameters actually are serialized with appropriate
namespace declarations. -->
- <xsl:template match="[EMAIL PROTECTED] =
'http://www.w3.org/2001/XMLSchema' and
+<xsl:template match="[EMAIL PROTECTED] = 'http://www.w3.org/2001/XMLSchema' and
( @type = 'string' or
@type = 'normalizedString' or
@type = 'token' or
@@ -554,8 +552,7 @@
@type = 'base64Binary' or
@type = 'decimal' or
@type = 'NOTATION' or
- @type = 'duration' or
- @type = 'QName'
+ @type = 'duration'
)]" mode="convert">
<xsl:call-template name="extracted-value"/>
resultValue = <xsl:call-template
name="return-type"/> extractedValue;
@@ -577,8 +574,7 @@
@type = 'base64Binary' or
@type = 'decimal' or
@type = 'NOTATION' or
- @type = 'duration' or
- @type = 'QName'
+ @type = 'duration'
)]" mode="convert-array">
<xsl:call-template name="extracted-values">
<xsl:with-param
name="extraction-code">extractedValue</xsl:with-param>
@@ -729,6 +725,35 @@
resultValue = /* array of xs:NMTOKEN */
extractedValue.split(' '));
</xsl:template>
+<xsl:template match="[EMAIL PROTECTED] = 'http://www.w3.org/2001/XMLSchema' and
+ ( @type = 'QName' )]" mode="convert">
+ <xsl:choose>
+ <xsl:when test="$e4x">
+ var extractedValue = (response["<xsl:value-of
select="@name"/>"]).toString();
+ var prefix = extractedValue.substring(0,
extractedValue.indexOf(':'));
+ var extractedNamespace = "";
+ for each (n in response["<xsl:value-of
select="@name"/>"].inScopeNamespaces()) {
+ if (n.prefix == prefix) extractedNamespace = n.uri;
+ }
+ resultValue = /* xs:QName */ new
QName(extractedNamespace, extractedValue);
+</xsl:when>
+ <xsl:otherwise>
+ var extractedValue =
WSRequest.util._stringValue(response.documentElement.firstChild);
+ var prefix = extractedValue.substring(0,
extractedValue.indexOf(':'));
+
+ var browser = WSRequest.util._getBrowser();
+ if (browser == "ie" || browser == "ie7") {
+ var extractedNamespace =
response.documentElement.firstChild.getAttribute("xmlns:" + prefix);
+ } else {
+ var extractedNamespace =
response.documentElement.firstChild.lookupNamespaceURI(prefix);
+ }
+
+ resultValue = /* xs:QName */ { "uri" :
extractedNamespace, "localName" : extractedValue };
+</xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+<!-- todo: QName arrays -->
+
<!-- value extraction for single xs:anyType value when there is an rpc
wrappers -->
<xsl:template match="[EMAIL PROTECTED]@type-namespace =
'http://www.w3.org/2001/XMLSchema' and
( @type = 'anyType' )]" mode="convert">
@@ -744,8 +769,7 @@
<xsl:template match="param[not(@name)[EMAIL PROTECTED] =
'http://www.w3.org/2001/XMLSchema' and
( @type = 'anyType' )]" mode="convert">
<xsl:choose>
- <xsl:when test="$e4x">
- var responseXML = new
XML(WSRequest.util._serializeToString(response));
+ <xsl:when test="$e4x"> var responseXML = new
XML(WSRequest.util._serializeToString(response));
resultValue = /* xs:anyType */
convertJSType(responseXML);
</xsl:when>
<xsl:otherwise> resultValue = /* xs:anyType */
convertJSType(response.documentElement);
_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev