You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2007/02/12 08:43:23 UTC
svn commit: r506354 - in /webservices/axis2/trunk/java/modules/adb-codegen:
src/org/apache/axis2/schema/ src/org/apache/axis2/schema/template/
test-resources/testsuite/
Author: amilas
Date: Sun Feb 11 23:43:22 2007
New Revision: 506354
URL: http://svn.apache.org/viewvc?view=rev&rev=506354
Log:
fixed some issues regaring adb codegen
1. replace patter \ with \\
2. set maxlength and minlength validation
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd
webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=506354&r1=506353&r2=506354
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Sun Feb 11 23:43:22 2007
@@ -1435,7 +1435,9 @@
if (obj instanceof XmlSchemaPatternFacet) {
XmlSchemaPatternFacet pattern = (XmlSchemaPatternFacet) obj;
- metaInfHolder.setPatternFacet(pattern.getValue().toString());
+ // some patterns contain \ so we have to replace them
+ String patternString = pattern.getValue().toString();
+ metaInfHolder.setPatternFacet(patternString.replaceAll("\\\\","\\\\\\\\"));
}
else if (obj instanceof XmlSchemaEnumerationFacet) {
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=506354&r1=506353&r2=506354
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Sun Feb 11 23:43:22 2007
@@ -476,7 +476,8 @@
}
</xsl:when>
<xsl:when test="(@maxLenFacet) or (@minLenFacet)">
- if ( <xsl:if test="(@minLenFacet)"> <xsl:value-of select="$minLenFacet"/> < </xsl:if> param.length() <xsl:if test="(@maxLenFacet)"> >= <xsl:value-of select="$maxLenFacet"/> </xsl:if> ) {
+ if ( <xsl:if test="(@minLenFacet)"> (<xsl:value-of select="$minLenFacet"/> < param.length())</xsl:if>
+ <xsl:if test="(@maxLenFacet)"> <xsl:if test="(@minLenFacet)"> && </xsl:if> (param.length() >= <xsl:value-of select="$maxLenFacet"/>) </xsl:if> ) {
this.<xsl:value-of select="$varName"/>=param;
}
else {
@@ -1986,7 +1987,7 @@
select="concat(translate( substring($shortTypeNameUncapped, 1, 1 ),'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ), substring($shortTypeNameUncapped, 2, string-length($shortTypeNameUncapped)))" />
<xsl:if test="$simple and not(@attribute) and not(enumFacet)">
- public static <xsl:value-of select="$name"/> fromString(String value,
+ public static <xsl:value-of select="$name"/> fromString(java.lang.String value,
java.lang.String namespaceURI){
<xsl:value-of select="$name"/> returnValue = new <xsl:value-of select="$name"/>();
<xsl:choose>
@@ -3378,7 +3379,9 @@
}
</xsl:when>
<xsl:when test="(@maxLenFacet) or (@minLenFacet)">
- if ( <xsl:if test="(@minLenFacet)"> <xsl:value-of select="$minLenFacet"/> < </xsl:if> param.length() <xsl:if test="(@maxLenFacet)"> >= <xsl:value-of select="$maxLenFacet"/> </xsl:if> ) {
+
+ if ( <xsl:if test="(@minLenFacet)"> (<xsl:value-of select="$minLenFacet"/> < param.length()) </xsl:if>
+ <xsl:if test="(@maxLenFacet)"> <xsl:if test="(@minLenFacet)"> && </xsl:if> (param.length() >= <xsl:value-of select="$maxLenFacet"/>) </xsl:if> ) {
this.<xsl:value-of select="$varName"/>=param;
}
else {
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd?view=diff&rev=506354&r1=506353&r2=506354
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd Sun Feb 11 23:43:22 2007
@@ -1,7 +1,9 @@
<schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="org.apache.axis2.test"
+ xmlns:test1="org.apache.axis2.test"
targetNamespace="org.apache.axis2.test">
<xs:element name="TestChoise">
@@ -12,5 +14,37 @@
</xs:choice>
</xs:complexType>
</xs:element>
+
+ <xsd:element name="myRootElem">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Child1" type="xsd:int">
+ </xsd:element>
+ <xsd:choice>
+ <xsd:element name="SomeChoice1" type="test1:SomeChoice1_Type" nillable="true" maxOccurs="unbounded"/>
+ <xsd:element name="SomeChoice2" type="test1:SomeChoice2_Type" nillable="true" maxOccurs="unbounded">
+ </xsd:element>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="SomeChoice1_Type">
+ <xsd:sequence>
+ <xsd:element name="SomeChoice1Child1"
+ type="test1:SomeChoice1Child1_Type"/>
+ </xsd:sequence>
+ <xsd:attribute name="SomeChoice1Attr1" type="xsd:string" use="required"/>
+ <xsd:attribute name="Version" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ <xsd:complexType name="SomeChoice2_Type">
+ <xsd:sequence>
+ <xsd:element name="SomeChoice2Child1" type="xsd:string"
+ maxOccurs="unbounded"/>
+ <xsd:element name="SomeChoice2Child2" type="xsd:int" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="SomeChoice2Attr1" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ <xsd:complexType name="SomeChoice1Child1_Type">
+ </xsd:complexType>
</schema>
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd?view=diff&rev=506354&r1=506353&r2=506354
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd Sun Feb 11 23:43:22 2007
@@ -66,4 +66,17 @@
<xsd:element name="ComplexRestrictionTypeTestElement" type="tns:ParentRestrictionType"/>
+ <xsd:simpleType name="ErrorCodeType">
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="30"/>
+ <xsd:minLength value="1"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="TestSimpleTypeRestrictionPattern">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d{4}((-\d{2}){0,1}-\d{2}){0,1}"></xsd:pattern>
+ </xsd:restriction>
+ </xsd:simpleType>
+
</xsd:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org