axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
Date Fri, 19 Dec 2003 14:58:30 GMT
ias         2003/12/19 06:58:30

  Modified:    java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
  Log:
  Added isListWithItemType and getListItemType methods to support <xsd:list itemType>
  
  Revision  Changes    Path
  1.33      +56 -0     ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- SchemaUtils.java	19 Dec 2003 08:57:16 -0000	1.32
  +++ SchemaUtils.java	19 Dec 2003 14:58:29 -0000	1.33
  @@ -1776,4 +1776,60 @@
           }
           return base;
       }
  +
  +    /**
  +     * Returns whether the specified node represents a <xsd:simpleType> 
  +     * with a nested <xsd:list itemType="...">.
  +     * @param node 
  +     * @return 
  +     */
  +    public static boolean isListWithItemType(Node node) {
  +        
  +        return getListItemType(node) != null;
  +    }
  +
  +    /**
  +     * Returns the value of itemType attribute of <xsd:list> in <xsd:simpleType>

  +     * @param node 
  +     * @return 
  +     */
  +    public static QName getListItemType(Node node) {
  +        
  +        if (node == null) {
  +            return null;
  +        }
  +        
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (isXSDNode(node, "element")) {
  +            NodeList children = node.getChildNodes();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                if (isXSDNode(children.item(j), "simpleType")) {
  +                    node = children.item(j);
  +                    break;
  +                }
  +            }
  +        }
  +        // Get the node kind, expecting a schema simpleType
  +        if (isXSDNode(node, "simpleType")) {
  +            NodeList children = node.getChildNodes();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                if (isXSDNode(children.item(j), "list")) {
  +                    Node listNode = children.item(j);
  +                    org.w3c.dom.Element listElement = 
  +                    (org.w3c.dom.Element) listNode;
  +                    String type = listElement.getAttribute("itemType");
  +                    if (type.equals("")) {
  +                        return null;
  +                    }
  +                    int colonIndex = type.lastIndexOf(":");
  +                    if (colonIndex > 0) {
  +                        type = type.substring(colonIndex + 1);
  +                    }
  +                    return new QName(Constants.URI_2001_SCHEMA_XSD, type + "[]");
  +                }
  +            }
  +        }
  +        return null;
  +    }
   }
  
  
  

Mime
View raw message