owenb 2002/10/15 08:33:12
Modified: java/src/org/apache/wsif WSIFConstants.java
Added: java/src/org/apache/wsif/schema ComplexContent.java
Parser.java Extension.java ComplexType.java
SequenceElement.java SchemaType.java
Restriction.java Schema.java SimpleType.java
Attribute.java
Log:
Initial versions of new package with classes to support simple parsing of schemas.
The code is intended to help resolve mappings between xml types and Java classes.
The code is NOT intended to be a full schema parser or a schema validator.
Revision Changes Path
1.1
xml-axis-wsif/java/src/org/apache/wsif/schema/ComplexContent.java
Index: ComplexContent.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* A class to represent a <complexContent> element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class ComplexContent {
private Restriction restriction = null;
private Extension extention = null;
/**
* Constructor
* @param el The dom element for this complexContent
*/
ComplexContent(Element el) {
NodeList children = el.getChildNodes();
for (int i=0; i<children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element subEl = (Element) child;
String elType = subEl.getLocalName();
if (elType.equals("restriction")) {
restriction = new Restriction(subEl);
break;
} else if (elType.equals("extension")) {
extention = new Extension(subEl);
break;
}
}
}
}
/**
* Get the restriction element for this complexContent
* @return A Restriction object representing the restriction
*/
public Restriction getRestriction() {
return restriction;
}
/**
* Get the extension element for this complexContent
* @return An Extension object representing the restriction
*/
public Extension getExtension() {
return extention;
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/Parser.java
Index: Parser.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.wsdl.Definition;
import javax.wsdl.Import;
import javax.wsdl.Types;
import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.xml.namespace.QName;
import org.apache.wsif.WSIFConstants;
import org.apache.wsif.util.WSIFUtils;
import org.w3c.dom.Element;
import com.ibm.wsdl.util.xml.QNameUtils;
/**
* A class used for parsing the schema(s) defined in a Definition object.
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class Parser {
private static final QName schema1999 =
new QName(WSIFConstants.NS_URI_1999_SCHEMA_XSD, "schema");
private static final QName schema2000 =
new QName(WSIFConstants.NS_URI_2000_SCHEMA_XSD, "schema");
private static final QName schema2001 =
new QName(WSIFConstants.NS_URI_2001_SCHEMA_XSD, "schema");
/**
* Given a Definition object, populate a Map with all the types defined in the
schemas in the definition and
* their corresponding Java class names.
* @param def The Definition object representing the wsdl
* @param table The Map to proulate with xml type -> Java class name (QName ->
String) mappings
*/
public static void getTypeMappings(Definition def, Map table) {
getTypeMappings(def, table, true);
}
/**
* Given a Definition object, populate a Map with all the types defined in the
schemas in the definition and
* their corresponding Java class names.
* @param def The Definition object representing the wsdl
* @param table The Map to proulate with xml type -> Java class name (QName ->
String) mappings
* @param includeStandardMappings Flag to indicate whether or not standard xsd,
soapenc and Apache SOAP mappings
* should be included in the table
*/
public static void getTypeMappings(
Definition def,
Map table,
boolean includeStandardMappings) {
ArrayList schemaList = new ArrayList();
getTypesSchemas(def, schemaList);
Hashtable standards = null;
if (includeStandardMappings) {
// set up all standard mappings
populateWithStandardMappings(
table,
WSIFConstants.NS_URI_1999_SCHEMA_XSD,
true);
populateWithStandardMappings(
table,
WSIFConstants.NS_URI_2000_SCHEMA_XSD,
false);
populateWithStandardMappings(
table,
WSIFConstants.NS_URI_2001_SCHEMA_XSD,
false);
} else {
// set up all standard mappings in a seperate map for use when resolving
arrays
standards = new Hashtable();
populateWithStandardMappings(
standards,
WSIFConstants.NS_URI_1999_SCHEMA_XSD,
true);
populateWithStandardMappings(
standards,
WSIFConstants.NS_URI_2000_SCHEMA_XSD,
false);
populateWithStandardMappings(
standards,
WSIFConstants.NS_URI_2001_SCHEMA_XSD,
false);
}
// Create temporary list to hold types which are arrays. We can then resolve
them
// after resolving all other types
List arrays = new ArrayList();
// Iterate through all the schemas found in the wsdl and imports
Iterator si = schemaList.iterator();
while (si.hasNext()) {
Schema ts = (Schema) si.next();
if (ts != null) {
// Get all the types defined in this schema
List types = ts.getTypes();
Iterator ti = types.iterator();
while (ti.hasNext()) {
SchemaType st = (SchemaType) ti.next();
// Ignore null types
if (st == null)
continue;
QName type = st.getType();
if (st.isArray()) {
arrays.add(st);
} else {
String className = resolveClassName(type);
if (className != null) {
table.put(type, className);
}
}
}
}
}
// Create a temporary list for arrays of arrays so we can resolve them last
ArrayList multiArrays = new ArrayList();
// Now we'll resolve any array types that were found
Iterator ai = arrays.iterator();
while (ai.hasNext()) {
SchemaType st = (SchemaType) ai.next();
// We've already checked that its an array so cut to the chase!
QName theType = st.getType();
QName arrayType = st.getArrayType();
if (arrayType != null && theType != null) {
String baseClass = (String) table.get(arrayType);
if (baseClass == null && standards != null) {
// Check for base class in the standard mappings
baseClass = (String) standards.get(arrayType);
}
if (baseClass == null) {
String lp = arrayType.getLocalPart();
if (lp != null && lp.startsWith("ArrayOf")) {
// This is an array of an array. Perhaps we've
// not mapped the base array yet so re-try this
// at the end
multiArrays.add(st);
}
continue;
}
// Deal with multidimentional array classes
String extraDims = "";
for (int x = 1; x < st.getArrayDimension(); x++) {
extraDims += "[";
}
if (baseClass != null) {
// Check for primitive types
if (baseClass.equals("int")) {
table.put(theType, extraDims + "[I");
} else if (baseClass.equals("float")) {
table.put(theType, extraDims + "[F");
} else if (baseClass.equals("long")) {
table.put(theType, extraDims + "[J");
} else if (baseClass.equals("double")) {
table.put(theType, extraDims + "[D");
} else if (baseClass.equals("boolean")) {
table.put(theType, extraDims + "[Z");
} else if (baseClass.equals("byte")) {
table.put(theType, extraDims + "[B");
} else if (baseClass.equals("short")) {
table.put(theType, extraDims + "[S");
} else if (baseClass.startsWith("[")) {
// The base for this array is another array!!
String arrayOfBase = "[" + baseClass;
table.put(theType, arrayOfBase);
} else {
String arrayOfBase = extraDims + "[L" + baseClass + ";";
table.put(theType, arrayOfBase);
}
}
}
}
// Now we'll resolve any arrays of arrays that are outstanding
Iterator mi = multiArrays.iterator();
while (mi.hasNext()) {
SchemaType st = (SchemaType) mi.next();
QName theType = st.getType();
QName arrayType = st.getArrayType();
if (arrayType != null && theType != null) {
String extraDims = "";
for (int x = 1; x < st.getArrayDimension(); x++) {
extraDims += "[";
}
String baseClass = (String) table.get(arrayType);
if (baseClass != null) {
// Base class should be an array
if (baseClass.startsWith("[")) {
String arrayOfBase = "[" + baseClass;
table.put(theType, arrayOfBase);
}
}
}
}
}
/**
* Populate a map with the standard xml type -> Java class name mappings
*/
private static void populateWithStandardMappings(
Map t,
String schemaURI,
boolean oneTimeAdds) {
t.put(new QName(schemaURI, "string"), "java.lang.String");
t.put(new QName(schemaURI, "integer"), "java.math.BigInteger");
t.put(new QName(schemaURI, "boolean"), "boolean");
t.put(new QName(schemaURI, "float"), "float");
t.put(new QName(schemaURI, "double"), "double");
t.put(new QName(schemaURI, "base64Binary"), "[B");
t.put(new QName(schemaURI, "hexBinary"), "[B");
t.put(new QName(schemaURI, "long"), "long");
t.put(new QName(schemaURI, "int"), "int");
t.put(new QName(schemaURI, "short"), "short");
t.put(new QName(schemaURI, "decimal"), "java.math.BigDecimal");
t.put(new QName(schemaURI, "byte"), "byte");
t.put(new QName(schemaURI, "QName"), "javax.xml.namespace.QName");
// Register dateTime or timeInstant depending on schema
if (schemaURI.equals(WSIFConstants.NS_URI_2001_SCHEMA_XSD)) {
t.put(new QName(schemaURI, "dateTime"), "java.util.Calendar");
} else {
t.put(new QName(schemaURI, "timeInstant"), "java.util.Calendar");
}
// Only add the SOAP-ENC simple types and soap collection class mappings once
if (oneTimeAdds) {
// SOAP encoding simple types
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "string"),
"java.lang.String");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "boolean"),
"java.lang.Boolean");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "float"),
"java.lang.Float");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "double"),
"java.lang.Double");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "decimal"),
"java.math.BigDecimal");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "int"),
"java.lang.Integer");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "short"),
"java.lang.Short");
t.put(
new QName(WSIFConstants.NS_URI_SOAP_ENC, "byte"),
"java.lang.Byte");
t.put(new QName(WSIFConstants.NS_URI_SOAP_ENC, "base64"), "[B");
// soap Java collection mappings
t.put(
new QName(WSIFConstants.NS_URI_APACHE_SOAP, "Map"),
"java.util.Map");
t.put(
new QName(WSIFConstants.NS_URI_APACHE_SOAP, "Vector"),
"java.util.Vector");
t.put(
new QName(WSIFConstants.NS_URI_APACHE_SOAP, "Hashtable"),
"java.util.Hashtable");
}
}
/**
* Get all the schemas defined in the Definition object
*/
private static void getTypesSchemas(Definition def, List schemas) {
Types types = def.getTypes();
if (types != null) {
Iterator extEleIt = types.getExtensibilityElements().iterator();
while (extEleIt.hasNext()) {
UnknownExtensibilityElement typesElement =
(UnknownExtensibilityElement) extEleIt.next();
Element schemaEl = typesElement.getElement();
if (QNameUtils.matches(schema2001, schemaEl)
|| QNameUtils.matches(schema2000, schemaEl)
|| QNameUtils.matches(schema1999, schemaEl)) {
schemas.add(new Schema(schemaEl));
}
}
}
Map imports = def.getImports();
if (imports != null) {
Iterator valueIterator = imports.values().iterator();
while (valueIterator.hasNext()) {
List importList = (List) valueIterator.next();
if (importList != null) {
Iterator importIterator = importList.iterator();
while (importIterator.hasNext()) {
Import tempImport = (Import) importIterator.next();
if (tempImport != null) {
Definition importedDef = tempImport.getDefinition();
if (importedDef != null) {
getTypesSchemas(importedDef, schemas);
}
}
}
}
}
}
}
/**
* Generate a Java class name corresponding to an xml type
*/
private static String resolveClassName(QName qn) {
String namespace = qn.getNamespaceURI();
String localPart = qn.getLocalPart();
String packageName =
WSIFUtils.getPackageNameFromNamespaceURI(namespace);
String className = WSIFUtils.getJavaClassNameFromXMLName(localPart);
if (packageName != null
&& !packageName.equals("")
&& className != null
&& !className.equals("")) {
return packageName + "." + className;
}
return null;
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/Extension.java
Index: Extension.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import org.w3c.dom.Element;
/**
* A class to represent an <extension> element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class Extension {
/**
* Constructor
* @param el The dom element for this extension
*/
Extension(Element el) {
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/ComplexType.java
Index: ComplexType.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import java.util.Vector;
import javax.xml.namespace.QName;
import org.apache.wsif.WSIFConstants;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* A class to represent a <complexType> element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class ComplexType extends SchemaType {
private boolean isAnArray = false;
private String name = "";
private QName type = null;
private QName arrayType = null;
private int arrayDim = 0;
private ComplexContent complexContent = null;
private static final QName soapEncArray =
new QName(WSIFConstants.NS_URI_SOAP_ENC, "Array");
private static final QName soapEncArrayType =
new QName(WSIFConstants.NS_URI_SOAP_ENC, "arrayType");
private static final QName wsdlArrayType =
new QName(WSIFConstants.NS_URI_WSDL, "arrayType");
/**
* Constructor
* @param el The dom element for this complexType
*/
ComplexType(Element el, String tns) {
type = getAttributeQName(el, "name", tns);
name = type.getLocalPart();
process(el);
if (name.startsWith("ArrayOf")) {
if (complexContent != null) {
Restriction res = complexContent.getRestriction();
if (res != null) {
QName base = res.getBase();
if (soapEncArray.equals(base)) {
Attribute[] atts = res.getAttributes();
if (atts != null && atts.length > 0) {
for (int i = 0; i < atts.length; i++) {
Attribute a = atts[i];
if (a != null) {
QName ref = a.getXMLAttribute("ref");
if (soapEncArrayType.equals(ref)) {
QName tempType =
a.getXMLAttribute(wsdlArrayType);
if (tempType != null) {
String ns =
tempType.getNamespaceURI();
String lp = tempType.getLocalPart();
// Work out array dimension
int index = lp.lastIndexOf("[]");
while(index != -1) {
lp = lp.substring(0, index);
arrayDim++;
index = lp.lastIndexOf("[]");
}
arrayType = new QName(ns, lp);
}
break;
}
}
}
} else {
SequenceElement[] sels = res.getSequenceElements();
if (sels != null && sels.length == 1) {
SequenceElement sel =
sels[0];
QName tempType =
sel.getXMLAttribute("type");
if (tempType != null) {
String ns =
tempType.getNamespaceURI();
String lp = tempType.getLocalPart();
arrayType = new QName(ns, lp);
}
}
}
}
}
isAnArray = true;
}
} else {
}
}
/**
* @see SchemaType#isComplex()
*/
public boolean isComplex() {
return true;
}
/**
* @see SchemaType#isArray()
*/
public boolean isArray() {
return isAnArray;
}
/**
* @see SchemaType#getArrayType()
*/
public QName getArrayType() {
return arrayType;
}
/**
* @see SchemaType#getArrayDimension()
*/
public int getArrayDimension() {
return arrayDim;
}
/**
* @see SchemaType#getType()
*/
public QName getType() {
return type;
}
private void process(Element el) {
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element subEl = (Element) child;
String elType = subEl.getLocalName();
if (elType.equals("complexContent")) {
complexContent = new ComplexContent(subEl);
break;
}
}
}
}
}
1.1
xml-axis-wsif/java/src/org/apache/wsif/schema/SequenceElement.java
Index: SequenceElement.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
/**
* A class to represent an <element> element defined within a <sequence>
element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class SequenceElement {
Element thisElement = null;
/**
* Constructor
* @param el The dom element for this element within a sequence
*/
SequenceElement(Element el) {
thisElement = el;
}
/**
* Get the value of a specified attribute on this element
* @param The name of the attribute
* @return The value of the attribute or null if the attribute does not exist
*/
QName getXMLAttribute(String name) {
return SchemaType.getAttributeQName(thisElement, name);
}
/**
* Get the value of a specified attribute on this element when the attribute
name is
* a QName
* @param The name of the attribute
* @return The value of the attribute or null if the attribute does not exist
*/
QName getXMLAttribute(QName name) {
return SchemaType.getAttributeQName(thisElement, name);
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/SchemaType.java
Index: SchemaType.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
import com.ibm.wsdl.util.xml.DOMUtils;
/**
* Super class of both ComplexType and SimpleType
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public abstract class SchemaType {
/**
* Get a flag to indicate if this type is a complexType
* @return The boolean flag
*/
public boolean isComplex() {
return false;
}
/**
* Get a flag to indicate if this type represents an array
* @return The boolean flag
*/
public boolean isArray() {
return false;
}
/**
* Get the type of the elements in the array represented by this type (if
applicable)
* @return The type
*/
public QName getArrayType() {
return null;
}
/**
* Get the dimension of the array represented by this type (if applicable)
* @return The dimension
*/
public int getArrayDimension() {
return 0;
}
/**
* Get the "type" attribute of this type
* @return The type
*/
public QName getType() {
return null;
}
/**
* Get a specified attribute from a given dom element
* @param element The dom element
* @param attr The name of the attribute to retrieve
* @return The attribute value or null is the attriute does not exist
*/
protected static QName getAttributeQName(Element element, String attr) {
if (element == null || attr == null)
throw new IllegalArgumentException(
"Argument to 'getAttrQName' " + "cannot be null.");
String name = DOMUtils.getAttribute(element, attr);
if (name == null)
return null;
int index = name.lastIndexOf(":");
String prefix = null;
if (index != -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1);
}
String uri = DOMUtils.getNamespaceURIFromPrefix(element, prefix);
return new QName(uri, name);
}
/**
* Get a specified attribute from a given dom element
* @param element The dom element
* @param attr The name of the attribute to retrieve
* @param tns The targetNamespace used in resolving the attribute value
* @return The attribute value or null is the attriute does not exist
*/
protected static QName getAttributeQName(Element element, String attr, String
tns) {
if (element == null || attr == null)
throw new IllegalArgumentException(
"Argument to 'getAttrQName' " + "cannot be null.");
String name = DOMUtils.getAttribute(element, attr);
if (name == null)
return null;
int index = name.lastIndexOf(":");
String prefix = null;
if (index != -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1);
}
String uri = null;
if (prefix != null) {
uri = DOMUtils.getNamespaceURIFromPrefix(element, prefix);
} else {
uri = tns;
}
return new QName(uri, name);
}
/**
* Get a specified attribute from a given dom element when the attribute name
is a QName
* @param element The dom element
* @param attr The name of the attribute to retrieve
* @return The attribute value or null is the attriute does not exist
*/
protected static QName getAttributeQName(Element element, QName attr) {
if (element == null || attr == null)
throw new IllegalArgumentException(
"Argument to 'getAttrQName' " + "cannot be null.");
String ns = attr.getNamespaceURI();
String lp = attr.getLocalPart();
String name = DOMUtils.getAttributeNS(element, ns, lp);
if (name == null)
return null;
int index = name.lastIndexOf(":");
String prefix = null;
if (index != -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1);
}
String uri = DOMUtils.getNamespaceURIFromPrefix(element, prefix);
return new QName(uri, name);
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/Restriction.java
Index: Restriction.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import java.util.ArrayList;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* A class to represent a <restriction> element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class Restriction {
QName base = null;
ArrayList attributes = new ArrayList();
ArrayList sequenceElements = new ArrayList();
/**
* Constructor
* @param el The dom element for this restriction
*/
Restriction(Element el) {
base = SchemaType.getAttributeQName(el, "base");
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element subEl = (Element) child;
String elType = subEl.getLocalName();
if (elType == "attribute") {
attributes.add(new Attribute(subEl));
} else if (elType == "sequence") {
parseSequenceElements(subEl);
}
}
}
}
/**
* Get the "base" attribute for this restriction
* @return The "base" attribute
*/
public QName getBase() {
return base;
}
/**
* Get all the <attribute> elements within this restriction
* @return The <attribute> elements
*/
public Attribute[] getAttributes() {
return (Attribute[]) attributes.toArray(
new Attribute[attributes.size()]);
}
/**
* Get all the <element> elements within a sequence within this
restriction
* @return The <element> elements within the sequnce
*/
public SequenceElement[] getSequenceElements() {
return (SequenceElement[]) sequenceElements.toArray(
new SequenceElement[sequenceElements.size()]);
}
private void parseSequenceElements(Element el) {
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element subEl = (Element) child;
String elType = subEl.getLocalName();
if (elType == "element") {
sequenceElements.add(new SequenceElement(subEl));
}
}
}
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/Schema.java
Index: Schema.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* A class to represent the tpo level <schema> element of a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class Schema {
private String targetNamespace = "";
private ArrayList types = new ArrayList();
/**
* Constructor
* @param el The dom element for this schema
*/
Schema(Element el) {
targetNamespace = el.getAttribute("targetNamespace");
NodeList children = el.getChildNodes();
for (int i=0; i<children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element subEl = (Element) child;
String elType = subEl.getLocalName();
if (elType.equals("complexType")) {
types.add(new ComplexType(subEl,
targetNamespace));
} else if (elType.equals("simpleType")) {
types.add(new SimpleType(subEl,
targetNamespace));
} else {
//ignore all other types
}
}
}
}
/**
* Get a list of all the types within this schema
* @return A list of SchemaType objects
*/
List getTypes() {
return types;
}
/**
* Get the "targetNamespace" attribute for this schema
* @return The "targetNamespace" attribute
*/
String getTargetNamespace() {
return null;
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/SimpleType.java
Index: SimpleType.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
/**
* A class to represent a <simpleType> element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class SimpleType extends SchemaType {
private String name = "";
private QName type = null;
/**
* Constructor
* @param el The dom element for this simpleType
*/
SimpleType(Element el, String tns) {
type = getAttributeQName(el, "name", tns);
name = type.getLocalPart();
}
/**
* @see SchemaType#isComplex()
*/
public boolean isComplex() {
return false;
}
/**
* @see SchemaType#getType()
*/
public QName getType() {
return type;
}
}
1.1 xml-axis-wsif/java/src/org/apache/wsif/schema/Attribute.java
Index: Attribute.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.wsif.schema;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
/**
* A class to represent an <attribute> element in a schema
*
* @author Owen Burroughs <[EMAIL PROTECTED]>
*/
public class Attribute {
Element thisElement = null;
/**
* Constructor
* @param el The dom element for this attribute
*/
Attribute(Element el) {
thisElement = el;
}
/**
* Get the value of a specified attribute on this element
* @param The name of the attribute
* @return The value of the attribute or null if the attribute does not exist
*/
QName getXMLAttribute(String name) {
return SchemaType.getAttributeQName(thisElement, name);
}
/**
* Get the value of a specified attribute on this element when the attribute
name is
* a QName
* @param The name of the attribute
* @return The value of the attribute or null if the attribute does not exist
*/
QName getXMLAttribute(QName name) {
return SchemaType.getAttributeQName(thisElement, name);
}
}
1.12 +5 -0 xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java
Index: WSIFConstants.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WSIFConstants.java 30 Jul 2002 16:02:29 -0000 1.11
+++ WSIFConstants.java 15 Oct 2002 15:33:12 -0000 1.12
@@ -210,4 +210,9 @@
public static final String NS_URI_LITERAL_XML =
"http://xml.apache.org/xml-soap/literalxml";
+ public static final String NS_URI_WSDL =
+ "http://schemas.xmlsoap.org/wsdl/";
+
+ public static final String NS_URI_APACHE_SOAP =
+ "http://xml.apache.org/xml-soap";
}