axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema ValidationEvent.java ValidationEventHandler.java XmlSchema.java XmlSchemaAll.java XmlSchemaAnnotated.java XmlSchemaAnnotation.java XmlSchemaAny.java XmlSchemaAnyAttribute.java XmlSchemaAppInfo.java XmlSchemaAttribute.java XmlSchemaAttributeGroup.java XmlSchemaAttributeGroupRef.java XmlSchemaChoice.java XmlSchemaCollection.java XmlSchemaCollectionEnumerator.java XmlSchemaComplexContent.java XmlSchemaComplexContentExtension.java XmlSchemaComplexContentRestriction.java XmlSchemaComplexType.java XmlSchemaContent.java XmlSchemaContentModel.java XmlSchemaContentProcessing.java XmlSchemaContentType.java XmlSchemaDatatype.java XmlSchemaDerivationMethod.java XmlSchemaDocumentation.java XmlSchemaElement.java XmlSchemaEnumerationFacet.java XmlSchemaException.java XmlSchemaExternal.java XmlSchemaFacet.java XmlSchemaForm.java XmlSchemaFractionDigitsFacet.java XmlSchemaGroup.java XmlSchemaGroupBase.java XmlSchemaGroupRef.java XmlSchemaIdentityConstraint.java XmlSchemaImport.java XmlSchemaInclude.java XmlSchemaKey.java XmlSchemaKeyref.java XmlSchemaLengthFacet.java XmlSchemaMaxExclusiveFacet.java XmlSchemaMaxInclusiveFacet.java XmlSchemaMaxLengthFacet.java XmlSchemaMinExclusiveFacet.java XmlSchemaMinInclusiveFacet.java XmlSchemaMinLengthFacet.java XmlSchemaNotation.java XmlSchemaNumericFacet.java XmlSchemaObject.java XmlSchemaObjectCollection.java XmlSchemaObjectEnumerator.java XmlSchemaObjectTable.java XmlSchemaParticle.java XmlSchemaPatternFacet.java XmlSchemaRedefine.java XmlSchemaSequence.java XmlSchemaSerializer.java XmlSchemaSimpleContent.java XmlSchemaSimpleContentExtension.java XmlSchemaSimpleContentRestriction.java XmlSchemaSimpleType.java XmlSchemaSimpleTypeContent.java XmlSchemaSimpleTypeList.java XmlSchemaSimpleTypeRestriction.java XmlSchemaSimpleTypeUnion.java XmlSchemaTotalDigitsFacet.java XmlSchemaType.java XmlSchemaUnique.java XmlSchemaUse.java XmlSchemaWhiteSpaceFacet.java XmlSchemaXPath.java XmlSeverityType.java
Date Sun, 17 Nov 2002 23:26:02 GMT
dims        2002/11/17 15:26:01

  Added:       proposals/XmlSchema build.xml
               proposals/XmlSchema/src/org/apache/axis/xsd/enum Enum.java
               proposals/XmlSchema/src/org/apache/axis/xsd/str
                        Tokenizer.java
               proposals/XmlSchema/src/org/apache/axis/xsd/xml DOMUtil.java
                        QualifiedName.java XDOMUtil.java
                        XmlTokenizedType.java
               proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema
                        ValidationEvent.java ValidationEventHandler.java
                        XmlSchema.java XmlSchemaAll.java
                        XmlSchemaAnnotated.java XmlSchemaAnnotation.java
                        XmlSchemaAny.java XmlSchemaAnyAttribute.java
                        XmlSchemaAppInfo.java XmlSchemaAttribute.java
                        XmlSchemaAttributeGroup.java
                        XmlSchemaAttributeGroupRef.java
                        XmlSchemaChoice.java XmlSchemaCollection.java
                        XmlSchemaCollectionEnumerator.java
                        XmlSchemaComplexContent.java
                        XmlSchemaComplexContentExtension.java
                        XmlSchemaComplexContentRestriction.java
                        XmlSchemaComplexType.java XmlSchemaContent.java
                        XmlSchemaContentModel.java
                        XmlSchemaContentProcessing.java
                        XmlSchemaContentType.java XmlSchemaDatatype.java
                        XmlSchemaDerivationMethod.java
                        XmlSchemaDocumentation.java XmlSchemaElement.java
                        XmlSchemaEnumerationFacet.java
                        XmlSchemaException.java XmlSchemaExternal.java
                        XmlSchemaFacet.java XmlSchemaForm.java
                        XmlSchemaFractionDigitsFacet.java
                        XmlSchemaGroup.java XmlSchemaGroupBase.java
                        XmlSchemaGroupRef.java
                        XmlSchemaIdentityConstraint.java
                        XmlSchemaImport.java XmlSchemaInclude.java
                        XmlSchemaKey.java XmlSchemaKeyref.java
                        XmlSchemaLengthFacet.java
                        XmlSchemaMaxExclusiveFacet.java
                        XmlSchemaMaxInclusiveFacet.java
                        XmlSchemaMaxLengthFacet.java
                        XmlSchemaMinExclusiveFacet.java
                        XmlSchemaMinInclusiveFacet.java
                        XmlSchemaMinLengthFacet.java XmlSchemaNotation.java
                        XmlSchemaNumericFacet.java XmlSchemaObject.java
                        XmlSchemaObjectCollection.java
                        XmlSchemaObjectEnumerator.java
                        XmlSchemaObjectTable.java XmlSchemaParticle.java
                        XmlSchemaPatternFacet.java XmlSchemaRedefine.java
                        XmlSchemaSequence.java XmlSchemaSerializer.java
                        XmlSchemaSimpleContent.java
                        XmlSchemaSimpleContentExtension.java
                        XmlSchemaSimpleContentRestriction.java
                        XmlSchemaSimpleType.java
                        XmlSchemaSimpleTypeContent.java
                        XmlSchemaSimpleTypeList.java
                        XmlSchemaSimpleTypeRestriction.java
                        XmlSchemaSimpleTypeUnion.java
                        XmlSchemaTotalDigitsFacet.java XmlSchemaType.java
                        XmlSchemaUnique.java XmlSchemaUse.java
                        XmlSchemaWhiteSpaceFacet.java XmlSchemaXPath.java
                        XmlSeverityType.java
  Log:
  Initial Check-in for XmlSchema contribution from Infravio. See http://marc.theaimsgroup.com/?l=axis-dev&m=103730422816140&w=2 for details.
  
  Revision  Changes    Path
  1.1                  xml-axis/proposals/XmlSchema/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  <project name="XmlSchema" basedir="." default="compile">
  
  	<property name="src.dir" value="${basedir}/src"/>
  	<property name="project.name" value="XmlSchema"/>
  	<property name="output.jar" value="${project.name}.jar"/>
  	<property name="build.dir" value="${basedir}/build"/>
  	<property name="build_classes.dir" value="${build.dir}/classes"/>
  	<property name="build_lib.dir" value="${build.dir}/lib"/>	
  	<property name="build_doc.dir" value="${build.dir}/apidoc"/>	
  	<property name="dist.dir" value="${build.dir}/dist"/>
  	<property name="dist.zip" value="${project.name}.zip"/>
  	<property name="srcdist.zip" value="${project.name}-src.zip"/>
  
      <target name="prepare">
  		<mkdir dir="${build_classes.dir}"/>
  		<mkdir dir="${build_lib.dir}"/>
      </target>
  
      <target name="compile" depends="prepare" description="compiles the src and puts it in build/classes">
  		<javac srcdir="${src.dir}" destdir="${build_classes.dir}" debug="true" 
  		       deprecation="true">
          	<include name="**/*.java" />
  	    </javac>
      </target>
  
      <target name="jar" depends="compile" description="compiles the src and creates XmlSchema.jar in  build/lib">
          <jar jarfile="${build_lib.dir}/${output.jar}" compress="true" basedir="${build_classes.dir}"/>
      </target>
  
      <target name="javadoc" depends="compile" description="Javadoc for Xml Schema API.">
          <mkdir dir="${build_doc.dir}"/>
          <javadoc packagenames="org.apache.axis.xsd.*" 
  		             destdir="${build.dir}/apidoc" 
  		             windowtitle="${project.name} API"
  		             doctitle="${project.name}"
  					 bottom="Copyright &#169;  Infravio XML Schema Project. All Rights Reserved.">
  		
              <classpath>
                  <pathelement location="${build_classes.dir}"/>
              </classpath>
              <sourcepath>
                  <pathelement location="${src.dir}"/>
              </sourcepath>
          </javadoc>
      </target>
  
      <target name="clean" depends="prepare" description="Clean all build products.">
          <delete dir="${build.dir}"/>
      </target>
  
  	<target name="dist" depends="jar,javadoc" description="Creates a binary distribution(XmlSchema.zip) in build/dist">
  	    <mkdir dir="${dist.dir}"/>
  		<zip zipfile="${dist.dir}/${dist.zip}">
  		    <zipfileset dir="${build_lib.dir}" prefix="${project.name}/lib"/>
  		    <zipfileset dir="${build_doc.dir}" prefix="${project.name}/doc"/>
  		</zip>	
  	</target>
  
  	<target name="srcdist" depends="compile" description="Creates a source distribution(XmlSchema-src.zip) in build/dist">
  	    <mkdir dir="${dist.dir}"/>
  		<zip zipfile="${dist.dir}/${srcdist.zip}">
  		    <zipfileset dir="${basedir}" includes="build.xml" prefix="${project.name}"/>
  			<zipfileset dir="${src.dir}" prefix="${project.name}/src"/>
  		</zip>	
  	</target>
  	
  </project>
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/enum/Enum.java
  
  Index: Enum.java
  ===================================================================
  /*
   * Enum.java
   *
   * Created on October 12, 2001, 3:25 PM
   */
  
  package org.apache.axis.xsd.enum;
  
  /**
   *
   * @author  mukund
   */
  
  public abstract class Enum {
      
      public static String NULL = "NULL";
  
      protected Enum(String value) {
  	setValue(value);
      }
  
      protected Enum() {
  	this(NULL);
      }
  
      protected abstract String[] getValues();
  
      protected String value = NULL;
  
      public void setValue(String value) {
  	if( value.equals(Enum.NULL) )
  	    this.value = Enum.NULL;
  	else {
  	    String values[] = getValues();
  	    for( int i = 0; i < values.length; i++ ) {
  		if( values[i].equals(value) ) {
  		    this.value = value;
  		    break;
  		}
  		if( i == values.length - 1 )
  		    throw new EnumValueException("Bad Enumeration value");
  	    }
  	}
      }
  
      public String getValue() {
  	return value;
      }
  
      public String toString() {
  	return value;
      }
      
      public boolean equals(Object what) {
          return what.getClass().equals(this.getClass()) && 
  			((Enum)what).getValue().equals(this.getValue());
      }
      
      public static class EnumValueException extends RuntimeException {
  	public EnumValueException(String mesg) {
  	    super(mesg);
  	}
      }
      
      protected static final int index(String value, String values[]) {
          for( int i = 0; i < values.length; i++ ) {
              if( value.equals(values[i]) )
                  return i;
          }
          return -1;
      }
  }
  
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/str/Tokenizer.java
  
  Index: Tokenizer.java
  ===================================================================
  /*
   * Tokenizer.java
   *
   * Created on November 8, 2001, 5:13 PM
   */
  
  package org.apache.axis.xsd.str;
  
  import java.util.Vector;
  import java.util.StringTokenizer;
  
  /**
   *
   * @author  mukund
   */
  
  public class Tokenizer {
  
      /** Cannot create new Tokenizer */
      private Tokenizer() {
      }
      
      public static final String[] tokenize(String in, String delim) {
  		Vector tmp = new Vector();
  		StringTokenizer stk = new StringTokenizer(in, delim);
  		while( stk.hasMoreTokens() ) {
  			String str = stk.nextToken();
  			if( str.trim().length() != 0 )
  				tmp.addElement(str);
  		}
  		return (String[])tmp.toArray(new String[tmp.size()]);
      }
      
      public static final String[] firstToken(String in, String delim) {
          int x = in.indexOf(delim);
          if( x == -1 )
              return new String[] { in, "" };
          return new String[] { in.substring(0, x), 
  							  in.substring(x + delim.length(), in.length()) };
      }
      
      public static final String[] lastToken(String in, String delim) {
          int x = in.lastIndexOf(delim);
          if( x == -1 )
              return new String[] { "", in };
          return new String[] { in.substring(0, x), 
  							  in.substring(x + delim.length(), in.length()) };
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/DOMUtil.java
  
  Index: DOMUtil.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-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 "Xerces" 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 apache@apache.org.
   *
   * 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) 1999, 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.axis.xsd.xml;
  
  import org.w3c.dom.Attr;
  import org.w3c.dom.Document;
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Element;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  
  /**
   * Some useful utility methods.
   * This class was modified in Xerces2 with a view to abstracting as
   * much as possible away from the representation of the underlying
   * parsed structure (i.e., the DOM).  This was done so that, if Xerces
   * ever adopts an in-memory representation more efficient than the DOM
   * (such as a DTM), we should easily be able to convert our schema
   * parsing to utilize it.
   *
   * @version $ID DOMUtil
   */
  public class DOMUtil {
  
      //
      // Constructors
      //
  
      /** This class cannot be instantiated. */
      protected DOMUtil() {}
  
      //
      // Public static methods
      //
  
      /** Finds and returns the first child element node. */
      public static Element getFirstChildElement(Node parent) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  return (Element)child;
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getFirstChildElement(Node):Element
  
      /** Finds and returns the last child element node. */
      public static Element getLastChildElement(Node parent) {
  
          // search for node
          Node child = parent.getLastChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  return (Element)child;
              }
              child = child.getPreviousSibling();
          }
  
          // not found
          return null;
  
      } // getLastChildElement(Node):Element
  
  
      /** Finds and returns the next sibling element node. */
      public static Element getNextSiblingElement(Node node) {
  
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  return (Element)sibling;
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getNextSiblingElement(Node):Element
  
      /** Finds and returns the first child node with the given name. */
      public static Element getFirstChildElement(Node parent, String elemName) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  if (child.getNodeName().equals(elemName)) {
                      return (Element)child;
                  }
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getFirstChildElement(Node,String):Element
  
      /** Finds and returns the last child node with the given name. */
      public static Element getLastChildElement(Node parent, String elemName) {
  
          // search for node
          Node child = parent.getLastChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  if (child.getNodeName().equals(elemName)) {
                      return (Element)child;
                  }
              }
              child = child.getPreviousSibling();
          }
  
          // not found
          return null;
  
      } // getLastChildElement(Node,String):Element
  
      /** Finds and returns the next sibling node with the given name. */
      public static Element getNextSiblingElement(Node node, String elemName) {
  
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  if (sibling.getNodeName().equals(elemName)) {
                      return (Element)sibling;
                  }
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getNextSiblingdElement(Node,String):Element
  
      /** Finds and returns the first child node with the given qualified name. */
      public static Element getFirstChildElementNS(Node parent,
                                                   String uri, String localpart) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  String childURI = child.getNamespaceURI();
                  if (childURI != null && childURI.equals(uri) &&
                      child.getLocalName().equals(localpart)) {
                      return (Element)child;
                  }
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getFirstChildElementNS(Node,String,String):Element
  
      /** Finds and returns the last child node with the given qualified name. */
      public static Element getLastChildElementNS(Node parent,
                                                  String uri, String localpart) {
  
          // search for node
          Node child = parent.getLastChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  String childURI = child.getNamespaceURI();
                  if (childURI != null && childURI.equals(uri) &&
                      child.getLocalName().equals(localpart)) {
                      return (Element)child;
                  }
              }
              child = child.getPreviousSibling();
          }
  
          // not found
          return null;
  
      } // getLastChildElementNS(Node,String,String):Element
  
      /** Finds and returns the next sibling node with the given qualified name. */
      public static Element getNextSiblingElementNS(Node node,
                                                    String uri, String localpart) {
  
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  String siblingURI = sibling.getNamespaceURI();
                  if (siblingURI != null && siblingURI.equals(uri) &&
                      sibling.getLocalName().equals(localpart)) {
                      return (Element)sibling;
                  }
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getNextSiblingdElementNS(Node,String,String):Element
  
      /** Finds and returns the first child node with the given name. */
      public static Element getFirstChildElement(Node parent, String elemNames[]) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  for (int i = 0; i < elemNames.length; i++) {
                      if (child.getNodeName().equals(elemNames[i])) {
                          return (Element)child;
                      }
                  }
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getFirstChildElement(Node,String[]):Element
  
      /** Finds and returns the last child node with the given name. */
      public static Element getLastChildElement(Node parent, String elemNames[]) {
  
          // search for node
          Node child = parent.getLastChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  for (int i = 0; i < elemNames.length; i++) {
                      if (child.getNodeName().equals(elemNames[i])) {
                          return (Element)child;
                      }
                  }
              }
              child = child.getPreviousSibling();
          }
  
          // not found
          return null;
  
      } // getLastChildElement(Node,String[]):Element
  
      /** Finds and returns the next sibling node with the given name. */
      public static Element getNextSiblingElement(Node node, String elemNames[]) {
  
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  for (int i = 0; i < elemNames.length; i++) {
                      if (sibling.getNodeName().equals(elemNames[i])) {
                          return (Element)sibling;
                      }
                  }
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getNextSiblingdElement(Node,String[]):Element
  
      /** Finds and returns the first child node with the given qualified name. */
      public static Element getFirstChildElementNS(Node parent,
                                                   String[][] elemNames) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  for (int i = 0; i < elemNames.length; i++) {
                      String uri = child.getNamespaceURI();
                      if (uri != null && uri.equals(elemNames[i][0]) &&
                          child.getLocalName().equals(elemNames[i][1])) {
                          return (Element)child;
                      }
                  }
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getFirstChildElementNS(Node,String[][]):Element
  
      /** Finds and returns the last child node with the given qualified name. */
      public static Element getLastChildElementNS(Node parent,
                                                  String[][] elemNames) {
  
          // search for node
          Node child = parent.getLastChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  for (int i = 0; i < elemNames.length; i++) {
                      String uri = child.getNamespaceURI();
                      if (uri != null && uri.equals(elemNames[i][0]) &&
                          child.getLocalName().equals(elemNames[i][1])) {
                          return (Element)child;
                      }
                  }
              }
              child = child.getPreviousSibling();
          }
  
          // not found
          return null;
  
      } // getLastChildElementNS(Node,String[][]):Element
  
      /** Finds and returns the next sibling node with the given qualified name. */
      public static Element getNextSiblingElementNS(Node node,
                                                    String[][] elemNames) {
  
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  for (int i = 0; i < elemNames.length; i++) {
                      String uri = sibling.getNamespaceURI();
                      if (uri != null && uri.equals(elemNames[i][0]) &&
                          sibling.getLocalName().equals(elemNames[i][1])) {
                          return (Element)sibling;
                      }
                  }
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getNextSiblingdElementNS(Node,String[][]):Element
  
      /**
       * Finds and returns the first child node with the given name and
       * attribute name, value pair.
       */
      public static Element getFirstChildElement(Node   parent,
                                                 String elemName,
                                                 String attrName,
                                                 String attrValue) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  Element element = (Element)child;
                  if (element.getNodeName().equals(elemName) &&
                      element.getAttribute(attrName).equals(attrValue)) {
                      return element;
                  }
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getFirstChildElement(Node,String,String,String):Element
  
      /**
       * Finds and returns the last child node with the given name and
       * attribute name, value pair.
       */
      public static Element getLastChildElement(Node   parent,
                                                 String elemName,
                                                 String attrName,
                                                 String attrValue) {
  
          // search for node
          Node child = parent.getLastChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  Element element = (Element)child;
                  if (element.getNodeName().equals(elemName) &&
                      element.getAttribute(attrName).equals(attrValue)) {
                      return element;
                  }
              }
              child = child.getPreviousSibling();
          }
  
          // not found
          return null;
  
      } // getLastChildElement(Node,String,String,String):Element
  
      /**
       * Finds and returns the next sibling node with the given name and
       * attribute name, value pair. Since only elements have attributes,
       * the node returned will be of type Node.ELEMENT_NODE.
       */
      public static Element getNextSiblingElement(Node   node,
                                                  String elemName,
                                                  String attrName,
                                                  String attrValue) {
  
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  Element element = (Element)sibling;
                  if (element.getNodeName().equals(elemName) &&
                      element.getAttribute(attrName).equals(attrValue)) {
                      return element;
                  }
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
  
      } // getNextSiblingElement(Node,String,String,String):Element
  
      /**
       * Returns the concatenated child text of the specified node.
       * This method only looks at the immediate children of type
       * <code>Node.TEXT_NODE</code> or the children of any child
       * node that is of type <code>Node.CDATA_SECTION_NODE</code>
       * for the concatenation.
       *
       * @param node The node to look at.
       */
      public static String getChildText(Node node) {
  
          // is there anything to do?
          if (node == null) {
              return null;
          }
  
          // concatenate children text
          StringBuffer str = new StringBuffer();
          Node child = node.getFirstChild();
          while (child != null) {
              short type = child.getNodeType();
              if (type == Node.TEXT_NODE) {
                  str.append(child.getNodeValue());
              }
              else if (type == Node.CDATA_SECTION_NODE) {
                  str.append(getChildText(child));
              }
              child = child.getNextSibling();
          }
  
          // return text value
          return str.toString();
  
      } // getChildText(Node):String
  
      // return the name of this element
      public static String getName(Node node) {
          return node.getNodeName();
      } // getLocalName(Element):  String
  
      /** returns local name of this element if not null, otherwise
          returns the name of the node
      */
      public static String getLocalName(Node node) {
          String name = node.getLocalName();
          return (name!=null)? name:node.getNodeName();
      } // getLocalName(Element):  String
  
      public static Element getParent(Element elem) {
          Node parent = elem.getParentNode();
          if (parent instanceof Element)
              return (Element)parent;
          return null;
      } // getParent(Element):Element
  
      // get the Document of which this Node is a part
      public static Document getDocument(Node node) {
          return node.getOwnerDocument();
      } // getDocument(Node):Document
  
      // return this Document's root node
      public static Element getRoot(Document doc) {
          return doc.getDocumentElement();
       } // getRoot(Document(:  Element
  
     // some methods for handling attributes:
  
      // return the right attribute node
      public static Attr getAttr(Element elem, String name) {
          return elem.getAttributeNode(name);
      } // getAttr(Element, String):Attr
  
      // return the right attribute node
      public static Attr getAttrNS(Element elem, String nsUri,
              String localName) {
          return elem.getAttributeNodeNS(nsUri, localName);
      } // getAttrNS(Element, String):Attr
  
      // get all the attributes for an Element
      public static Attr[] getAttrs(Element elem) {
          NamedNodeMap attrMap = elem.getAttributes();
          Attr [] attrArray = new Attr[attrMap.getLength()];
          for (int i=0; i<attrMap.getLength(); i++)
              attrArray[i] = (Attr)attrMap.item(i);
          return attrArray;
      } // getAttrs(Element):  Attr[]
  
      // get attribute's value
      public static String getValue(Attr attribute) {
          return attribute.getValue();
      } // getValue(Attr):String
  
      // It is noteworthy that, because of the way the DOM specs
      // work, the next two methods return the empty string (not
      // null!) when the attribute with the specified name does not
      // exist on an element.  Beware!
  
      // return the value of the attribute of the given element
      // with the given name
      public static String getAttrValue(Element elem, String name) {
          return elem.getAttribute(name);
      } // getAttr(Element, String):Attr
  
      // return the value of the attribute of the given element
      // with the given name
      public static String getAttrValueNS(Element elem, String nsUri,
              String localName) {
          return elem.getAttributeNS(nsUri, localName);
      } // getAttrValueNS(Element, String):Attr
  
      // return the namespace URI
      public static String getNamespaceURI(Node node) {
          return node.getNamespaceURI();
      }
  } // class XUtil
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/QualifiedName.java
  
  Index: QualifiedName.java
  ===================================================================
  package org.apache.axis.xsd.xml;
  
  
  /**
   * @author momo
   */
  
  // Oct 15th - Momo - Initial Impl
  
  public class QualifiedName {
  
  	String name, namespace;
  	
      public QualifiedName() {
      }
  	
  	public QualifiedName(String name) {
  		this.name = name;
  	}
  	
  	public QualifiedName(String name, String namespace) {
  		this.name = name;
  		this.namespace = namespace;
  	}
  	
  	
  	public boolean isEmpty() {
  		return (name == null);
  	}
  	
  	public String getName() {
              if (name.indexOf(":")<0)
  		return name;
              else
                  return (name.substring(name.indexOf(":")+1));
  	}
  
  	public String getNameSpace() {
  		return namespace;
  	}
  	
  	public String toString() {
  		return name;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/XDOMUtil.java
  
  Index: XDOMUtil.java
  ===================================================================
  /*
   * XDOMUtil.java
   *
   * Created on February 21, 2002, 12:33 AM
   */
  
  package org.apache.axis.xsd.xml;
  
  import org.w3c.dom.*;
  
  /**
   *
   * @author  mukund
   */
  public class XDOMUtil extends DOMUtil {
      
      /** Creates a new instance of XDOMUtil */
      private XDOMUtil() {
      }
      
      public static Element getFirstChildElementNS(Node parent, String uri) {
  
          // search for node
          Node child = parent.getFirstChild();
          while (child != null) {
              if (child.getNodeType() == Node.ELEMENT_NODE) {
                  String childURI = child.getNamespaceURI();
                  if (childURI != null && childURI.equals(uri) ) {
                      return (Element)child;
                  }
              }
              child = child.getNextSibling();
          }
  
          // not found
          return null;
          
      }
      
      public static Element getNextSiblingElementNS(Node node, String uri) {
          // search for node
          Node sibling = node.getNextSibling();
          while (sibling != null) {
              if (sibling.getNodeType() == Node.ELEMENT_NODE) {
                  String siblingURI = sibling.getNamespaceURI();
                  if (siblingURI != null && siblingURI.equals(uri) ) {
                      return (Element)sibling;
                  }
              }
              sibling = sibling.getNextSibling();
          }
  
          // not found
          return null;
          
      }
      
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/XmlTokenizedType.java
  
  Index: XmlTokenizedType.java
  ===================================================================
  package org.apache.axis.xsd.xml;
  
  import org.apache.axis.xsd.enum.Enum;
  /**
   * @author momo 
   */
  
  // Oct 15th - Momo - Initial Impl
  
  public class XmlTokenizedType extends Enum {
  
  	static String[] members = new String[] { "CDATA", "IDREF", "IDREFS", 
  											 "ENTITY", "ENTITIES", "NMTOKEN", 
  											 "NMTOKENS", "NOTATION", "ENUMERATION",
  											 "QName", "NCName", "None"};
  		
      /** Creates new XmlSchemaForm */
  	public XmlTokenizedType(String value) {
  		super(value);
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/ValidationEvent.java
  
  Index: ValidationEvent.java
  ===================================================================
  /*
   * ValidationEvent.java
   *
   * Created on September 27, 2001, 3:03 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import java.util.EventObject;
  
  /**
   *
   * @author  mukund
   */
  
  public class ValidationEvent extends EventObject {
  
      /** Creates new ValidationEvent */
      public ValidationEvent(Object source) {
  		super(source);
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/ValidationEventHandler.java
  
  Index: ValidationEventHandler.java
  ===================================================================
  /*
   * ValidationEventHandler.java
   *
   * Created on September 27, 2001, 3:00 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   *
   * @author  mukund
   */
  
  public class ValidationEventHandler {
  
      /** Creates new ValidationEventHandler */
      public ValidationEventHandler() {
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchema.java
  
  Index: XmlSchema.java
  ===================================================================
  /*
   * XmlSchema.java
   *
   * Created on September 27, 2001, 2:27 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  
  import org.apache.axis.xsd.xml.XDOMUtil;
  import org.apache.axis.xsd.enum.Enum;
  import org.apache.axis.xsd.str.Tokenizer;
  import org.apache.axis.xsd.xml.QualifiedName;
  
  import java.io.Reader;
  import java.io.Writer;
  import java.io.OutputStream;
  import java.io.OutputStreamWriter;
  import java.io.IOException;
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
  import java.util.Hashtable;
  import java.util.Vector;
  import java.util.StringTokenizer;
  import org.w3c.dom.Document;
  import org.w3c.dom.DocumentFragment;
  import org.w3c.dom.Element;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  import org.w3c.dom.NodeList;
  import org.w3c.dom.Attr;
  
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.ParserConfigurationException;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.TransformerConfigurationException;
  import javax.xml.transform.TransformerException;
  import javax.xml.transform.Source;
  import javax.xml.transform.Result;
  import javax.xml.transform.OutputKeys;
  import javax.xml.transform.dom.DOMSource;
  import javax.xml.transform.dom.DOMResult;
  import javax.xml.transform.stream.StreamResult;
  import javax.xml.transform.stream.StreamSource;
  
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  
  
  /**
   * Contains the definition of a schema. All XML Schema definition language (XSD) 
   * elements are children of the schema element. Represents the World Wide Web 
   * Consortium (W3C) schema element
   *
   * @author  mukund
   */
  
  // Oct 15th - momo - initial impl
  // Oct 17th - vidyanand - add SimpleType + element
  // Oct 18th - momo - add ComplexType
  // Oct 19th - vidyanand - handle external
  // Dec 6th - Vidyanand - changed RuntimeExceptions thrown to XmlSchemaExceptions
  // Jan 15th - Vidyanand - made changes to SchemaBuilder.handleElement to look for an element ref.
  // Feb 20th - Joni - Change the getXmlSchemaFromLocation schema 
  //            variable to name s.
  // Feb 21th - Joni - Port to XMLDomUtil and Tranformation.  
  
  public class XmlSchema extends XmlSchemaAnnotated {
      static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
      XmlSchemaForm attributeFormDefault, elementFormDefault;
  
      // notation is global elements, all XmlSchemaObjectTable are READ-ONLY
      XmlSchemaObjectTable attributeGroups, attributes, elements, groups, 
          notations, schemaTypes;
      XmlSchemaDerivationMethod blockDefault, finalDefault;
      XmlSchemaObjectCollection includes, items;
      boolean isCompiled;
      String targetNamespace="DEFAULT", version;
      Hashtable namespaces;
      String schema_ns_prefix = "";
  	
      /** Creates new XmlSchema */
      public XmlSchema() {
          attributeFormDefault = new XmlSchemaForm("Qualified");
          elementFormDefault = new XmlSchemaForm("Qualified");
          blockDefault = new XmlSchemaDerivationMethod("None");
          finalDefault = new XmlSchemaDerivationMethod("None");
          items = new XmlSchemaObjectCollection();
          includes = new XmlSchemaObjectCollection();
          namespaces = new Hashtable();
          elements = new XmlSchemaObjectTable();
          attributeGroups = new XmlSchemaObjectTable();
          attributes = new XmlSchemaObjectTable();
          groups = new XmlSchemaObjectTable();
          notations = new XmlSchemaObjectTable();
          schemaTypes = new XmlSchemaObjectTable();
      }
  	
      protected String getNamespace(String prefix) {
          return "" + namespaces.get(prefix);
      }
  
  
      public static XmlSchema read(Reader r, ValidationEventHandler veh) {
  		return read( new InputSource(r), veh );
      }
  
  	public static XmlSchema read(InputSource inputSource, ValidationEventHandler veh) {
  		try{    
  			DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();            
  			docFac.setNamespaceAware(true);
  			DocumentBuilder builder = docFac.newDocumentBuilder();
  			Document doc = builder.parse(inputSource);
  			return read(doc, veh);
  		}catch( ParserConfigurationException e ){
  			throw new XmlSchemaException(e.getMessage());	
  		}catch(IOException e){
  			throw new XmlSchemaException(e.getMessage());
  		}catch(SAXException e){
  			throw new XmlSchemaException(e.getMessage());
  		}
  	}
  
  	public static XmlSchema read(Source source, ValidationEventHandler veh){
  		try {
  			TransformerFactory trFac = TransformerFactory.newInstance();
  			ByteArrayOutputStream out = new ByteArrayOutputStream();
  			StreamResult result = new StreamResult(out);
  			javax.xml.transform.Transformer tr = trFac.newTransformer();
              tr.setOutputProperty(OutputKeys.METHOD, "xml");
  			tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  			tr.transform(source, result);
  			ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray());
  			return read(new InputSource( in), veh);
  		}catch( TransformerException e ){
  			throw new XmlSchemaException(e.getMessage());
  		}
  	}
  
  	static XmlSchema read(Document doc, ValidationEventHandler veh){
  		SchemaBuilder builder = new SchemaBuilder();
  		return builder.build( doc, veh);
  	}
  
      public XmlSchemaForm getAttributeFormDefault() {
          return attributeFormDefault;
      }
  
      public void setAttributeFormDefault(XmlSchemaForm value) {
          attributeFormDefault = value;
      }	
  	
      public XmlSchemaObjectTable getAttributeGroups() {
          return attributeGroups;
      }
  
      public XmlSchemaObjectTable getAttributes() {
          return attributes;
      }
  
      public XmlSchemaDerivationMethod getBlockDefault() {
          return blockDefault;
      }
  
      public void setBlockDefault(XmlSchemaDerivationMethod blockDefault) {
          this.blockDefault = blockDefault;
      }
  
      public XmlSchemaForm getElementFormDefault() {
          return elementFormDefault;
      }
  
      public void setElementFormDefault(XmlSchemaForm elementFormDefault) {
          this.elementFormDefault = elementFormDefault;
      }
  
      public XmlSchemaObjectTable getElements() {
          return elements;
      }
  
      public XmlSchemaDerivationMethod getFinalDefault() {
          return finalDefault;
      }
  
      public void setFinalDefault(XmlSchemaDerivationMethod finalDefault) {
          this.finalDefault = finalDefault;
      }
  
      public XmlSchemaObjectTable  getGroups() {
          return groups;
      }
  
      public XmlSchemaObjectCollection getIncludes() {
          return includes;
      }
  
      public boolean isCompiled() {
          return isCompiled;
      }
  
      public XmlSchemaObjectCollection getItems() {
          return items;
      }
  
      public XmlSchemaObjectTable getNotations() {
          return notations;
      }
  
      public XmlSchemaObjectTable getSchemaTypes() {
          return schemaTypes;
      }
  
      public String getTargetNamespace() {
          return targetNamespace;
      }
  
      public void setTargetNamespace(String targetNamespace) {
          if (!targetNamespace.equals(""))
              this.targetNamespace = targetNamespace;
      }
  
      public String getVersion() {
  		return version;
      }
  
      public void compile(ValidationEventHandler eh) {
  
      }
  
      public void write(OutputStream out) {
  		write(new OutputStreamWriter(out));
      }
  
      public void write(Writer writer) {
  		serialize_internal( this, writer);
      }
  
      private static void serialize_internal(XmlSchema schema, Writer out) {
          try {
  			Document[] serializedSchemas = XmlSchemaSerializer.serializeSchema(schema, true);
  			TransformerFactory trFac = TransformerFactory.newInstance();
              Source source = new DOMSource(serializedSchemas[0]);
              Result result = new StreamResult(out);
              javax.xml.transform.Transformer tr = trFac.newTransformer();
              tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  			tr.setOutputProperty(OutputKeys.INDENT, "yes");			
              tr.transform(source, result);
              out.flush();
          } catch (TransformerConfigurationException e) {
  			throw new XmlSchemaException( e.getMessage() );
          } catch (TransformerException e) {
  			throw new XmlSchemaException( e.getMessage());
          }catch (XmlSchemaSerializer.XmlSchemaSerializerException e) {
  			throw new XmlSchemaException( e.getMessage());
          }catch (IOException e) {
  			throw new XmlSchemaException( e.getMessage());
          }
      }	
  	
  	public Hashtable getPrefixToNamespaceMap(){
  		return namespaces;
  	}
  	
  	public void setPrefixToNamespaceMap(Hashtable map){
  		this.namespaces=map;
  	}
  
  
  
      static class SchemaBuilder {
          Document doc;
          XmlSchema schema;
  		
  		DocumentBuilderFactory docFac;
  
          SchemaBuilder(){
              schema = new XmlSchema();
          }
  
  		XmlSchema build( Document doc, ValidationEventHandler veh){
              Element schemaEl = doc.getDocumentElement();
              return handleXmlSchemaElement( schemaEl );
  		}
  		/*
  		  XmlSchema build(Reader r, ValidationEventHandler veh) {
  		  try{    
  		  DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();            
  		  docFac.setNamespaceAware(true);
  		  DocumentBuilder builder = docFac.newDocumentBuilder();
  		  doc = builder.parse(new InputSource(r));
  		  return build(doc, veh);
  		  }catch( ParserConfigurationException e ){
  		  throw new XmlSchemaException(e.getMessage());	
  		  }catch(IOException e){
  		  throw new XmlSchemaException(e.getMessage());
  		  }catch(SAXException e){
  		  throw new XmlSchemaException(e.getMessage());
  		  }
  		  }
  		*/
          XmlSchema handleXmlSchemaElement( Element schemaEl ) {
  			// get all the attributes along with the namespace declns
  
              setNamespaceAttributes( schema, schemaEl );
              schema.setElementFormDefault( this.getFormDefault(schemaEl, 
  															  "elementFormDefault" ));
              schema.setAttributeFormDefault( this.getFormDefault(schemaEl, 
  																"attributeFormDefault" ));
              schema.setBlockDefault(this.getDerivation(schemaEl,"blockDefault"));
              schema.setFinalDefault(this.getDerivation(schemaEl,"finalDefault"));
  
              /***********
               * for ( each childElement) 
               *		if( simpleTypeElement)	
               *			handleSimpleType
               *		else if( complexType)
               *			handleComplexType
               *		else if( element) 
               *			handleElement
               *		else if( include)
               *			handleInclude
               *		else if( import)
               *			handleImport
               *		else if (group)
               *			handleGroup
               *		else if (attributeGroup)
               *			handleattributeGroup
               *		else if( attribute)
               *			handleattribute
               *		else if (redefine)
               *			handleRedefine
               *		else if(notation)
               *			handleNotation
               */
  
              for( Element el = XDOMUtil.getFirstChildElementNS(
  															  schemaEl,SCHEMA_NS); el != null; 
  				 el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
  
  				// String elPrefix = el.getPrefix() == null ? "" : el.getPrefix();
                  //if(elPrefix.equals(schema.schema_ns_prefix)) {
                  if( el.getLocalName().equals( "simpleType") ) {
                      XmlSchemaType type = handleSimpleType(schema, el, schemaEl);
                      schema.schemaTypes.collection.put( type.qualifiedName,type);
                      schema.items.add( type );
                  }else if( el.getLocalName().equals( "complexType") ) {
                      XmlSchemaType type = handleComplexType(schema, el,schemaEl);
                      schema.schemaTypes.collection.put( type.qualifiedName,type);
                      schema.items.add( type );
                  }else if( el.getLocalName().equals( "element") ) {
                      XmlSchemaElement element =handleElement(schema,el,schemaEl);						
                      if(element.qualifiedName != null)
                          schema.elements.collection.put(
  													   element.qualifiedName,element);
                      else if(element.refName != null)
                          schema.elements.collection.put(
  													   element.refName, element);
                      schema.items.add( element );
                  }else if( el.getLocalName().equals( "include") ) {
                      XmlSchemaInclude include = handleInclude( schema, 
  															  el, schemaEl);
                      schema.includes.add( include );
                      schema.items.add( include );
                  }else if( el.getLocalName().equals( "import") ) {
                      XmlSchemaImport schemaImport = handleImport( schema, 
  																 el, schemaEl);
                      schema.includes.add( schemaImport);
                      schema.items.add( schemaImport);
                  }else if( el.getLocalName().equals( "group") ){
                      XmlSchemaGroup group = handleGroup( schema, el, schemaEl);
                      schema.groups.collection.put( group.name, group);
                      schema.items.add( group );
                  }else if( el.getLocalName().equals( "attributeGroup" ) ){                    
                      XmlSchemaAttributeGroup group = handleAttributeGroup(schema,
  																		 el, schemaEl);
                      schema.attributeGroups.collection.put( group.name, group);
                      schema.items.add( group );
                  }else if( el.getLocalName().equals( "attribute" ) ){
                      XmlSchemaAttribute attr = handleAttribute( schema, 
  															   el, schemaEl);
                      schema.attributes.collection.put( attr.qualifiedName, attr);
                      schema.items.add( attr);
                  }else if( el.getLocalName().equals( "redefine" ) ){
                      XmlSchemaRedefine redefine = handleRedefine(schema, 
  																el, schemaEl);
                      schema.includes.add( redefine );
                  }else if( el.getLocalName().equals( "notation" ) ){
                      //TODO: implement Notation
                  }else if( el.getLocalName().equals( "annotation" ) ){
  					// Vidyanand : added this part
  					XmlSchemaAnnotation annotation = handleAnnotation( schema, el, schemaEl);
  					schema.setAnnotation(annotation);
  				}
                  //}
              }
              return schema;
          }
  
  		private XmlSchemaAnnotation handleAnnotation(XmlSchema schema, 
  													 Element annotEl, Element schemaEl) {
  			XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
  			XmlSchemaObjectCollection collection = annotation.getItems();
  			for( Element el = XDOMUtil.getFirstChildElement(annotEl);
  				 el != null; el = XDOMUtil.getFirstChildElement(el)) {
  				
  				if( el.getLocalName().equals( "documentation")){
  					XmlSchemaDocumentation doc = new XmlSchemaDocumentation();
  					doc.setMarkup( el.getChildNodes());
  					collection.add( doc );
  				}
  			}
  			return annotation;	
  		}
              
  		
          private XmlSchemaRedefine handleRedefine(XmlSchema schema, 
  												 Element redefineEl, Element schemaEl) {
              
  			XmlSchemaRedefine redefine = new XmlSchemaRedefine();
  			redefine.schemaLocation = 
  				redefineEl.getAttribute("schemaLocation");
                  
  			redefine.schema = 
  				getXmlSchemaFromLocation( redefine.schemaLocation);
  
  			for( Element el = XDOMUtil.getFirstChildElementNS(redefineEl, 
  															  SCHEMA_NS) 
  					 ;el != null; 
  				 el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
  
  				//                    String elPrefix = el.getPrefix() == null ? "" : el.getPrefix();
  				//                    if(elPrefix.equals(schema.schema_ns_prefix)) {
  				if( el.getLocalName().equals( "simpleType") ) {
  					XmlSchemaType type = 
  						handleSimpleType(schema, el, schemaEl);
                          
  					redefine.schemaTypes.collection.put(type.qualifiedName, 
  														type );
  					redefine.items.add( type );
  				} 
  				else if( el.getLocalName().equals( "complexType") ) {
                          
  					XmlSchemaType type = handleComplexType(schema, el, 
  														   schemaEl);
  
  					redefine.schemaTypes.collection.put(type.qualifiedName, 
  														type );
  					redefine.items.add( type );
  				} 
  				else if( el.getLocalName().equals( "group") ){
  					XmlSchemaGroup group = handleGroup(schema, el, 
  													   schemaEl);
  					redefine.groups.collection.put( group.name, group);
  					redefine.items.add( group );
  				}
  				else if( el.getLocalName().equals( "attributeGroup" ) ){
  					XmlSchemaAttributeGroup group = 
  						handleAttributeGroup( schema, el, schemaEl);
                          
  					redefine.attributeGroups.collection.put( 
  															group.name, group);
  					redefine.items.add( group );
  				}
  				else if(el.getLocalName().equals("annotation")){
  					XmlSchemaAnnotation annotation = handleAnnotation(el);
  					redefine.setAnnotation(annotation);
  				}
  				//                  }
  			}
  			return redefine;
          }
  
          void setNamespaceAttributes( XmlSchema schema, Element schemaEl ) {
  			NamedNodeMap map = schemaEl.getAttributes();
  			for( int i = 0 ; i<map.getLength(); i++ ) {
  				if( map.item(i).getNodeName().startsWith("xmlns:") ) {
  					schema.namespaces.put( map.item(i).getLocalName(),
  										   map.item(i).getNodeValue());
  
  					if(map.item(i).getNodeValue().equals(SCHEMA_NS))
  						schema.schema_ns_prefix = map.item(i).getLocalName();
  				}else if( map.item(i).getNodeName().startsWith("xmlns") ){
  					schema.namespaces.put("",map.item(i).getNodeValue());
  				}
  			}
  			if( schemaEl.getAttributeNode( "targetNamespace")!= null) {
                      
  				String contain = schemaEl.getAttribute("targetNamespace");
                      
  				if(!schema.namespaces.containsValue(contain))
  					putNamespace("",contain);
                      
  				if (!contain.equals(""))
  					schema.targetNamespace = contain;
                     
  			}else{
  				//schema.targetNamespace = "";
  				putNamespace("", schema.targetNamespace);
  			}
                      
          }
          private void putNamespace(String prefix, String namespace){
  			if(!schema.namespaces.containsKey(prefix)){
  				schema.namespaces.put(prefix, namespace);
  			}
  			else{
  				String genPrefix = "gen" + 
                      new java.util.Random().nextInt(999);
  				schema.namespaces.put(prefix, namespace);
  			}
          }
  
          XmlSchemaSimpleType handleSimpleType( XmlSchema schema, 
  											  Element simpleEl, Element schemaEl ){
              
  			XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType();
  			if( simpleEl.hasAttribute("name")){
  				String name = simpleEl.getAttribute("name") ;
                      
  				simpleType.name = simpleEl.getAttribute("name");
  				simpleType.qualifiedName = new QualifiedName( name, 
  															  schema.targetNamespace);
  			}
  
  			if( simpleEl.hasAttribute( "final") ) {
  				String finalstr= simpleEl.getAttribute("final");
                      
  				if(finalstr.equalsIgnoreCase("all")| 
  				   finalstr.equalsIgnoreCase("#all"))
                          
  					simpleType.setFinal(
  										new XmlSchemaDerivationMethod("All"));
  				else
  					simpleType.setFinal(
  										new XmlSchemaDerivationMethod(finalstr));
  			}
  
  			Element simpleTypeAnnotationEl = 
  				XDOMUtil.getFirstChildElementNS(simpleEl,
  												SCHEMA_NS,"annotation");
  
  			if(simpleTypeAnnotationEl != null){
  				XmlSchemaAnnotation simpleTypeAnnotation = 
  					handleAnnotation(simpleTypeAnnotationEl);
                      
  				simpleType.setAnnotation(simpleTypeAnnotation);
  			}
  
  			Element unionEl, listEl, restrictionEl;
                  
  			if((restrictionEl = 
  				XDOMUtil.getFirstChildElementNS(
  												simpleEl,SCHEMA_NS,"restriction"))!= null ) {
                      
  				XmlSchemaSimpleTypeRestriction restriction = 
  					new XmlSchemaSimpleTypeRestriction();
  
  				Element restAnnotationEl = 
  					XDOMUtil.getFirstChildElementNS(restrictionEl, 
  													SCHEMA_NS,"annotation");
                      
  				if(restAnnotationEl != null){
  					XmlSchemaAnnotation restAnnotation =  
  						handleAnnotation(restAnnotationEl);
  					restriction.setAnnotation(restAnnotation);
  				}
  				/** if (restriction has a base attribute ) 
  				 *		set the baseTypeName and look up the base type
  				 *	else if( restricion has a SimpleType Element as child) 
  				 *		get that element and do a handleSimpleType;
  				 *	get the children of restriction other than annotation 
  				 * and simpleTypes and construct facets from it;
  				 * 
  				 *	set the restriction has the content of the simpleType
  				 * 
  				 **/
                      
  				Element inlineSimpleType = 
  					XDOMUtil.getFirstChildElementNS(restrictionEl,
  													SCHEMA_NS,"simpleType");
                      
  				if( restrictionEl.hasAttribute( "base") ) {
  					String name = restrictionEl.getAttribute("base");
  					String[] temp = Tokenizer.tokenize(name, ":");
  					String namespace = "";
  
  					if(temp.length != 1) {
  						namespace = temp[0];
  					}
                                    
  					//let it crash because its mean being refered
  					//to unregistered namespace
  					namespace = schema.namespaces.get(namespace).toString();
                          
  					restriction.baseTypeName = 
  						new QualifiedName(name ,namespace);
  				}
  				else if (inlineSimpleType != null){
  					XmlSchemaSimpleType baseType = 
  						handleSimpleType(schema, inlineSimpleType,schemaEl);	
                          
  					restriction.baseType = baseType;
  				}
  				for(Element el = XDOMUtil.getFirstChildElementNS(
  																 restrictionEl,SCHEMA_NS)
                          ;el != null; 
  					el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                              
  					if(!el.getLocalName().equals("annotation") 
  					   && 
  					   !el.getLocalName().equals("simpleType")){
  
  						XmlSchemaFacet facet =XmlSchemaFacet.construct( el);
  						Element annotation = 
  							XDOMUtil.getFirstChildElementNS(el, SCHEMA_NS,
  															"annotation");
  
  						if(annotation != null){
  							XmlSchemaAnnotation facetAnnotation =  
  								handleAnnotation(annotation);
  							facet.setAnnotation(facetAnnotation);
  						}
  						restriction.facets.add(facet);
  					}
                      
  				}
  				simpleType.content = restriction;
                  
  			}else if((listEl = XDOMUtil.getFirstChildElementNS(simpleEl, 
  															   SCHEMA_NS,"list"))!=null) {
                                                           
  				XmlSchemaSimpleTypeList list = new XmlSchemaSimpleTypeList();
  
  				/******
  				 * if( list has an itemType attribute ) 
  				 *		set the baseTypeName and look up the base type
  				 * else if( list has a SimpleTypeElement as child)
  				 *		get that element and do a handleSimpleType
  				 * 
  				 * set the list has the content of the simpleType
  				 */
  				Element inlineListType, listAnnotationEl;
  				if( listEl.hasAttribute( "itemType")) {
  					String name = listEl.getAttribute("itemType");
  
  					String[] namespaceFromEl = Tokenizer.tokenize(name, ":");
  					String namespace;
                          
  					if(namespaceFromEl.length > 1){
  						Object result = 
  							schema.namespaces.get(namespaceFromEl[0]);
  						if(result ==null)
  							throw new XmlSchemaException("No namespace "
  														 + "found in given itemType");
                              
  						namespace = result.toString();
  					}
  					else
  						namespace = schema.targetNamespace;
                          
  					//Object nsFromEl = schema.namespaces.get(namespaceFromEl[0]); 
  					//namespace = (nsFromEl==null)?  "": nsFromEl.toString();
                          
  					list.itemTypeName = 
  						new QualifiedName(name ,namespace);
                          
  				}
  				else if((inlineListType = 
  						 XDOMUtil.getFirstChildElementNS(listEl, SCHEMA_NS, 
  														 "simpleType"))!= null){
                                                            
  					XmlSchemaSimpleType baseType = 
  						handleSimpleType(schema, inlineListType, schemaEl);	
  					list.itemType = baseType;
  				}
  
  				if((listAnnotationEl = 
  					XDOMUtil.getFirstChildElementNS(listEl, SCHEMA_NS,
  													"annotation"))!=null){
                                                              
  					XmlSchemaAnnotation listAnnotation = 
  						handleAnnotation(listAnnotationEl);
                          
  					list.setAnnotation(listAnnotation);
  				} 
  				simpleType.content = list;
  
  			}else if((unionEl = 
  					  XDOMUtil.getFirstChildElementNS(simpleEl, SCHEMA_NS,
  													  "union"))!=null) {
                      
  				XmlSchemaSimpleTypeUnion union = 
  					new XmlSchemaSimpleTypeUnion();
  
  				/******
  				 * if( union has a memberTypes attribute ) 
  				 *		add the memberTypeSources string
  				 *		for (each memberType in the list )
  				 *			lookup(memberType)
  				 *	for( all SimpleType child Elements) 
  				 *		add the simpleTypeName (if any) to the memberType Sources	
  				 *		do a handleSimpleType with the simpleTypeElement
  				 */
  				if( unionEl.hasAttribute( "memberTypes")){
  					String memberTypes = unionEl.getAttribute("memberTypes");
  					union.memberTypesSource = memberTypes;
  					Vector v = new Vector();
  					StringTokenizer tokenizer = new StringTokenizer(memberTypes," ");
  					while (tokenizer.hasMoreTokens()){
  						String member = tokenizer.nextToken();
  						int pos = member.indexOf(":");
  						String prefix = "";
  						String localName="" ;
  						if (pos == -1){
  							localName = member;
  						}
  						else{
  							prefix = member.substring(0,pos);
  							localName=member.substring(pos+1);
  						}
  						v.add(new QualifiedName(localName,(String)schema.namespaces.get(prefix)));
  					}
  					union.memberTypesQNames = new QualifiedName[v.size()];
  					v.copyInto(union.memberTypesQNames);                            
  				}
                      
  				Element inlineUnionType = 
  					XDOMUtil.getFirstChildElementNS(unionEl, SCHEMA_NS,
  													"simpleType");
  				while(inlineUnionType != null){
                                                                  
  					XmlSchemaSimpleType unionSimpleType = 
  						handleSimpleType(schema,inlineUnionType,
  										 schemaEl);
                          
  					union.baseTypes.add( unionSimpleType);
                          
  					union.memberTypesSource += " " + unionSimpleType.name;
                          
  					inlineUnionType = 
  						XDOMUtil.getNextSiblingElementNS(inlineUnionType, 
  														 SCHEMA_NS, 
  														 "simpleType");
  				}
  
  				//NodeList annotations = unionEl.getElementsByTagNameNS(
  				//SCHEMA_NS, "annotation");
  				Element unionAnnotationEl = 
  					XDOMUtil.getFirstChildElementNS(unionEl, SCHEMA_NS,
  													"annotation");
                      
  				if(unionAnnotationEl != null){
  					XmlSchemaAnnotation unionAnnotation = 
  						handleAnnotation(unionAnnotationEl);
                          
  					union.setAnnotation(unionAnnotation);
  				}
  				simpleType.content = union;
  			}
  			return simpleType;	
          }
  
          XmlSchemaComplexType handleComplexType( XmlSchema schema, 
  												Element complexEl, Element schemaEl ){
                  
  			/******
  			 * set the complexTypeName if any
  			 * for( eachChildNode)
  			 * if ( simpleContent) 
  			 *		if( restrcition)
  			 *			handle_simple_content_restriction
  			 *		else if( extension)
  			 *			handle_simple_content_extension
  			 *		break; // it has to be the only child 
  			 * else if( complexContent)
  			 *		if( restriction) 
  			 *			handle_complex_content_restriction
  			 *		else if( extension) 
  			 *			handle_complex_content_extension
  			 *		break; // it has to be the only child 
  			 * else if( group) 
  			 *		if( group has ref)
  			 *			store the group name
  			 *		else
  			 *			handleGroup
  			 * else if( sequence )
  			 *		handleSequence
  			 * else if( all )
  			 *		handleAll
  			 * else if(choice)
  			 *		handleChoice
  			 * else if(attribute)
  			 *		handleAttribute
  			 * else if(attributeGroup)
  			 *		handleAttributeGroup	
  			 *  else if(anyAttribute)
  			 *		handleAnyAttribute
  			 */		
  
  			XmlSchemaComplexType ct = new XmlSchemaComplexType();
  
  			if( complexEl.hasAttribute( "name") ) {
  				String name = complexEl.getAttribute("name");
                   
  				//String namespace = (schema.targetNamespace==null)?
  				//                  "":schema.targetNamespace;
                                          
  				ct.name = name;
  				ct.qualifiedName = new QualifiedName(name , 
  													 schema.targetNamespace);
  			}
  			for(Element el = XDOMUtil.getFirstChildElementNS(complexEl, 
  															 SCHEMA_NS)
                      ;el != null; 
  				el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                      
  				//String elPrefix = el.getPrefix() == null ? "" :
  				//el.getPrefix();
  				//if(elPrefix.equals(schema.schema_ns_prefix)) {
  				if( el.getLocalName().equals( "sequence") ) {
  					XmlSchemaSequence sequence = handleSequence(schema, 
  																el, schemaEl);
                              
  					ct.particle = sequence;
  				} else if(el.getLocalName().equals("choice")) {
  					XmlSchemaChoice choice = handleChoice(schema, 
  														  el, schemaEl);
                              
  					ct.particle = choice;
  				} else if(el.getLocalName().equals("all")) {
  					XmlSchemaAll all = handleAll(schema, el, schemaEl);
  					ct.particle = all;
  				} else if(el.getLocalName().equals("attribute")) {
  					XmlSchemaAttribute attr = handleAttribute(schema, 
  															  el, schemaEl);
  					ct.attributes.add(attr);
  				} else if(el.getLocalName().equals("attributeGroup")) {
  					XmlSchemaAttributeGroupRef attrGroup = 
  						handleAttributeGroupRef(schema, el,  schemaEl);
  					ct.attributes.add(attrGroup);
  				} else if(el.getLocalName().equals("group")) {
  					XmlSchemaGroupRef group = 
  						handleGroupRef(schema, el, schemaEl);
  					ct.particle = (group.particle == null)? 
  						(XmlSchemaParticle)group : group.particle;
  				} else if(el.getLocalName().equals("simpleContent")) {
  					XmlSchemaSimpleContent simpleContent = 
  						handleSimpleContent(schema, el, schemaEl);
  					ct.contentModel = simpleContent;
  				}else if(el.getLocalName().equals("complexContent")) {
  					XmlSchemaComplexContent complexContent = 
  						handleComplexContent(schema, el, schemaEl);
  					ct.contentModel = complexContent;
  				}else if(el.getLocalName().equals("annotation")){
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					ct.setAnnotation(ann);
  				}
  				//}
  			}
  			if( complexEl.hasAttribute( "block") ) {
  				String blockStr = complexEl.getAttribute("block");
  				if(blockStr.equalsIgnoreCase("all")|
  				   blockStr.equalsIgnoreCase("#all")){
                          
  					ct.setBlock(new XmlSchemaDerivationMethod("All"));
  				}
  				else
  					ct.setBlock(new XmlSchemaDerivationMethod(blockStr));
  				//ct.setBlock(new XmlSchemaDerivationMethod(block));
  			}
  			if( complexEl.hasAttribute( "final") ) {
  				String finalstr= complexEl.getAttribute("final");
  				if(finalstr.equalsIgnoreCase("all")|
  				   finalstr.equalsIgnoreCase("#all")){
                              
  					ct.setFinal(new XmlSchemaDerivationMethod("All"));
  				}
  				else
  					ct.setFinal(new XmlSchemaDerivationMethod(finalstr));
  			}
  			if( complexEl.hasAttribute( "abstract") ) {
  				String abs= complexEl.getAttribute("abstract");
  				if (abs.equalsIgnoreCase("true"))
  					ct.setAbstract(true);
  				else
  					ct.setAbstract(false);
  			}
  			if( complexEl.hasAttribute( "mixed") ) {
  				String mixed= complexEl.getAttribute("mixed");
  				if (mixed.equalsIgnoreCase("true"))
  					ct.setMixed(true);
  				else
  					ct.setMixed(false);
  			}
  			return ct;
          }
  
          private XmlSchemaSimpleContent 
              handleSimpleContent(XmlSchema schema, Element simpleEl, 
  								Element schemaEl) {
              
  			XmlSchemaSimpleContent simpleContent = 
  				new XmlSchemaSimpleContent();
                  
  			for(Element el = XDOMUtil.getFirstChildElementNS(simpleEl, 
  															 SCHEMA_NS)
                      ;el != null; 
  				el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                          
  				if( el.getLocalName().equals( "restriction") ) {
  					XmlSchemaSimpleContentRestriction restriction = 
  						handleSimpleContentRestriction(schema,el, schemaEl);
                              
  					simpleContent.content = restriction;
  				} else if( el.getLocalName().equals( "extension") ){
  					XmlSchemaSimpleContentExtension ext = 
  						handleSimpleContentExtension(schema, el, schemaEl);
  					simpleContent.content = ext;
  				}else if( el.getLocalName().equals( "annotation") ) {
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					simpleContent.setAnnotation(ann);
  				}
  			}
  			return simpleContent;
          }
  
          private XmlSchemaComplexContent handleComplexContent(XmlSchema schema, 
  															 Element complexEl, Element schemaEl) {
                  
  			XmlSchemaComplexContent complexContent = 
  				new XmlSchemaComplexContent();
                  
  			for(Element el =
                      XDOMUtil.getFirstChildElementNS(complexEl, SCHEMA_NS); 
  				el != null; 
  				el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)) {
                          
  				if( el.getLocalName().equals( "restriction") ) {
  					XmlSchemaComplexContentRestriction restriction = 
  						handleComplexContentRestriction(schema, el, 
  														schemaEl);
  					complexContent.content = restriction;
  				}else if( el.getLocalName().equals( "extension") ) {
  					XmlSchemaComplexContentExtension ext = 
  						handleComplexContentExtension(schema, el,
  													  schemaEl);
  					complexContent.content = ext;
  				}else if( el.getLocalName().equals( "annotation") ) {   
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					complexContent.setAnnotation(ann);
  				}
  			}
  			return complexContent;
          }
  
          private XmlSchemaSimpleContentRestriction 
              handleSimpleContentRestriction(XmlSchema schema, 
  										   Element restrictionEl,  Element schemaEl) {
              
  			XmlSchemaSimpleContentRestriction restriction = 
  				new XmlSchemaSimpleContentRestriction();
  
  			if(restrictionEl.hasAttribute("base")) {
  				String name = restrictionEl.getAttribute("base");
  				Object result = schema.namespaces.get(
  													  Tokenizer.tokenize(name, ":")[0]); 
  
  				if(result ==null)
  					throw new XmlSchemaException("No namespace found in "
  												 + "given base simple content type");
                      
  				restriction.baseTypeName = 
  					new QualifiedName(name , result.toString());
  			}
  
  			if(restrictionEl.hasAttribute("id")) 
  				restriction.id = restrictionEl.getAttribute("id");
  
  			// check back simpleContent tag children to add attributes and simpleType if any occur
  			for( 
  				Element el = XDOMUtil.getFirstChildElementNS(restrictionEl, 
  															 SCHEMA_NS)
                      ;el != null; 
  				el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                          
  				if(el.getLocalName().equals("attribute")) {
  					XmlSchemaAttribute attr = 
  						handleAttribute(schema, el,  schemaEl);
  					restriction.attributes.add(attr);
  				} else if(el.getLocalName().equals("attributeGroup")) {
  					XmlSchemaAttributeGroupRef attrGroup = 
  						handleAttributeGroupRef(schema, el,  schemaEl);
  					restriction.attributes.add(attrGroup);
  				} else if( el.getLocalName().equals( "simpleType") ) {
  					XmlSchemaSimpleType type = 
  						handleSimpleType(schema, el, schemaEl);
  					restriction.baseType = type;
  				} else if( el.getLocalName().equals( "anyAttribute") ){
  					restriction.anyAttribute =  
  						handleAnyAttribute(schema, el, schemaEl);
  				} else if( el.getLocalName().equals( "annotation") ){
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					restriction.setAnnotation(ann);
  				} else {
  					XmlSchemaFacet facet = XmlSchemaFacet.construct(el);
  					NodeList annotations = 
  						el.getElementsByTagNameNS(SCHEMA_NS, "annotation");
  
  					if(annotations.getLength() > 0 ){
  						XmlSchemaAnnotation facetAnnotation = 
  							handleAnnotation(el);
  						facet.setAnnotation(facetAnnotation);
  					}
  					restriction.facets.add(facet);
  				} 
  			}
  			return restriction;
          }
  
          private XmlSchemaSimpleContentExtension 
              handleSimpleContentExtension(XmlSchema schema, Element extEl, 
  										 Element schemaEl) {
                  
  			XmlSchemaSimpleContentExtension ext = 
  				new XmlSchemaSimpleContentExtension();
                  
  			if(extEl.hasAttribute("base")) {
  				String name = extEl.getAttribute("base");
  				String nsFromEl = Tokenizer.tokenize(name, ":")[0];
  				Object result = schema.namespaces.get(nsFromEl);
                      
  				if(result ==null)
  					throw new XmlSchemaException("No namespace found in "
  												 + "given base simple content type");
                      
  				ext.baseTypeName = new QualifiedName(name ,
  													 result.toString());
  			}
  
  			for( 
  				Element el=XDOMUtil.getFirstChildElementNS(extEl, SCHEMA_NS)
                      ;el != null; 
  				el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)) {
                          
  				if(el.getLocalName().equals("attribute")) {
  					XmlSchemaAttribute attr = 
  						handleAttribute(schema, el,  schemaEl);
  					ext.attributes.add(attr);
  				} else if(el.getLocalName().equals("attributeGroup")) {
  					XmlSchemaAttributeGroupRef attrGroup = 
  						handleAttributeGroupRef(schema, el,  schemaEl);
  					ext.attributes.add(attrGroup);
  				} else if( el.getLocalName().equals( "anyAttribute") ){
  					ext.anyAttribute =  
  						handleAnyAttribute(schema, el, schemaEl);
  				} else if( el.getLocalName().equals( "annotation") ){
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					ext.setAnnotation(ann);
  				}
  			}
  			return ext;
          }
          
          private XmlSchemaComplexContentRestriction
              handleComplexContentRestriction(XmlSchema schema,
  											Element restrictionEl, Element schemaEl) {
                  
              XmlSchemaComplexContentRestriction restriction = 
                  new XmlSchemaComplexContentRestriction();
              
              if(restrictionEl.hasAttribute("base")) {
                  String name = restrictionEl.getAttribute("base");                
                  String prefix ;
                  if (name.indexOf(":")<0)
                      prefix="";
                  else
                      prefix=name.substring(0,name.indexOf(":"));
                  
                  Object result = schema.namespaces.get(prefix);
                  
                  if(result ==null)
                      throw new XmlSchemaException("No namespace found in "
  												 + "given base complex content base type");
                      
  
                  restriction.baseTypeName = new QualifiedName(name , 
  															 result.toString());
              }
              for(Element el=XDOMUtil.getFirstChildElementNS(restrictionEl, 
  														   SCHEMA_NS)
  					;el != null; 
                  el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                      
                  if( el.getLocalName().equals( "sequence") ) {
                      XmlSchemaSequence sequence = 
                          handleSequence(schema, el, schemaEl);
                      restriction.particle = sequence;
                  } else if(el.getLocalName().equals("choice")) {
                      XmlSchemaChoice choice = handleChoice(schema, el, schemaEl);
                      restriction.particle = choice;
                  } else if(el.getLocalName().equals("all")) {
                      XmlSchemaAll all = handleAll(schema, el, schemaEl);
                      restriction.particle = all;
                  } else if(el.getLocalName().equals("attribute")) {
                      XmlSchemaAttribute attr = 
                          handleAttribute(schema, el,  schemaEl);
                      restriction.attributes.add(attr);
                  } else if(el.getLocalName().equals("attributeGroup")) {
                      XmlSchemaAttributeGroupRef attrGroup = 
                          handleAttributeGroupRef(schema, el,  schemaEl);
                      restriction.attributes.add(attrGroup);
                  } else if(el.getLocalName().equals("group")) {
                      XmlSchemaGroupRef group = 
                          handleGroupRef(schema, el, schemaEl);
                      restriction.particle = group;
                  } else if( el.getLocalName().equals( "anyAttribute") ){
                      restriction.anyAttribute =  
                          handleAnyAttribute(schema, el, schemaEl);
                  }else if( el.getLocalName().equals( "annotation") ) {
                      XmlSchemaAnnotation ann = handleAnnotation(el);
                      restriction.setAnnotation(ann);
                  }
              }
              return restriction;
          }
  
          private XmlSchemaComplexContentExtension 
              handleComplexContentExtension(XmlSchema schema, 
  										  Element extEl, Element schemaEl) {
                  
  			XmlSchemaComplexContentExtension ext = 
  				new XmlSchemaComplexContentExtension();
                  
  			if(extEl.hasAttribute("base")) {
  				String name = extEl.getAttribute("base");
  				String namespaceFromEl="";
  				if (name.indexOf(":")>0)
  					namespaceFromEl= Tokenizer.tokenize(name, ":")[0];
  				Object result = schema.namespaces.get(namespaceFromEl);
                      
  				if(result ==null)
  					throw new XmlSchemaException("No namespace found in "
  												 + "given base complex content base type");
                      
  				//                    String namespace = (result==null)? "" : result.toString();
                      
  				ext.baseTypeName = new QualifiedName(name ,
  													 result.toString());
  			}
  
  			for( Element el =XDOMUtil.getFirstChildElementNS(extEl, SCHEMA_NS)
  					 ;el != null; 
  				 el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                          
  				if( el.getLocalName().equals( "sequence") ) {
  					XmlSchemaSequence sequence = 
  						handleSequence(schema, el, schemaEl);
  					ext.particle = sequence;
  				} else if(el.getLocalName().equals("choice")) {
  					XmlSchemaChoice choice = 
  						handleChoice(schema, el, schemaEl);
  					ext.particle = choice;
  				} else if(el.getLocalName().equals("all")) {
  					XmlSchemaAll all = handleAll(schema, el, schemaEl);
  					ext.particle = all;
  				} else if(el.getLocalName().equals("attribute")) {
  					XmlSchemaAttribute attr = 
  						handleAttribute(schema, el,  schemaEl);
  					ext.attributes.add(attr);
  				} else if(el.getLocalName().equals("attributeGroup")) {
  					XmlSchemaAttributeGroupRef attrGroup = 
  						handleAttributeGroupRef(schema, el,  schemaEl);
  					ext.attributes.add(attrGroup);
  				} else if(el.getLocalName().equals("group")) {
  					XmlSchemaGroupRef group = 
  						handleGroupRef(schema, el, schemaEl);
  					ext.particle = group;
  				} else if( el.getLocalName().equals( "anyAttribute") ){
  					ext.anyAttribute =  
  						handleAnyAttribute(schema, el, schemaEl);
  				} else if( el.getLocalName().equals( "annotation") ) {
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					ext.setAnnotation(ann);
  				}
  			}
  			return ext;
          }
  
          private XmlSchemaAttributeGroupRef 
              handleAttributeGroupRef(XmlSchema schema, Element attrGroupEl, 
  									Element schemaEl) {
              
  			XmlSchemaAttributeGroupRef attrGroup = 
  				new XmlSchemaAttributeGroupRef();
  
              if(attrGroupEl.hasAttribute("ref")) {
                  String ref = attrGroupEl.getAttribute("ref");
                  String parts[] = Tokenizer.tokenize(ref, ":");
                  String prefix = "";
                  if (parts.length > 1)
                      prefix=parts[0];
                  Object result = schema.namespaces.get(prefix);
                  //String namespace = (result==null)? "":result.toString(); 
                  if(result ==null)
                      throw new XmlSchemaException("No namespace found in "
  												 + "given ref name");
                      
                  
                  attrGroup.refName = new QualifiedName(ref, result.toString());
              }
  
              if(attrGroupEl.hasAttribute("id"))
                  attrGroup.id = attrGroupEl.getAttribute("id");
  
              Element annotationEl = 
                  XDOMUtil.getFirstChildElementNS(attrGroupEl,
  												SCHEMA_NS,"annotation");
              
              if(annotationEl != null){
                  XmlSchemaAnnotation annotation = handleAnnotation(annotationEl);
                  attrGroup.setAnnotation(annotation);
              }
              return attrGroup;
          }
  
          private XmlSchemaSequence handleSequence(XmlSchema schema, 
  												 Element sequenceEl, Element schemaEl) {
              
  			XmlSchemaSequence sequence = new XmlSchemaSequence();
  			for(Element el=XDOMUtil.getFirstChildElementNS(sequenceEl,SCHEMA_NS)
                      ;el != null; 
  				el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                          
  				if( el.getLocalName().equals( "sequence") ) {
  					XmlSchemaSequence seq = handleSequence(schema, el, 
  														   schemaEl);
  					sequence.items.add(seq);
  				} else if( el.getLocalName().equals( "element") ) {
  					XmlSchemaElement element = handleElement(schema, el, 
  															 schemaEl);
  					sequence.items.add(element);
  				} else if(el.getLocalName().equals("group")) {
  					XmlSchemaGroupRef group = handleGroupRef(schema, el, 
  															 schemaEl);
  					sequence.items.add(group);
  				} else if(el.getLocalName().equals("choice")) {
  					XmlSchemaChoice choice = handleChoice(schema, el, 
  														  schemaEl);
  					sequence.items.add(choice);
  				} else if(el.getLocalName().equals("any")) {
  					XmlSchemaAny any = handleAny(schema, el, schemaEl);
  					sequence.items.add(any);
  				} else if(el.getLocalName().equals("annotation")){
  					XmlSchemaAnnotation annotation = handleAnnotation(el);
  					sequence.setAnnotation(annotation);
  				}
  			}
  			return sequence;
          }
  
          private XmlSchemaAny handleAny(XmlSchema schema, Element anyEl, 
  									   Element schemaEl) {
              
  			XmlSchemaAny any = new XmlSchemaAny();
                  
  			if(anyEl.hasAttribute("namespace"))
  				any.namespace = anyEl.getAttribute("namespace");
  
  			if(anyEl.hasAttribute("processContents")) {
  				String processContent = getEnumString(anyEl, 
  													  "processContents");   
                      
  				any.processContent  = 
  					new XmlSchemaContentProcessing(processContent);
  			}
  
  			Element annotationEl = XDOMUtil.getFirstChildElementNS(anyEl, 
  																   SCHEMA_NS, "annotation");
  
  			if(annotationEl != null){
  				XmlSchemaAnnotation annotation = 
  					handleAnnotation(annotationEl);
  				any.setAnnotation(annotation);
  			}
  			any.minOccurs = getMinOccurs(anyEl);
  			any.maxOccurs = getMaxOccurs(anyEl);
  
  			return any;
          }
  
          private XmlSchemaChoice handleChoice(XmlSchema schema, Element choiceEl, 
  											 Element schemaEl) {
  			XmlSchemaChoice choice = new XmlSchemaChoice();
  
  			if(choiceEl.hasAttribute("id"))
  				choice.id = choiceEl.getAttribute("id");
  
  			for( Element el =XDOMUtil.getFirstChildElementNS(choiceEl,
  															 SCHEMA_NS) 
  					 ;el != null; 
  				 el =XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
  
  				if( el.getLocalName().equals( "sequence") ) {
  					XmlSchemaSequence seq = 
  						handleSequence(schema, el, schemaEl);
  					choice.items.add(seq);
  				} else if( el.getLocalName().equals( "element") ) {
  					XmlSchemaElement element = 
  						handleElement(schema, el, schemaEl);
  					choice.items.add(element);
  				} else if(el.getLocalName().equals("group")) {
  					XmlSchemaGroupRef group = 
  						handleGroupRef(schema, el, schemaEl);
  					choice.items.add(group);
  				} else if(el.getLocalName().equals("choice")) {
  					XmlSchemaChoice choiceItem = 
  						handleChoice(schema, el, schemaEl);
  					choice.items.add(choiceItem);
  				} else if(el.getLocalName().equals("any")) {
  					XmlSchemaAny any = handleAny(schema, el, schemaEl);
  					choice.items.add(any);
  				} else if(el.getLocalName().equals("annotation")){
  					XmlSchemaAnnotation annotation = handleAnnotation(el);
  					choice.setAnnotation(annotation);
  				}
  			}
  			return choice;
          }
          private XmlSchemaAll handleAll(XmlSchema schema, Element allEl, 
  									   Element schemaEl) {
  
              XmlSchemaAll all = new XmlSchemaAll();
  
              for( Element el = XDOMUtil.getFirstChildElementNS(allEl, SCHEMA_NS); 
  				 el != null; el=XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                      
                  if( el.getLocalName().equals( "element") ) {
                      XmlSchemaElement element =handleElement(schema,el,schemaEl);
                      all.items.add(element);
                  }
                  else if(el.getLocalName().equals("annotation")){
                      XmlSchemaAnnotation annotation = handleAnnotation(el);
                      all.setAnnotation(annotation);
                  }
              }
              return all;
          }
  
          private XmlSchemaGroup handleGroup( XmlSchema schema, Element groupEl, 
  											Element schemaEl){
              
  			XmlSchemaGroup group = new XmlSchemaGroup();
  			group.name = groupEl.getAttribute( "name" );
                  
  			for( Element el = XDOMUtil.getFirstChildElementNS(groupEl, 
                                                                SCHEMA_NS); 
  				 el != null; 
  				 el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                          
  				if( el.getLocalName().equals( "all") ){
  					group.particle = handleAll(schema, el, schemaEl);
  				}else if( el.getLocalName().equals( "sequence") ){
  					group.particle = handleSequence(schema, el, schemaEl);
  				}else if( el.getLocalName().equals( "choice") ){
  					group.particle = handleChoice(schema, el, schemaEl);
  				}else if(el.getLocalName().equals("annotation")){
  					XmlSchemaAnnotation groupAnnotation = 
  						handleAnnotation(el);
  					group.setAnnotation(groupAnnotation);
  				}
  			}
  			return group;
          }
  		
          private XmlSchemaAttributeGroup handleAttributeGroup( XmlSchema schema, 
  															  Element groupEl, Element schemaEl){
  			XmlSchemaAttributeGroup attrGroup = 
  				new XmlSchemaAttributeGroup();
  
  			if(groupEl.hasAttribute("name"))
  				attrGroup.name = groupEl.getAttribute("name");
  			if(groupEl.hasAttribute("id"))
  				attrGroup.id = groupEl.getAttribute("id");
  
  			for( Element el = XDOMUtil.getFirstChildElementNS(groupEl, 
  															  SCHEMA_NS); 
  				 el != null; 
  				 el =XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
  
  				if( el.getLocalName().equals( "attribute") ){
  					XmlSchemaAttribute attr = 
  						handleAttribute(schema, el, schemaEl);
  					attrGroup.attributes.add(attr);
  				}else if( el.getLocalName().equals( "attributeGroup") ){
  					XmlSchemaAttributeGroupRef attrGroupRef = 
  						handleAttributeGroupRef(schema, el, schemaEl);
  					attrGroup.attributes.add( attrGroupRef );
  				}else if( el.getLocalName().equals( "anyAttribute") ){
  					attrGroup.anyAttribute =  handleAnyAttribute(schema, 
  																 el, schemaEl);
  				}else if(el.getLocalName().equals("annotation")){
  					XmlSchemaAnnotation ann = handleAnnotation(el);
  					attrGroup.setAnnotation(ann);
  				}
  			}
  			return attrGroup;
          }
  	
          private XmlSchemaAnyAttribute handleAnyAttribute( XmlSchema schema, 
  														  Element anyAttrEl, Element schemaEl) {
  
  			XmlSchemaAnyAttribute anyAttr = new XmlSchemaAnyAttribute();
  
  			if(anyAttrEl.hasAttribute("namespace"))
  				anyAttr.namespace = anyAttrEl.getAttribute("namespace");
  
  			if(anyAttrEl.hasAttribute("processContents")){
  
  				String contentProcessing = getEnumString(anyAttrEl,
  														 "processContents");
  
  				anyAttr.processContent  = new XmlSchemaContentProcessing(
  																		 contentProcessing);
  			}
  			if(anyAttrEl.hasAttribute("id"))
  				anyAttr.id = anyAttrEl.getAttribute("id");
  
  			Element annotationEl = 
  				XDOMUtil.getFirstChildElementNS(anyAttrEl, 
  												SCHEMA_NS,"annotation");
  
  			if(annotationEl != null){
  				XmlSchemaAnnotation annotation = 
  					handleAnnotation(annotationEl);
                      
  				anyAttr.setAnnotation(annotation);
  			}
  			return anyAttr;
          }
  			
          private XmlSchemaGroupRef handleGroupRef(XmlSchema schema, 
  												 Element groupEl, Element schemaEl) {
              
  			XmlSchemaGroupRef group = new XmlSchemaGroupRef();
  
  			Element annotationEl = XDOMUtil.getFirstChildElementNS(groupEl, 
  																   SCHEMA_NS,
  																   "annotation");
                  
  			if(annotationEl != null){
  				XmlSchemaAnnotation annotation = 
  					handleAnnotation(annotationEl);
                    
  				group.setAnnotation(annotation);
  			} 	
  
  			if(groupEl.hasAttribute("ref")) {
  				String ref = groupEl.getAttribute("ref");
  				String parts[] = Tokenizer.tokenize(ref,":");
  				String prefix = "";
  				if (parts.length >1 )
  					prefix=parts[0];
  				Object result = schema.namespaces.get(prefix);
  				//String namespace = (result==null)?"":result.toString();
  				if(result ==null)
  					throw new XmlSchemaException("No namespace found in "
  												 + "given ref group");
                      
  				group.refName = new QualifiedName(ref, result.toString());
                      
  				return group;
  			} 
  			for( Element el = XDOMUtil.getFirstChildElementNS(groupEl, 
  															  SCHEMA_NS) 
  					 ;el != null; 
  				 el = XDOMUtil.getNextSiblingElement(el)){
                          
  				if( el.getLocalName().equals( "sequence") ) {
  					XmlSchemaSequence sequence = 
  						handleSequence(schema, el, schemaEl);
  					group.particle = sequence;
  				} else if(el.getLocalName().equals("all")) {
  					XmlSchemaAll all = handleAll(schema, el, schemaEl);
  					group.particle = all;
  				} else if(el.getLocalName().equals("choice")) {
  					XmlSchemaChoice choice = handleChoice(schema, el, 
  														  schemaEl);
  					group.particle = choice;
  				} 			
  			}
  			return group;
          }
  
          private XmlSchemaAttribute handleAttribute(XmlSchema schema, 
  												   Element attrEl, Element schemaEl) {                
  			//todo: need to implement different rule of attribute such as 
  			//restriction between ref and name.  This can be implemented 
  			//in the compile function 
  			XmlSchemaAttribute attr = new XmlSchemaAttribute();
                  
  			if(attrEl.hasAttribute("name")) {
  				String name = attrEl.getAttribute("name");
  				//String namespace = (schema.targetNamespace==null)?
  				//                  "" :schema.targetNamespace;
                      
  				attr.name = name;
  				attr.qualifiedName = new QualifiedName(name , 
  													   schema.targetNamespace); 
  			}
  
  			if(attrEl.hasAttribute("type")) {
  				String name = attrEl.getAttribute("type");
  				String type[] = Tokenizer.tokenize(name,":");
  				String namespace;
                      
  				if(type.length > 1){
  					Object result = schema.namespaces.get(type[0]);
  					if(result ==null)
  						throw new XmlSchemaException("No namespace found" 
  													 + " in given attribute type");
                      
  					namespace = result.toString();
  				}
  				else
  					namespace = schema.targetNamespace;
                          
  				attr.schemaTypeName =  new QualifiedName(name, namespace);
  			}
  			if(attrEl.hasAttribute("default")) 
  				attr.defaultValue  = attrEl.getAttribute("default");
  
  			if(attrEl.hasAttribute("fixed"))
  				attr.fixedValue = attrEl.getAttribute("fixed");
  
  			if(attrEl.hasAttribute("form")) {
  				String formValue = getEnumString(attrEl, "form");
  				attr.form = new XmlSchemaForm(formValue);
  			}
  			if(attrEl.hasAttribute("id")) 
  				attr.id = attrEl.getAttribute("id"); 
  
  
  			if(attrEl.hasAttribute("use")) {
  				String useType = getEnumString(attrEl, "use");
  				attr.use = new XmlSchemaUse(useType);
  			}
  			if(attrEl.hasAttribute("ref")) {
  				String name = attrEl.getAttribute("ref");
  				String[] namespaceFromEl = Tokenizer.tokenize(name, ":");
  				String namespace;
                      
  				if(namespaceFromEl.length > 1){
  					Object result = 
  						schema.namespaces.get(namespaceFromEl[0]);
  					if(result ==null)
  						throw new XmlSchemaException("No namespace found in"
  													 + " given ref");
  					namespace = result.toString();
  				}
  				else
  					namespace = schema.targetNamespace;
                      
  				attr.refName = new QualifiedName(name, namespace);
  				attr.name = name.substring(name.indexOf(":")+1);
  			}
  
  			Element simpleTypeEl = 
  				XDOMUtil.getFirstChildElementNS(attrEl, 
  												SCHEMA_NS,"simpleType");
                  
  			if( simpleTypeEl != null) {
  				attr.schemaType = handleSimpleType(schema, simpleTypeEl, 
  												   schemaEl);
  			}
  
  			Element annotationEl = 
  				XDOMUtil.getFirstChildElementNS(attrEl, 
  												SCHEMA_NS,"annotation");
                  
  			if(annotationEl != null){
  				XmlSchemaAnnotation annotation = 
  					handleAnnotation(annotationEl);
                      
  				attr.setAnnotation(annotation);
  			}
  
  			NamedNodeMap attrNodes = attrEl.getAttributes();
  			Vector attrs = new Vector();
  			for( int i=0; i<attrNodes.getLength(); i++ ) {
  				Attr att = (Attr) attrNodes.item(i);
  				if( !att.getName().equals( "name" ) &&
  					!att.getName().equals( "type" ) &&
  					!att.getName().equals( "default" ) &&
  					!att.getName().equals( "fixed" ) &&
  					!att.getName().equals( "form" ) &&
  					!att.getName().equals( "id" ) &&
  					!att.getName().equals( "use" ) &&
  					!att.getName().equals( "ref" ) ) {
  						
  
  					attrs.add( att);
  					String value = att.getValue();
  						
  					if( value.indexOf( ":") > -1 ) {
  						// there is a possiblily of some namespace mapping
  						String prefix = value.substring( 0, value.indexOf( ":" ));
  						//String value = ( String) value.substring( value.indexOf( ":" ) + 1);
  						String namespace = ( String) schema.namespaces.get( prefix);
  						if( namespace != null ) {
  							Attr nsAttr = attrEl.getOwnerDocument().createAttribute(  "xmlns:" + prefix);
  							nsAttr.setValue( namespace );
  							attrs.add( nsAttr );
  						}
  					} 
  				}
  			}
  				
  			if( attrs.size() >0 ) 
  				attr.setUnhandledAttributes( (Attr []) attrs.toArray(new Attr[0]) );		
  			return attr;
          }	
  
          /********
           * handle_simple_content_restriction
           * 
           * if( restriction has base attribute )
           *		set the baseType
           * else if( restriciton has an inline simpleType )
           *		handleSimpleType
           * add facets if any to the restriction
           */
  
          /*********
           * handle_simple_content_extension
           * 
           * extension should have a base name and cannot have any inline defn
           * for( each childNode  )
           *		if( attribute)
           *			handleAttribute
           *		else if( attributeGroup)
           *			handleAttributeGroup
           *		else if( anyAttribute)
           *			handleAnyAttribute
           */
  
          /***********
           * handle_complex_content_restriction
           */
          XmlSchemaElement handleElement( XmlSchema schema, Element el, 
  										Element schemaEl ){
              
  			XmlSchemaElement element = new XmlSchemaElement();
                  
  			if(el.getAttributeNode("name") != null)
  				element.name = el.getAttribute( "name" );
                  
  			//                String namespace = (schema.targetNamespace==null)?
  			//                                      "" : schema.targetNamespace;    
                      
  			element.qualifiedName = new QualifiedName( element.name, 
  													   schema.targetNamespace);
  
  			Element annotationEl = XDOMUtil.getFirstChildElementNS(el, 
  																   SCHEMA_NS,"annotation");
                  
  			if(annotationEl != null){
  				XmlSchemaAnnotation annotation = 
  					handleAnnotation(annotationEl);
                      
  				element.setAnnotation(annotation);
  			}
  			if( el.getAttributeNode( "type" ) != null){
  				String typeName = el.getAttribute( "type" );
  				String [] args = Tokenizer.tokenize(typeName,":");
  				String namespace = "";
                      
  				if(args.length > 1){
  					Object result = schema.namespaces.get(args[0]);
  					if(result ==null)
  						throw new XmlSchemaException("No namespace found"
  													 + " in given base simple content type");
                      
  					namespace = result.toString();
  				}
  				else
  					namespace =  schema.targetNamespace;
                      
                      
  				element.schemaTypeName = 
  					new QualifiedName(typeName, namespace);
  			}
  			else if( el.getAttributeNode( "ref") != null ) {
  				String refName = el.getAttribute( "ref" );
                      
  				String [] args = Tokenizer.tokenize( refName,":");
  				String namespace; 
  				if(args.length > 1 ){
  					Object result = schema.namespaces.get(args[0]);
  					if(result ==null)
  						throw new XmlSchemaException("No namespace found in"
  													 + "given ref");
                      
  					namespace = result.toString();
  				}
  				else
  					namespace = schema.targetNamespace;
                      
  				element.setRefName(new QualifiedName(refName, namespace));
  				element.name=refName;
  			}
                  
  			Element simpleTypeEl, complexTypeEl, keyEl, keyrefEl, uniqueEl;
  
  			if( (simpleTypeEl = XDOMUtil.getFirstChildElementNS(el,
  																SCHEMA_NS,"simpleType"))!= null){
                          
  				XmlSchemaSimpleType simpleType = 
  					handleSimpleType( schema,simpleTypeEl, schemaEl);
  				element.schemaType = simpleType;
                  element.schemaTypeName = simpleType.qualifiedName;
  			}
  			else if((complexTypeEl = 
  					 XDOMUtil.getFirstChildElementNS(el,SCHEMA_NS,
  													 "complexType"))!= null) {
                                                         
  				XmlSchemaComplexType complexType = 
  					handleComplexType( schema, complexTypeEl, schemaEl);
                      
  				element.schemaType = complexType;
  				element.schemaTypeName = complexType.qualifiedName;
  			}
  			else if((keyEl = 
  					 XDOMUtil.getFirstChildElementNS(el,SCHEMA_NS,"key"))!= null){
                      
  				XmlSchemaIdentityConstraint key = 
  					handleConstraint(schema, keyEl, schemaEl, "Key");
  				element.constraints.add(key);
  			}
  			else if((keyrefEl = XDOMUtil.getFirstChildElementNS(
  																el, SCHEMA_NS, "keyref")) != null) {
                      
  				XmlSchemaKeyref keyRef = 
  					(XmlSchemaKeyref)handleConstraint(schema, keyrefEl, 
  													  schemaEl, "Keyref");
  
  				if(el.hasAttribute("refer")) {
  					String name = el.getAttribute("refer");
  					String qName[] = 
  						Tokenizer.tokenize(name, ":");
  					String namespace;
                          
  					if(qName.length>1){
  						Object result = schema.namespaces.get(qName[0]);
  						namespace = result.toString();
  					}
  					else
  						namespace = schema.targetNamespace;
                          
  					keyRef.refer = new QualifiedName(name, namespace);
  				}
  
  				element.constraints.add(keyRef);
                      
  			} 
  			else if((uniqueEl = 
  					 XDOMUtil.getFirstChildElementNS(el,
  													 SCHEMA_NS,"unique"))!=null){
                      
  				XmlSchemaIdentityConstraint unique = 
  					handleConstraint(schema,uniqueEl, schemaEl, "Unique");
                      
  				element.constraints.add(unique);
  			}
                  
  			if(el.hasAttribute("abstract"))
  				element.isAbstract = 
  					new Boolean(el.getAttribute("abstract")).booleanValue();
                  
  			if(el.hasAttribute("block"))
  				element.block = getDerivation( el, "block");
  
  			if(el.hasAttribute("default"))
  				element.defaultValue = el.getAttribute("default");
  
  			if(el.hasAttribute("final"))
  				element.finalDerivation =  getDerivation(el, "final");
  
  			if(el.hasAttribute("fixed"))
  				element.fixedValue = el.getAttribute("fixed");
  
  			if(el.hasAttribute("form")){
  				String formDef = getEnumString(el,"form");
  				element.form = new XmlSchemaForm(formDef);
  			}
  			if(el.hasAttribute("id"))
  				element.id = el.getAttribute("id");
  
  			if(el.hasAttribute("nillable"))
  				element.isNillable = 
  					new Boolean(el.getAttribute("nillable")).booleanValue();
  
                  
  			element.minOccurs = getMinOccurs( el );
  			element.maxOccurs = getMaxOccurs( el );
  			return element;
          }
  
          private XmlSchemaIdentityConstraint handleConstraint(XmlSchema schema, 
  															 Element constraintEl, Element schemaEl, String type) {
              
  			try {
  				XmlSchemaIdentityConstraint constraint = 
  					(XmlSchemaIdentityConstraint)Class.forName(
  															   "org.apache.axis.xsd.xml.schema.XmlSchema"+type).newInstance();
  
  				if(constraintEl.hasAttribute("name"))
  					constraint.name = constraintEl.getAttribute("name");
                      
  				if(constraintEl.hasAttribute("refer")) {
  					String name = constraintEl.getAttribute("refer");
  					String[] namespaceFromEl = 
  						Tokenizer.tokenize(name, ":");
  					String namespace;
                          
  					if(namespaceFromEl.length > 1){
  						Object result = 
  							schema.namespaces.get(namespaceFromEl[0]);
  						if(result ==null)
  							throw new XmlSchemaException("No namespace found in "
  														 + "given base simple content type");
                      
  						namespace= result.toString();
  					}else
  						namespace = schema.targetNamespace;
                          
  					constraint.name=name; // need to confirm as it is not name but refer
                          
  					((XmlSchemaKeyref)constraint).refer = 
  						new QualifiedName(name , namespace);
  
  				}
  				for( Element el=XDOMUtil.getFirstChildElementNS(constraintEl, 
  																SCHEMA_NS);
  					 el != null; 
  					 el = XDOMUtil.getNextSiblingElementNS(el, SCHEMA_NS)){
                          
  					//    String elPrefix = el.getPrefix() == null ? "" 
  					//     : el.getPrefix();
  					//if(elPrefix.equals(schema.schema_ns_prefix)) {
  					if( el.getLocalName().equals( "selector") ) {
  						XmlSchemaXPath selectorXPath = 
  							new XmlSchemaXPath();
  						selectorXPath.xpath = el.getAttribute("xpath");
  
  						Element annotationEl = 
  							XDOMUtil.getFirstChildElementNS(el,SCHEMA_NS,
  															"annotation");
  						if(annotationEl != null){
  							XmlSchemaAnnotation annotation = 
  								handleAnnotation(annotationEl);
                                      
  							selectorXPath.setAnnotation(annotation);
  						}
  						constraint.selector = selectorXPath;
  					}else if( el.getLocalName().equals( "field") ) {
  						XmlSchemaXPath fieldXPath = new XmlSchemaXPath();
  						fieldXPath.xpath = el.getAttribute("xpath");
  						constraint.fields.add(fieldXPath);
  
  						Element annotationEl = 
  							XDOMUtil.getFirstChildElementNS(el,SCHEMA_NS,
  															"annotation");
                                 
  						if(annotationEl != null){
  							XmlSchemaAnnotation annotation = 
  								handleAnnotation(annotationEl);
                                     
  							fieldXPath.setAnnotation(annotation);
  						}
  					}else if( el.getLocalName().equals( "annotation")){
  						XmlSchemaAnnotation constraintAnnotation = 
  							handleAnnotation(el);
  						constraint.setAnnotation(constraintAnnotation);
  					}
  				}
  				return constraint;
  			}
  			catch(ClassNotFoundException e){
  				throw new XmlSchemaException(e.getMessage());
  			}
  			catch(InstantiationException e){
  				throw new XmlSchemaException(e.getMessage());
  			}
  			catch(IllegalAccessException e){
  				throw new XmlSchemaException(e.getMessage());
  			}
          }
          
          XmlSchemaImport handleImport(XmlSchema schema, Element importEl, 
                                       Element schemaEl){
                                           
              XmlSchemaImport schemaImport = new XmlSchemaImport();
      
              Element annotationEl = 
                  XDOMUtil.getFirstChildElementNS(importEl,SCHEMA_NS,"annotation");
              
              if(annotationEl != null){
                  XmlSchemaAnnotation importAnnotation = 
                      handleAnnotation(annotationEl);
                  schemaImport.setAnnotation(importAnnotation);
              }
  
              schemaImport.namespace = importEl.getAttribute( "namespace");
              schemaImport.schemaLocation = 
                  importEl.getAttribute( "schemaLocation" );
              
  			if ((schemaImport.schemaLocation != null)&&(!schemaImport.schemaLocation.equals("")))
  				schemaImport.schema = getXmlSchemaFromLocation( 
  															   schemaImport.schemaLocation);
              return schemaImport;
          }
  
          XmlSchemaInclude handleInclude( XmlSchema schema, 
  										Element includeEl, Element schemaEl) {
              
  			XmlSchemaInclude include = new XmlSchemaInclude();
  
  			Element annotationEl = 
  				XDOMUtil.getFirstChildElementNS(includeEl, 
  												SCHEMA_NS,"annotation");
                  
  			if(annotationEl != null){
  				XmlSchemaAnnotation includeAnnotation = 
  					handleAnnotation(annotationEl);
  				include.setAnnotation(includeAnnotation);
  			}
  
  			include.schemaLocation = 
  				includeEl.getAttribute( "schemaLocation" );
  
  
  			include.schema = 
  				getXmlSchemaFromLocation( include.schemaLocation);
  
  			XmlSchemaObjectCollection coll = include.schema.getItems();
                  
  			return include;
          }
  
          /**
           * Traversing if encounter appinfo or documentation 
           * add it to annotation collection
           */
          XmlSchemaAnnotation handleAnnotation(Element annotEl){
              XmlSchemaObjectCollection content = new XmlSchemaObjectCollection();
              XmlSchemaAppInfo appInfoObj;
              XmlSchemaDocumentation docsObj;                    
  
              for(Element appinfo = XDOMUtil.getFirstChildElementNS(annotEl,
  																  SCHEMA_NS,"appinfo"); appinfo != null; 
                  appinfo = XDOMUtil.getNextSiblingElementNS(
  														   appinfo,SCHEMA_NS,"appinfo")){
  
                  appInfoObj =  handleAppInfo(appinfo);
                  content.add(appInfoObj);
              }
              for(Element documentation = XDOMUtil.getFirstChildElementNS(annotEl,
  																		SCHEMA_NS,"documentation"); documentation != null; 
                  documentation = XDOMUtil.getNextSiblingElementNS(documentation,
  																 SCHEMA_NS,"documentation")){
                  
                  docsObj = handleDocumentation(documentation);
                  content.add(docsObj);
              }
  
              XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
              annotation.items = content;
              return annotation; 
          }
  
          //create new XmlSchemaAppinfo and add value goten from element
          //to this obj
          XmlSchemaAppInfo handleAppInfo(Element content){
              XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); 
              NodeList markup= getChild(content);
  
              if(!content.hasAttribute("source") && markup.getLength() <= 0)
                  return null;
              appInfo.setSource(getAttribute(content, "source"));
              appInfo.setMarkup(markup);
              return appInfo;
          }
  
          //iterate each documentation element, create new XmlSchemaAppinfo and add to collection
          XmlSchemaDocumentation handleDocumentation(Element content){
              XmlSchemaDocumentation documentation = new XmlSchemaDocumentation();
              NodeList markup= getChild(content);
  
              if(!content.hasAttribute("source") && 
  			   !content.hasAttribute("xml:lang") && markup.getLength()<=0)
                  return null;
  
              documentation.setSource(getAttribute(content, "source"));
              documentation.setLanguage(getAttribute(content,"xml:lang"));
              documentation.setMarkup(getChild(content));
  
              return documentation;
          }
  
          private String getAttribute(Element content, String attrName){
              if(content.hasAttribute(attrName))
                  return content.getAttribute(attrName);
              return null;
          }
          private NodeList getChild(Element content){
              NodeList childs = content.getChildNodes();
              if(childs.getLength()>0)
                  return childs;
              return null;
          }
  
          long getMinOccurs( Element el ) {
              try{
                  if( el.getAttributeNode( "minOccurs") != null ) {
                      String value = el.getAttribute( "minOccurs");
                      if( value.equals( "unbounded" ) )
                          return Long.MAX_VALUE;
                      else
                          return new Long(value).longValue();
                  }
                  return 1;
              }
              catch(java.lang.NumberFormatException  e ){
                  return 1;
              }
          }
  
          long getMaxOccurs( Element el ) {
              try{
                  if( el.getAttributeNode( "maxOccurs") != null ) {
                      String value = el.getAttribute( "maxOccurs");
                      if( value.equals( "unbounded" ) )
                          return Long.MAX_VALUE;
                      else
                          return new Long(value).longValue();
                  }
                  return 1;
              }
              catch(java.lang.NumberFormatException e ){
                  return 1;
              }
          }
  
          XmlSchemaForm getFormDefault( Element el, String attrName ) {
              if( el.getAttributeNode( attrName) != null ) {                         
                  String value = el.getAttribute( attrName);
                  char c = Character.toUpperCase(value.charAt(0));
                  return new XmlSchemaForm(c + value.substring(1));
              } else
                  return new XmlSchemaForm("Unqualified");
          }
          
          //Check value entered by user and change according to .net spec, 
          //according to w3c spec have to be "#all"
          //but in .net the valid enum value is "all". 
          XmlSchemaDerivationMethod getDerivation( Element el, String attrName ) {
              if(el.hasAttribute( attrName ) ) {
                  //#all | List of (extension | restriction | substitution    
                  String derivationMethod = el.getAttribute(attrName).trim();
                  char c = Character.toUpperCase(derivationMethod.charAt(0));
                  if(derivationMethod.equals("#all"))
                      return new XmlSchemaDerivationMethod("All");
                  else 
                      return new XmlSchemaDerivationMethod(
  														 c+derivationMethod.substring(1));
              }
              return new XmlSchemaDerivationMethod( "None");
          }
          
          //Check value entered by user and change according to .net spec, user
          String getEnumString(Element el, String attrName){
              if(el.hasAttribute( attrName ) ) {
                  String contentProcessing = el.getAttribute(attrName).trim();
                  char c = Character.toUpperCase(contentProcessing.charAt(0));
                  return c+contentProcessing.substring(1);
              }
              return "None";
          }
  
          XmlSchema getXmlSchemaFromLocation( String schemaLocation ){
              try {
                  XmlSchema s = new XmlSchema();
                  java.net.URL u = new java.net.URL(schemaLocation);
                  java.io.InputStream uStream=u.openConnection().getInputStream();
                  java.io.InputStreamReader readerS = 
                      new java.io.InputStreamReader(uStream);
                  
                  s = XmlSchema.read(readerS, null);
                  return s;
              }catch( java.io.IOException e){
                  throw new XmlSchemaException( e.getMessage());
              }
          }
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAll.java
  
  Index: XmlSchemaAll.java
  ===================================================================
  /*
   * XmlSchemaAll.java
   *
   * Created on September 27, 2001, 3:37 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Permits the elements in the group to appear (or not appear) 
   * in any order in the containing element. Represents the World
   * Wide Web Consortium (W3C) all element (compositor).
   *
   * @author  mukund
   */
  public class XmlSchemaAll extends XmlSchemaGroupBase {
  
      /** Creates new XmlSchemaAll */
      public XmlSchemaAll() {
      }
  	
  	public XmlSchemaObjectCollection getItems() {
  		return this.items;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAnnotated.java
  
  Index: XmlSchemaAnnotated.java
  ===================================================================
  /*
   * XmlSchemaAnnotated.java
   *
   * Created on September 27, 2001, 3:08 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.w3c.dom.Attr;
  
  /**
   * The base class for any element that can contain annotation elements.
   *
   * @author  mukund
   */
  
  // October 15th - momo - initial implementation
  
  public class XmlSchemaAnnotated extends XmlSchemaObject {
  	/**
  	 * Defines an annotation. 
  	 * Creates an annotation element. 
  	 * Represents the W3C annotation element.
  	 */
  	XmlSchemaAnnotation annotation;
  	String id;
  	
  	// Stores qualified attributes that do not belong to the schema target namespace.
  	public Attr[] unhandledAttributes;
  	
  	
      /** Creates new XmlSchemaAnnotated */
      public XmlSchemaAnnotated() {
      }
  
  	public String getId() {
  		return id;
  	}
  	
  	public void setId(String id) {
  		this.id = id;
  	}
  	
  	public XmlSchemaAnnotation getAnnotation() {
  		return annotation;
  	}
  	
  	public void setAnnotation(XmlSchemaAnnotation annotation) {
  		this.annotation = annotation;
  	}
  	
  	public Attr[] getUnhandledAttributes() {
  		return unhandledAttributes;
  	}
  	
  	public void setUnhandledAttributes(Attr[] unhandledAttributes) {
  		this.unhandledAttributes = unhandledAttributes;
  	}
  	
  }
  
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAnnotation.java
  
  Index: XmlSchemaAnnotation.java
  ===================================================================
  /*
   * XmlSchemaAnnotation.java
   *
   * Created on September 27, 2001, 3:40 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.w3c.dom.Element;
  import org.w3c.dom.NodeList;
  
  /**
   * Defines an annotation. Represents the World Wide Web Consortium (W3C)
   * annotation element.
   *
   * @author  mukund
   */
  
  // October 15th - momo  - initial implementation
  // Feb 15th 2002 - Joni - items initialized when instantiated.
  
  public class XmlSchemaAnnotation extends XmlSchemaObject {
      XmlSchemaObjectCollection items;
  	
      /** Creates new XmlSchemaAnnotation */
      public XmlSchemaAnnotation() {
          items = new XmlSchemaObjectCollection();
      }
  	
      public XmlSchemaObjectCollection getItems() {
              return items;
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAny.java
  
  Index: XmlSchemaAny.java
  ===================================================================
  /*
   * XmlSchemaAny.java
   *
   * Created on September 27, 2001, 3:36 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Enables any element from the specified namespace or namespaces 
   * to appear in the containing complexType element. Represents the
   * World Wide Web Consortium (W3C) any element.
   *
   * @author  mukund
   */
  
  // Feb 15th 2002 - Joni - Processing content will be initialized with "None"
  
  public class XmlSchemaAny extends XmlSchemaParticle {
  
  	/** Creates new XmlSchemaAny */
  	public XmlSchemaAny() {
  		processContent = new XmlSchemaContentProcessing("None");
  	}
  	
  	/**
  	 * Namespaces containing the elements that can be used.
  	 */
  	String namespace;
  	
  	public String getNamespace() {
  		return namespace;
  	}
  	
  	public void setNamespace(String namespace) {
  		this.namespace = namespace;
  	}
  	
  	XmlSchemaContentProcessing processContent;
  	
  	public XmlSchemaContentProcessing getProcessContent() {
  		return processContent;
  	}
  	
  	public void setProcessContent(XmlSchemaContentProcessing processContent) {
  		this.processContent = processContent;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAnyAttribute.java
  
  Index: XmlSchemaAnyAttribute.java
  ===================================================================
  /*
   * XmlSchemaAnyAttribute.java
   *
   * Created on September 27, 2001, 3:09 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Enables any attribute from the specified namespace or namespaces 
   * to appear in the containing complexType element. Represents the
   * World Wide Web Consortium (W3C) anyAttribute element.
   *
   * @author  mukund
   */
  public class XmlSchemaAnyAttribute extends XmlSchemaAnnotated {
  
  	/** Creates new XmlSchemaAnyAttribute */
  	public XmlSchemaAnyAttribute() {
  		processContent = new XmlSchemaContentProcessing("None");
  	}
  
  	String namespace;
  	
  	public String getNamespace() {
  		return namespace;
  	}
  	
  	public void setNamespace(String namespace) {
  		this.namespace = namespace;
  	}
  	
  	XmlSchemaContentProcessing processContent;
  	
  	public XmlSchemaContentProcessing getProcessContent() {
  		return processContent;
  	}
  	
  	public void setProcessContent(XmlSchemaContentProcessing processContent) {
  		this.processContent = processContent;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAppInfo.java
  
  Index: XmlSchemaAppInfo.java
  ===================================================================
  /*
   * XmlSchemaAppInfo.java
   *
   * Created on September 27, 2001, 3:40 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.w3c.dom.NodeList;
  
  /**
   * Defines application specific information within an annotation. 
   * Represents the World Wide Web Consortium (W3C) appinfo element.
   *
   * @author  mukund
   */
  
  // Jan 24 2002 - Joni - Change the Node into NodeList
  
  
  public class XmlSchemaAppInfo extends XmlSchemaObject {
  
  	/**
  	 * Provides the source of the application information.
  	 */
  	String source;
  	
  	/**
  	 * Returns an array of XmlNode that represents the document text markup.
  	 */
  	NodeList markup;
  		
      /** 
       * Creates new XmlSchemaAppInfo 
       * The default constructor initializes all fields to their default values.
       * */
      public XmlSchemaAppInfo() {
      }
  	
  	public String getSource() {
  		return source;
  	}
  	
  	public void setSource(String source) {
  		this.source = source;
  	}
  	
  	public NodeList getMarkup() {
  		return markup;
  	}
  	
  	public void setMarkup(NodeList markup) {
  		this.markup = markup;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAttribute.java
  
  Index: XmlSchemaAttribute.java
  ===================================================================
  /*
   * XmlSchemaAttribute.java
   *
   * Created on September 27, 2001, 3:09 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for attribute types. Represents the World Wide Web Consortium
   * (W3C) attribute element.
   *
   * @author  mukund
   */
  
  // October 15th - momo - initial implementation
  
  public class XmlSchemaAttribute extends XmlSchemaAnnotated {
  
  	Object attributeType;
  	String defaultValue, fixedValue, name;
  	XmlSchemaForm form;
  	XmlSchemaSimpleType schemaType;
  	QualifiedName schemaTypeName, qualifiedName, refName;
  	XmlSchemaUse use;
  	
      /** Creates new XmlSchemaAttribute */
  	public XmlSchemaAttribute() {
  		form = new XmlSchemaForm("None");
  		use= new XmlSchemaUse("None");
  	}
  
  	public Object getAttributeType() {
  		return attributeType;
  	}
  	
  	public String getDefaultValue() {
  		return defaultValue;
  	}
  	
  	public void setDefaultValue(String defaultValue) {
  		this.defaultValue = defaultValue;
  	}
  	
  	public String getFixedValue() {
  		return fixedValue;
  	}
  	
  	public void setFixedValue(String fixedValue) {
  		this.fixedValue = fixedValue;
  	}
  	
  	public XmlSchemaForm getForm() {
  		return form;
  	}
  	
  	public void setSchemaForm(XmlSchemaForm form) {
  		this.form = form;
  	}	
  	
  	public QualifiedName getQualifiedName() {
  		return qualifiedName;
  	}
  	
  	public void setQualifiedName(QualifiedName qualifiedName) {
  		this.qualifiedName = qualifiedName;
  	}
  	
  	public String getName() {
  		return name;
  	}
  	
  	public void setName(String name) {
  		this.name = name;
  	}
  	
  	public QualifiedName getRefName() {
  		return refName;
  	}
  	
  	public void setRefName(QualifiedName refName) {
  		this.refName = refName;
  	}
  	
  	public XmlSchemaSimpleType getSchemaType() {
  		return schemaType;
  	}
  	
  	public void setSchemaType(XmlSchemaSimpleType schemaType) {
  		this.schemaType = schemaType;
  	}
  	
  	public QualifiedName getSchemaTypeName() {
  		return schemaTypeName;
  	}
  	
  	public void setSchemaTypeName(QualifiedName schemaTypeName) {
  		this.schemaTypeName = schemaTypeName;
  	}
  	
  	public XmlSchemaUse getUse() {
  		return use;
  	}
  	
  	public void setUse(XmlSchemaUse use) {
  		this.use = use;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "<"+prefix+"attribute name=\""+name+"\" type=\""+schemaTypeName+"\"/>\n";
  		
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAttributeGroup.java
  
  Index: XmlSchemaAttributeGroup.java
  ===================================================================
  /*
   * XmlSchemaAttributeGroup.java
   *
   * Created on September 27, 2001, 3:09 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for attribute groups. Groups a set of attribute declarations 
   * so that they can be incorporated as a group into complex type 
   * definitions. Represents the World Wide Web Consortium (W3C) 
   * attributeGroup element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaAttributeGroup extends XmlSchemaAnnotated{
  
      /** Creates new XmlSchemaAttributeGroup */
      public XmlSchemaAttributeGroup() {
          attributes = new XmlSchemaObjectCollection();
      }
  
  	XmlSchemaAnyAttribute anyAttribute;
  	
  	public XmlSchemaAnyAttribute getAnyAttribute(){
  		return this.anyAttribute;
  	}
  	
  	public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute){
  		this.anyAttribute = anyAttribute;
  	}
  	
  	XmlSchemaObjectCollection attributes;
          
  	public XmlSchemaObjectCollection getAttributes(){
  		return this.attributes;
  	}
  	
  	public void setAttributes(XmlSchemaObjectCollection attributes){
  		this.attributes = attributes;
  	}
  	
  	String name;
  	
  	public String getName(){
  		return this.name;
  	}
  	
  	public void setName( String name) {
  		this.name = name;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaAttributeGroupRef.java
  
  Index: XmlSchemaAttributeGroupRef.java
  ===================================================================
  /*
   * XmlSchemaAttributeGroupRef.java
   *
   * Created on September 27, 2001, 3:10 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.apache.axis.xsd.xml.QualifiedName;
  /**
   *
   * Class for the attribute group reference. Represents the World Wide
   * Web Consortium (W3C) attributeGroup element with the ref attribute.
   * 
   * @author  mukund
   * 
   */
  public class XmlSchemaAttributeGroupRef extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaAttributeGroupRef */
      public XmlSchemaAttributeGroupRef() {
      }
  	
  	QualifiedName refName;
  	
  	public QualifiedName getRefName(){
  		return this.refName;
  	}
  
  	public void setRefName(QualifiedName refName) {
  		this.refName = refName;
  	}
  		
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaChoice.java
  
  Index: XmlSchemaChoice.java
  ===================================================================
  /*
   * XmlSchemaChoice.java
   *
   * Created on September 27, 2001, 3:37 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Allows only one of its children to appear in an instance. Represents 
   * the World Wide Web Consortium (W3C) choice (compositor) element.
   *
   * @author  mukund
   */
  public class XmlSchemaChoice extends XmlSchemaGroupBase{
  
      /** Creates new XmlSchemaChoice */
      public XmlSchemaChoice() {
      }
  	
  	public XmlSchemaObjectCollection getItems() {
  		return this.items;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollection.java
  
  Index: XmlSchemaCollection.java
  ===================================================================
  /*
   * XmlSchemaCollection.java
   *
   * Created on September 27, 2001, 3:06 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Contains a cache of XML Schema definition language (XSD).
   * This class cannot be inherited.
   *
   * @author  mukund
   */
  public final class XmlSchemaCollection {
  
      /** Creates new XmlSchemaCollection */
      public XmlSchemaCollection() {
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaCollectionEnumerator.java
  
  Index: XmlSchemaCollectionEnumerator.java
  ===================================================================
  /*
   * XmlSchemaCollectionEnumerator.java
   *
   * Created on September 27, 2001, 3:07 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Supports a simple iteration over a collection. This class cannot be inherited.
   * 
   * @author  mukund
   */
  public final class XmlSchemaCollectionEnumerator {
  
      /** Creates new XmlSchemaCollectionEnumerator */
      public XmlSchemaCollectionEnumerator() {
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaComplexContent.java
  
  Index: XmlSchemaComplexContent.java
  ===================================================================
  /*
   * XmlSchemaComplexContent.java
   *
   * Created on September 27, 2001, 3:19 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class that represents the complex content model for complex types. 
   * Contains extensions or restrictions on a complex type that has mixed 
   * content or elements only. Represents the World Wide Web Consortium (W3C) 
   * complexContent element.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaComplexContent extends XmlSchemaContentModel {
  
      /** Creates new XmlSchemaComplexContent */
      public XmlSchemaComplexContent() {
      }
  	
  	/* One of either the XmlSchemaComplexContentRestriction or 
  	 * XmlSchemaComplexContentExtension classes.
  	 */
  	XmlSchemaContent content;
  	
  	public XmlSchemaContent getContent() {
  		return this.content;
  	}
  
  	public void setContent( XmlSchemaContent content) {
  		this.content = content;
  	}
  	
  	/* Indicates that this type has a mixed content model. Character data
  	 * is allowed to appear between the child elements of the complex type. 
  	 */
  	public boolean mixed;
  	
  	public boolean isMixed() {
  		return this.mixed;
  	}
  	
  	public void setMixed(boolean mixed) {
  		this.mixed = mixed;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  		
  		xml += "<"+prefix+"complexContent>\n";
  		
  		xml += content.toString(prefix, (tab+1));
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		xml += "<"+prefix+"complexContent>\n";
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaComplexContentExtension.java
  
  Index: XmlSchemaComplexContentExtension.java
  ===================================================================
  /*
   * XmlSchemaComplexContentExtension.java
   *
   * Created on September 27, 2001, 3:11 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for complex types with a complex content model derived by extension. 
   * Extends the complex type by adding attributes or elements. Represents the 
   * World Wide Web Consortium (W3C) extension element for complex content.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaComplexContentExtension extends XmlSchemaContent {
  
      /** Creates new XmlSchemaComplexContentExtension */
      public XmlSchemaComplexContentExtension() {
          attributes = new XmlSchemaObjectCollection();
          
      }
  
  	/* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
  	XmlSchemaAnyAttribute anyAttribute;
  	
  	public void setAnyAttribute( XmlSchemaAnyAttribute anyAttribute ) {
  		this.anyAttribute = anyAttribute;
  	}
  	
  	public XmlSchemaAnyAttribute getAnyAttribute() {
  		return this.anyAttribute;
  	}
  	
  	/* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/
  	XmlSchemaObjectCollection  attributes;
  	
  	public XmlSchemaObjectCollection getAttributes() {
  		return this.attributes;
  	}
  
  	/* Name of the built-in data type, simple type, or complex type.*/
  	QualifiedName baseTypeName;
  	
  	public void setBaseTypeName( QualifiedName  baseTypeName) {
  		this.baseTypeName = baseTypeName;
  	}
  	
  	public QualifiedName getBaseTypeName() {
  		return this.baseTypeName;
  	}
  	
  	/*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.*/
  	XmlSchemaParticle particle;
  	
  	public XmlSchemaParticle getParticle() {
  		return this.particle;
  	}
  	
  	public void setParticle( XmlSchemaParticle particle ) {
  		this.particle = particle;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  	
  		xml += "<"+prefix+"extension>\n";
  		
  		if(particle != null)
  			xml += particle.toString(prefix, (tab+1));
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "</"+prefix+"extension>\n";
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaComplexContentRestriction.java
  
  Index: XmlSchemaComplexContentRestriction.java
  ===================================================================
  /*
   * XmlSchemaComplexContentRestriction.java
   *
   * Created on September 27, 2001, 3:17 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for complex types with a complex content model that are derived 
   * by restriction. Restricts the contents of the complex type to a subset
   * of the inherited complex type. Represents the World Wide Web Consortium 
   * (W3C) restriction element for complex content.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaComplexContentRestriction extends XmlSchemaContent {
  
      /** Creates new XmlSchemaComplexContentRestriction */
      public XmlSchemaComplexContentRestriction() {
         attributes= new XmlSchemaObjectCollection();
      }
  
  	/* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
  	XmlSchemaAnyAttribute anyAttribute;
  	
  	public void setAnyAttribute( XmlSchemaAnyAttribute anyAttribute ) {
  		this.anyAttribute = anyAttribute;
  	}
  	
  	public XmlSchemaAnyAttribute getAnyAttribute() {
  		return this.anyAttribute;
  	}
  	
  	/* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. 
  	 *  Collection of attributes for the simple type.
  	 */
  	XmlSchemaObjectCollection  attributes;
  	
  	public XmlSchemaObjectCollection getAttributes() {
  		return this.attributes;
  	}
  
  	/* Name of the built-in data type, simple type, or complex type.*/
  	QualifiedName baseTypeName;
  	
  	public void setBaseTypeName( QualifiedName  baseTypeName) {
  		this.baseTypeName = baseTypeName;
  	}
  	
  	public QualifiedName getBaseTypeName() {
  		return this.baseTypeName;
  	}
  	
  	/*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, 
  	 * or XmlSchemaSequence classes.
  	 */
  	XmlSchemaParticle particle;
  	
  	public XmlSchemaParticle getParticle() {
  		return this.particle;
  	}
  	
  	public void setParticle( XmlSchemaParticle particle ) {
  		this.particle = particle;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  	
  		xml += "<"+prefix+"restriction>\n";
  		
  		if(particle != null)
  			xml += particle.toString(prefix, (tab+1));
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "</"+prefix+"restriction>\n";
  		return xml;
  	}
  }
  
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaComplexType.java
  
  Index: XmlSchemaComplexType.java
  ===================================================================
  /*
   * XmlSchemaComplexType.java
   *
   * Created on September 27, 2001, 3:40 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for complex types. Defines a complex type that determines the
   * set of attributes and content of an element. Represents the World Wide 
   * Web Consortium (W3C) complexType element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaComplexType extends XmlSchemaType {
  	XmlSchemaAnyAttribute anyAttribute, attributeWildcard;
  	XmlSchemaObjectCollection attributes;
  	XmlSchemaObjectTable attributeUses;
  	XmlSchemaDerivationMethod block, blockResolved;
  	XmlSchemaContentModel contentModel;
  	XmlSchemaContentType contentType;
  	XmlSchemaParticle particleType, particle;
  	boolean isAbstract, isMixed;
  	
      /** Creates new XmlSchemaComplexType */
  	public XmlSchemaComplexType() {
  		attributes = new XmlSchemaObjectCollection();
  		block=new XmlSchemaDerivationMethod("None");
  		isAbstract=false;
  		isMixed=false;
  	}
  
  	public XmlSchemaAnyAttribute getAnyAttribute() {
  		return anyAttribute;
  	}
  	
  	public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
  		this.anyAttribute = anyAttribute;
  	}
  	
  	public  XmlSchemaObjectCollection getAttributes() {
  		return attributes;
  	}
  	
  	public XmlSchemaObjectTable getAttributeUses() {
  		return attributeUses;
  	}
  	
  	public XmlSchemaAnyAttribute getAttributeWildcard() {
  		return attributeWildcard;
  	}
  	
  	public XmlSchemaDerivationMethod getBlock() {
  		return block;
  	}
  	
  	public void setBlock(XmlSchemaDerivationMethod block) {
  		this.block = block;
  	}
  	
  	public XmlSchemaDerivationMethod getBlockResolved() {
  		return blockResolved;
  	}
  	
  	public XmlSchemaContentModel getContentModel() {
  		return contentModel;
  	}
  	
  	public void setContentModel(XmlSchemaContentModel contentModel) {
  		this.contentModel = contentModel;
  	}
  	
  	public XmlSchemaContentType  getContentType() {
  		return contentType;
  	}
  	
  	public void setContentType(XmlSchemaContentType contentType) {
  		this.contentType = contentType;
  	}
  	
  	public XmlSchemaParticle getContentTypeParticle() {
  		return particleType;
  	}
  	
  	public boolean isAbstract() {
  		return isAbstract;
  	}
  	
  	public void setAbstract(boolean b) {
  		isAbstract = b;
  	}
  	
  	public boolean isMixed() {
  		return isMixed;
  	}
  	
  	public void setMixed(boolean b) {
  		isMixed = b;
  	}
  	
  	public XmlSchemaParticle getParticle() {
  		return particle;
  	}
  	
  	public void setParticle(XmlSchemaParticle particle) {
  		this.particle = particle;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  
  		String typeName = name != null ? name : "";
  		
  		xml += "<"+prefix+"complexType name=\""+typeName+"\">\n";
  		
  		if(particle != null) 
  			xml += particle.toString(prefix, (tab+1));
  		
  		if(contentModel != null) 
  			xml += contentModel.toString(prefix, (tab+1));
  		
  		for(int i=0;i<attributes.getCount();i++) {
  			xml += attributes.getItem(i).toString(prefix, (tab+1));
  		}
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  				
  		xml += "</"+prefix+"complexType>\n";
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaContent.java
  
  Index: XmlSchemaContent.java
  ===================================================================
  /*
   * XmlSchemaContent.java
   *
   * Created on September 27, 2001, 3:11 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * An abstract class for schema content.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public abstract class XmlSchemaContent extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaContent */
      protected XmlSchemaContent() {
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaContentModel.java
  
  Index: XmlSchemaContentModel.java
  ===================================================================
  /*
   * XmlSchemaContentModel.java
   *
   * Created on September 27, 2001, 3:18 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * An abstract class for the schema content model.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public abstract class XmlSchemaContentModel extends XmlSchemaAnnotated{
  
      /** Creates new XmlSchemaContentModel */
      protected XmlSchemaContentModel() {
      }
  
  	public abstract void setContent(XmlSchemaContent content);
  	
  	public abstract XmlSchemaContent getContent();
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaContentProcessing.java
  
  Index: XmlSchemaContentProcessing.java
  ===================================================================
  /*
   * XmlSchemaContentProcessing.java
   *
   * Created on September 27, 2001, 3:04 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.enum.Enum;
  
  /**
   * Provides information about the validation mode of any 
   * and anyAttribute element replacements.
   *
   * @author  mukund
   */
  
  public class XmlSchemaContentProcessing extends Enum {
  
  	static String[] members = new String[] { "Lax", "None",
  											 "Skip", "Strict"};
  	
      /** Creates new XmlSeverityType */
      public XmlSchemaContentProcessing() {
  		super();
  	}
  	
  	public XmlSchemaContentProcessing(String value) {
  		super(value);
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaContentType.java
  
  Index: XmlSchemaContentType.java
  ===================================================================
  /*
   * XmlSchemaContentType.java
   *
   * Created on September 27, 2001, 3:04 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.enum.Enum;
  
  /**
   * Enumerations for the content model of the complex type. This 
   * represents the content in the post-schema-validation infoset.
   *
   * @author  mukund
   */
  
  public class XmlSchemaContentType extends Enum {
  
  	static String[] members = new String[] { "ElementOnly", "Empty", 
  											 "Mixed", "TextOnly"};
  		
      /** Creates new XmlSchemaContentType */
      public XmlSchemaContentType() {
  		super();
      }
  
  	public XmlSchemaContentType(String value) {
  		super(value); 
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaDatatype.java
  
  Index: XmlSchemaDatatype.java
  ===================================================================
  /*
   * XmlSchemaDatatype.java
   *
   * Created on September 27, 2001, 3:07 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.apache.axis.xsd.xml.XmlTokenizedType;
  
  /**
   *
   * @author  mukund
   */
  
  public abstract class XmlSchemaDatatype {
  
      /** Creates new XmlSchemaDatatype */
      public XmlSchemaDatatype() {
      }
  	
  	public abstract Object parseValue(Object input);
  	public abstract Class valueType();
  	public abstract XmlTokenizedType tokenizedType();
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaDerivationMethod.java
  
  Index: XmlSchemaDerivationMethod.java
  ===================================================================
  /*
   * XmlSchemaDerivationMethod.java
   *
   * Created on September 27, 2001, 3:04 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.enum.Enum;
  
  /**
   * Provides different methods for preventing derivation.
   *
   * @author  mukund
   */
  
  public class XmlSchemaDerivationMethod extends Enum {
  	static String[] members = new String[] { "All", "Empty", "Extension", 
  											 "List", "None", "Restriction", 
  											 "Substitution", "Union"};
  	
      /** Creates new XmlSeverityType */
      public XmlSchemaDerivationMethod() {
  		super();
  	}
  	
  	public XmlSchemaDerivationMethod(String value) {
  		super(value);
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaDocumentation.java
  
  Index: XmlSchemaDocumentation.java
  ===================================================================
  /*
   * XmlSchemaDocumentation.java
   *
   * Created on September 27, 2001, 3:41 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.w3c.dom.NodeList;
  
  /**
   * Class that specifies information to be read or used by humans
   * within an annotation. Represents the World Wide Web Consortium 
   * (W3C) documentation element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaDocumentation extends XmlSchemaObject {
  
      /** Creates new XmlSchemaDocumentation */
      public XmlSchemaDocumentation() {
      }
  	
  	/**
  	 * Provides the source of the application information.
  	 */
  	String source;
  	String language;
  	
  	/**
  	 * Returns an array of XmlNode that represents the document text markup.
  	 */
  	NodeList markup;
  	
  	public String getSource() {
  		return source;
  	}
  	
  	public void setSource(String source) {
  		this.source = source;
  	}
  	
  	public NodeList getMarkup() {
  		return markup;
  	}
  	
  	public void setMarkup(NodeList markup) {
  		this.markup = markup;
  	}
  	
  	public String getLanguage() {
  		return language;
  	}
  	
  	public void setLanguage(String language) {
  		this.language = language;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaElement.java
  
  Index: XmlSchemaElement.java
  ===================================================================
  /*
   * XmlSchemaElement.java
   *
   * Created on September 27, 2001, 3:36 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for elements. Represents the World Wide Web Consortium (W3C) element element.  
   *
   * @author  mukund
   */
  
  // October 15th - momo - initial implementation
  public class XmlSchemaElement extends XmlSchemaParticle  {
  
  	/**
  	 * Attribute used to block a type derivation.
  	 */
  	XmlSchemaDerivationMethod block;
  	
  	/**
  	 * The value after an element has been compiled to post-schema infoset. 
  	 * This value is either from the type itself or, if not defined on the type, taken from the schema element.
  	 */
  	XmlSchemaDerivationMethod blockResolved;
  	XmlSchemaObjectCollection constraints;
  	
  	/**
  	 * Provides the default value of the element if its content 
  	 * is a simple type or the element's content is textOnly.
  	 */
  	String defaultValue;
  	String fixedValue;
  	
  	/**
  	 * Returns the correct common runtime library 
  	 * object based upon the SchemaType for the element.
  	 */
  	Object elementType;
  
  	XmlSchemaDerivationMethod finalDerivation;
  	XmlSchemaDerivationMethod finalDerivationResolved;
  	
  	/**
  	 * The default value is the value of the elementFormDefault attribute for the schema element containing the attribute. 
  	 * The default is Unqualified.
  	 */
  	XmlSchemaForm form; 
  	boolean isAbstract;
  	boolean isNillable;
  	String name;
  	QualifiedName qualifiedName;
  	QualifiedName refName;
  	
  	/**
  	 * Returns the type of the element. 
  	 * This can either be a complex type or a simple type.
  	 */
  	XmlSchemaType schemaType;
  	
  	/**
  	 * QualifiedName of a built-in data type defined in this schema or another 
  	 * schema indicated by the specified namespace.
  	 */
  	QualifiedName schemaTypeName;
  	
  	/**
  	 * QualifiedName of an element that can be a substitute for this element.
  	 */
  	QualifiedName substitutionGroup;
  	
  	/** Creates new XmlSchemaElement */
          public XmlSchemaElement() {
                 constraints = new XmlSchemaObjectCollection();
                 isAbstract = false;
                 isNillable = false;
                 form = new XmlSchemaForm("None");
                 finalDerivation = new XmlSchemaDerivationMethod("None");
                 block = new XmlSchemaDerivationMethod("None");
          }
  	
  	/**
  	 * Returns a collection of constraints on the element.
  	 */
  	public XmlSchemaObjectCollection getConstraints() {
  		return constraints;
  	}
  	
  	public String getDefaultValue() {
  		return defaultValue;
  	}
  	
  	public void setDefaultValue(String defaultValue) {
  		this.defaultValue = defaultValue;
  	}
  	
  	public XmlSchemaDerivationMethod getBlock() {
  		return block;
  	}
  	
  	public void setBlock(XmlSchemaDerivationMethod block) {
  		this.block = block;
  	}
  	
  	public XmlSchemaDerivationMethod getFinal() {
  		return finalDerivation;
  	}
  	
  	public void setFinal(XmlSchemaDerivationMethod finalDerivation) {
  		this.finalDerivation = finalDerivation;
  	}
  	
  	public XmlSchemaDerivationMethod getBlockResolved() {
  		return blockResolved;
  	}
  	
  	public String getFixedValue() {
  		return fixedValue;
  	}
  	
  	public void setFixedValue(String fixedValue) {
  		this.fixedValue = fixedValue;
  	}
  	
  	public Object getElementType() {
  		return elementType;
  	}
  	
  	public XmlSchemaForm getForm() {
  		return form;
  	}
  	
  	public void setForm(XmlSchemaForm form) {
  		this.form = form;
  	}
  	
  	public boolean isAbstract() {
  		return isAbstract;
  	}
  	
  	public void setAbstract(boolean isAbstract) {
  		this.isAbstract = isAbstract;
  	}
  	
  	public boolean isNillable() {
  		return isNillable;
  	}
  	
  	public void setNillable(boolean isNillable) {
  		this.isNillable = isNillable;
  	}
  	
  	public String getName() {
  		return name;
  	}
  	
  	public void setName(String name) {
  		this.name = name;
  	}
  	
  	public QualifiedName getRefName() {
  		return refName;
  	}
  	
  	public void setRefName(QualifiedName refName) {
  		this.refName = refName;
  	}
  	
  	public QualifiedName getQualifiedName() {
  		return qualifiedName;
  	}
  	
  	public void setQualifiedName(QualifiedName qualifiedName) {
  		this.qualifiedName = qualifiedName;
  	}
  	
  	public XmlSchemaType getSchemaType() {
  		return schemaType;
  	}
  	
  	public void setSchemaType(XmlSchemaType schemaType) {
  		this.schemaType = schemaType;
  	}
  	
  	public QualifiedName getSchemaTypeName() {
  		return schemaTypeName;
  	}
  	
  	public void setSchemaTypeName(QualifiedName schemaTypeName) {
  		this.schemaTypeName = schemaTypeName;
  	}
  	
  	public QualifiedName getSubstitutionGroup() {
  		return substitutionGroup;
  	}
  	
  	public void setSubstitutionGroup(QualifiedName substitutionGroup) {
  		this.substitutionGroup = substitutionGroup;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "<"+prefix+"element ";
  		
  		if(!name.equals("")) 
  			xml += "name=\""+name+"\" ";
  		
  		if(schemaTypeName != null) 
  			xml +="type=\""+schemaTypeName+"\"";
  		
  		if(refName != null)
  			xml += "ref=\"" + refName + "\" ";
  		
  		if(minOccurs != 1)
  			xml +=  "minOccurs=\""+minOccurs+"\" "; 
  		
  		if(maxOccurs != 1)
  			xml += "maxOccurs=\""+maxOccurs+"\" ";
  			   
  		xml += ">\n";
  		
  		if(constraints != null)
  			xml += constraints.toString(prefix, (tab+1));
  	
  		if(schemaType != null) {
  			xml += schemaType.toString(prefix, (tab + 1));
  		} 
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "</"+prefix+"element>\n";
  		
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaEnumerationFacet.java
  
  Index: XmlSchemaEnumerationFacet.java
  ===================================================================
  /*
   * XmlSchemaEnumerationFacet.java
   *
   * Created on September 27, 2001, 3:21 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining enumeration facets. Represents the World Wide
   * Web Consortium (W3C) enumeration facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaEnumerationFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaEnumerationFacet */
      public XmlSchemaEnumerationFacet() {
      }
  
  	public XmlSchemaEnumerationFacet( Object value, boolean fixed ) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaException.java
  
  Index: XmlSchemaException.java
  ===================================================================
  /*
   * XmlSchemaException.java
   *
   * Created on September 27, 2001, 3:00 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  
  /**
   * Returns detailed information about the schema exception.
   *
   * @author  mukund
   */
  
  public class XmlSchemaException extends RuntimeException {
  
      /** Creates new XmlSchemaException */
      public XmlSchemaException() {
      }
      
  	public XmlSchemaException(String message) {
  		super(message);
  	}
  	// TODO :implement
      public int getLineNumer() {
  		return 1;
      }
      
      public int getLinePosition() {
  		return 1;
      }
      
      public XmlSchemaObject getSourceSchemaObject() {
  		return null;
      }
      
      public String getSourceUri() {
  		return null;
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaExternal.java
  
  Index: XmlSchemaExternal.java
  ===================================================================
  /*
   * XmlSchemaExternal.java
   *
   * Created on September 27, 2001, 3:19 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * An abstract class. Provides information about the included schema.
   *
   * @author  mukund
   */
  
  public abstract class XmlSchemaExternal extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaExternal */
      protected XmlSchemaExternal() {
      }
  
  	XmlSchema schema;
  	
  	public XmlSchema getSchema() {
  		return schema;
  	}
  	
  	public void setSchema(XmlSchema schema) {
  		this.schema = schema;
  	}
  	
  	String schemaLocation;
  	
  	public String getSchemaLocation() {
  		return schemaLocation;
  	}
  	
  	public void setSchemaLocation(String schemaLocation) {
  		this.schemaLocation = schemaLocation;
  	}
  }
  
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaFacet.java
  
  Index: XmlSchemaFacet.java
  ===================================================================
  /*
   * XmlSchemaFacet.java
   *
   * Created on September 27, 2001, 3:21 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.w3c.dom.Element;
  /**
   * Abstract class for all facets that are used when simple types are 
   * derived by restriction.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  // Vidyanand - 17th Oct - added the construct method
  // Vidyanand -  6th Dec - changed RuntimeExceptions thrown to XmlSchemaExceptions
  
  public abstract class XmlSchemaFacet extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaFacet */
  	
  	
      protected XmlSchemaFacet() {
      }
  	
  	protected XmlSchemaFacet( Object value, boolean fixed ) {
  		this.value = value;
  		this.fixed = fixed;
  	}
  	
  	boolean fixed;
  	
  	Object value;
  	
  	public boolean isFixed() {
  		return fixed;
  	}
  	
  	public void setFixed(boolean fixed) {
  		this.fixed = fixed;
  	}	
  	
  	public Object getValue() {
  		return value;
  	}
  
  	public void setValue(Object value) {
  		this.value = value;
  	}
  	
  	public static XmlSchemaFacet construct( Element el ) {
  		String name = el.getLocalName();
  		boolean fixed = false;
  		if( el.getAttribute( "fixed" ).equals( "true" ) ) {
  			fixed = true;
  		}
  		try {
  			// TODO : move this from reflection to a if condition and avoid cost 
  			// of reflection
  			Class facetClass = Class.forName("org.apache.axis.xsd.xml.schema.XmlSchema" 
  											 + Character.toUpperCase(name.charAt(0)) 
  											 + name.substring(1) + "Facet");
  			XmlSchemaFacet facet = (XmlSchemaFacet) facetClass.newInstance();
  			facet.setFixed( fixed );
  			facet.setValue( el.getAttribute( "value" ));
  			return facet;		
  		} catch (ClassNotFoundException e) {
  			throw new XmlSchemaException(e.getMessage());
  		} catch (InstantiationException e) {
  			throw new XmlSchemaException(e.getMessage());
  		} catch (IllegalAccessException e) {
  			throw new XmlSchemaException(e.getMessage());
  		}
  			
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaForm.java
  
  Index: XmlSchemaForm.java
  ===================================================================
  /*
   * XmlSchemaForm.java
   *
   * Created on September 27, 2001, 3:05 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.enum.Enum;
  
  /**
   * Indicates if attributes or elements need to be qualified or left unqualified.  
   *
   * @author  mukund
   */
  
  // October 15th - momo - initial implementation
  // Jan 16th - Vidyanand - changed Quailified to qualified and Unqualified to unqualified 
  // Feb 12th - Joni change qualified to Qualified  and unqualified to Unqualified 
  
  public class XmlSchemaForm extends Enum {
  
  	static String[] members = new String[] { "None", "Qualified", "Unqualified"};
  		
      /** Creates new XmlSchemaForm */
      public XmlSchemaForm() {
  		super();
      }
  	
  	public XmlSchemaForm(String value) {
  		super(value);
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaFractionDigitsFacet.java
  
  Index: XmlSchemaFractionDigitsFacet.java
  ===================================================================
  /*
   * XmlSchemaFractionDigitsFacet.java
   *
   * Created on September 27, 2001, 3:24 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining fractionDigits facets. Represents the World Wide
   * Web Consortium (W3C) fractionDigits facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaFractionDigitsFacet extends XmlSchemaNumericFacet {
  
      /** Creates new XmlSchemaFractionDigitsFacet */
      public XmlSchemaFractionDigitsFacet() {
      }
  	
  	public XmlSchemaFractionDigitsFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaGroup.java
  
  Index: XmlSchemaGroup.java
  ===================================================================
  /*
   * XmlSchemaGroup.java
   *
   * Created on September 27, 2001, 3:34 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class that defines groups at the schema level that are referenced 
   * from the complex types. Groups a set of element declarations so that
   * they can be incorporated as a group into complex type definitions. 
   * Represents the World Wide Web Consortium (W3C) group element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaGroup extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaGroup */
      public XmlSchemaGroup() {
      }
  	
  	String name;
  	XmlSchemaGroupBase particle;
  	
  	public String getName() {
  		return name;
  	}
  	
  	public void setName(String name) {
  		this.name = name;
  	}
  	
  	public XmlSchemaGroupBase getParticle() {
  		return particle;
  	}
  	
  	public void setParticle(XmlSchemaGroupBase particle) {
  		this.particle = particle;
  	}
  	
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaGroupBase.java
  
  Index: XmlSchemaGroupBase.java
  ===================================================================
  /*
   * XmlSchemaGroupBase.java
   *
   * Created on September 27, 2001, 3:36 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * An abstract class for XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence.
   *
   * @author  mukund
   */
  
  public abstract class XmlSchemaGroupBase extends XmlSchemaParticle {
  	XmlSchemaObjectCollection items;
  	
      /** Creates new XmlSchemaGroupBase */
      public XmlSchemaGroupBase() {
  		items = new XmlSchemaObjectCollection();
      }
  
  	public abstract XmlSchemaObjectCollection getItems();
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaGroupRef.java
  
  Index: XmlSchemaGroupRef.java
  ===================================================================
  /*
   * XmlSchemaGroupRef.java
   *
   * Created on September 27, 2001, 3:37 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.apache.axis.xsd.xml.QualifiedName;
  /**
   * Class used within complex types that defines the reference to 
   * groups defined at the schema level. Represents the World Wide
   * Web Consortium (W3C) group element with ref attribute.
   *
   * @author  mukund
   */
  
  public class XmlSchemaGroupRef extends XmlSchemaParticle {
  
      /** Creates new XmlSchemaGroupRef */
      public XmlSchemaGroupRef() {
      }
  	
  	XmlSchemaGroupBase particle;
  	
  	public XmlSchemaGroupBase getParticle(){
  		return this.particle;
  	}
  	
  	QualifiedName refName;
  	
  	public QualifiedName getRefName(){
  		return this.refName;
  	}
  
  	public void setRefName(QualifiedName refName) {
  		this.refName = refName;
  	}
  	
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaIdentityConstraint.java
  
  Index: XmlSchemaIdentityConstraint.java
  ===================================================================
  /*
   * XmlSchemaIdentityConstraint.java
   *
   * Created on September 27, 2001, 3:34 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for the identity constraints: key, keyref, and unique elements.  
   *
   * @author  mukund
   */
  
  // Vidyanand - should this be an abstract class ???
  
  public class XmlSchemaIdentityConstraint extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaIdentityConstraint */
      public XmlSchemaIdentityConstraint() {
  		fields = new XmlSchemaObjectCollection();
      }
  
  	XmlSchemaObjectCollection fields;
  	
  	public XmlSchemaObjectCollection getFields() {
  		return fields;
  	}
  	
  	String name;
  	
  	public String getName() {
  		return name;
  	}
  	
  	public void setName(String name) {
  		this.name = name;
  	}
  	
  	XmlSchemaXPath selector;
  	
  	public XmlSchemaXPath getSelector() {
  		return selector;
  	}
  	
  	public void setSelector(XmlSchemaXPath selector) {
  		this.selector = selector;
  	}
  	
  	
  	
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaImport.java
  
  Index: XmlSchemaImport.java
  ===================================================================
  /*
   * XmlSchemaImport.java
   *
   * Created on September 27, 2001, 3:20 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * The class to import schema components from any schema. 
   * Represents the World Wide Web Consortium (W3C) import element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaImport extends XmlSchemaExternal{
  
      /** Creates new XmlSchemaImport */
      public XmlSchemaImport() {
  		super();
      }
  
  	String namespace;
  	
  	public String getNamespace(){
  		return this.namespace;
  	}
  	
  	public void setNamespace( String namespace){
  		this.namespace = namespace;
  	}
  							  
  					 
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaInclude.java
  
  Index: XmlSchemaInclude.java
  ===================================================================
  /*
   * XmlSchemaInclude.java
   *
   * Created on September 27, 2001, 3:20 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class to include declarations and definitions from an external schema.
   * Allows them to be available for processing in the containing schema. 
   * Represents the World Wide Web Consortium (W3C) include element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaInclude extends XmlSchemaExternal {
  
      /** Creates new XmlSchemaInclude */
      public XmlSchemaInclude() {
  		super();
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaKey.java
  
  Index: XmlSchemaKey.java
  ===================================================================
  /*
   * XmlSchemaKey.java
   *
   * Created on September 27, 2001, 3:34 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Identifies a key constraint. Represents the World Wide Web Consortium
   * (W3C) key element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaKey  extends XmlSchemaIdentityConstraint{
  
      /** Creates new XmlSchemaKey */
      public XmlSchemaKey() {
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaKeyref.java
  
  Index: XmlSchemaKeyref.java
  ===================================================================
  /*
   * XmlSchemaKeyref.java
   *
   * Created on September 27, 2001, 3:35 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Identifies a keyref constraint. Represents the World Wide Web 
   * Consortium (W3C) keyref element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaKeyref extends XmlSchemaIdentityConstraint {
  
      /** Creates new XmlSchemaKeyref */
      public XmlSchemaKeyref() {
      }
  
  	QualifiedName refer;
  	
  	public QualifiedName getRefer() {
  		return refer;
  	}
  	
  	public void setRefer(QualifiedName refer) {
  		this.refer = refer;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaLengthFacet.java
  
  Index: XmlSchemaLengthFacet.java
  ===================================================================
  /*
   * XmlSchemaLengthFacet.java
   *
   * Created on September 27, 2001, 3:24 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining length facets. Represents the World Wide Web 
   * Consortium (W3C) length facet.  
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaLengthFacet extends XmlSchemaNumericFacet{
  
      /** Creates new XmlSchemaLengthFacet */
      public XmlSchemaLengthFacet() {
      }
  
  	public XmlSchemaLengthFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaMaxExclusiveFacet.java
  
  Index: XmlSchemaMaxExclusiveFacet.java
  ===================================================================
  /*
   * XmlSchemaMaxExclusiveFacet.java
   *
   * Created on September 27, 2001, 3:21 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   *
   * Class for defining maxExclusive facets. Represents the World Wide 
   * Web Consortium (W3C) maxExclusive facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaMaxExclusiveFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaMaxExclusiveFacet */
      public XmlSchemaMaxExclusiveFacet() {
      }
  	
  	public XmlSchemaMaxExclusiveFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaMaxInclusiveFacet.java
  
  Index: XmlSchemaMaxInclusiveFacet.java
  ===================================================================
  /*
   * XmlSchemaMaxInclusiveFacet.java
   *
   * Created on September 27, 2001, 3:22 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   *
   * Class for defining maxInclusive facets. Represents the World
   * Wide Web Consortium (W3C) maxInclusive facet.
   * 
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaMaxInclusiveFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaMaxInclusiveFacet */
      public XmlSchemaMaxInclusiveFacet() {
      }
  
  	public XmlSchemaMaxInclusiveFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaMaxLengthFacet.java
  
  Index: XmlSchemaMaxLengthFacet.java
  ===================================================================
  /*
   * XmlSchemaMaxLengthFacet.java
   *
   * Created on September 27, 2001, 3:32 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining maxLength facets. Represents the World Wide 
   * Web Consortium (W3C) maxLength facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaMaxLengthFacet extends XmlSchemaNumericFacet {
  
      /** Creates new XmlSchemaMaxLengthFacet */
      public XmlSchemaMaxLengthFacet() {
      }
  
  	public XmlSchemaMaxLengthFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaMinExclusiveFacet.java
  
  Index: XmlSchemaMinExclusiveFacet.java
  ===================================================================
  /*
   * XmlSchemaMinExclusive.java
   *
   * Created on September 27, 2001, 3:22 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining minExclusive facets. Represents the World 
   * Wide Web Consortium (W3C) minExclusive facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaMinExclusiveFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaMinExclusive */
      public XmlSchemaMinExclusiveFacet() {
      }
  	
  	public XmlSchemaMinExclusiveFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaMinInclusiveFacet.java
  
  Index: XmlSchemaMinInclusiveFacet.java
  ===================================================================
  /*
   * XmlSchemaMinInclusive.java
   *
   * Created on September 27, 2001, 3:22 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining minInclusive facets. Represents the World Wide
   * Web Consortium (W3C) minInclusive facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaMinInclusiveFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaMinInclusive */
      public XmlSchemaMinInclusiveFacet() {
      }
  
  	public XmlSchemaMinInclusiveFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaMinLengthFacet.java
  
  Index: XmlSchemaMinLengthFacet.java
  ===================================================================
  /*
   * XmlSchemaMinLengthFacet.java
   *
   * Created on September 27, 2001, 3:32 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining minLength facets. Represents the World Wide 
   * Web Consortium (W3C) minLength facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaMinLengthFacet extends XmlSchemaNumericFacet {
  
      /** Creates new XmlSchemaMinLengthFacet */
      public XmlSchemaMinLengthFacet() {
      }
  
  	public XmlSchemaMinLengthFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaNotation.java
  
  Index: XmlSchemaNotation.java
  ===================================================================
  /*
   * XmlSchemaNotation.java
   *
   * Created on September 27, 2001, 3:35 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class represents a notation. An XML Schema definition language (XSD)
   * notation declaration is a reconstruction of XML 1.0 NOTATION 
   * declarations. The purpose of notations is to describe the format of
   * non-XML data within an XML document. Represents the World Wide Web Consortium 
   * (W3C) notation element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaNotation extends XmlSchemaAnnotated  {
  
  	String name, system, publicNotation;
  	
      /** Creates new XmlSchemaNotation */
      public XmlSchemaNotation() {
      }
  
  	public String getName() {
  		return name;
  	}
  	
  	public void setString(String name) {
  		this.name = name;
  	}
  	
  	public String getPublic() {
  		return publicNotation;
  	}
  	
  	public void setPublic(String publicNotation) {
  		this.publicNotation = publicNotation;
  	}
  	
  	public String getSystem() {
  		return system;
  	}
  	
  	public void setSystem(String system) {
  		this.system = system;
  	}
  	
  	
  	
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaNumericFacet.java
  
  Index: XmlSchemaNumericFacet.java
  ===================================================================
  /*
   * XmlSchemaNumericFacet.java
   *
   * Created on September 27, 2001, 3:23 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Abstract class for defining numeric facets.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public abstract class XmlSchemaNumericFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaNumericFacet */
      protected XmlSchemaNumericFacet() {
      }
  	
  	protected XmlSchemaNumericFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  	
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaObject.java
  
  Index: XmlSchemaObject.java
  ===================================================================
  /*
   * XmlSchemaObject.java
   *
   * Created on September 27, 2001, 3:07 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   *
   * @author  mukund
   */
  
  // October 15th - momo - initial implementation
  
  public abstract class XmlSchemaObject {
  	int lineNumber;
  	int linePosition;
  	String sourceURI;
  		
      /** Creates new XmlSchemaObject */
      protected XmlSchemaObject() {
      }
  	
  	public int getLineNumber() {
  		return lineNumber;
  	}
  	
  	public void setLineNumber(int lineNumber) {
  		this.lineNumber = lineNumber;
  	}
  	
  	public int getLinePosition() {
  		return linePosition;
  	}
  	
  	public void setLinePosition(int linePosition) {
  		this.linePosition = linePosition;
  	}
  	
  	public String getSourceURI() {
  		return sourceURI;
  	}
  	
  	public void setSourceURI(String sourceURI) {
  		this.sourceURI = sourceURI;
  	}
  	
  	public boolean equals(Object what) {
  		// toDO : implement this once everything completed
  		return true;
  	}
  	
  	public String toString(String prefix, int tab) { 
  		String xml = new String();
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += this.getClass().toString() + "\n";
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaObjectCollection.java
  
  Index: XmlSchemaObjectCollection.java
  ===================================================================
  /*
   * XmlSchemaObjectCollection.java
   *
   * Created on September 27, 2001, 2:58 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  import java.util.Vector;
  import java.util.Iterator;
  
  /**
   * An object collection class to handle XmlSchemaObjects when collections
   * are returned from method calls.
   *
   * @author  mukund
   */
  public class XmlSchemaObjectCollection {
  
  	Vector objects;
  	
      /** Creates new XmlSchemaObjectCollection */
      public XmlSchemaObjectCollection() {
  		objects = new Vector();
      }
  	
  	public int getCount() {
  		return objects.size();
  	}
  	
  	public XmlSchemaObject getItem(int i) {
  		return (XmlSchemaObject)objects.elementAt(i);
  	}
  
  	public void setItem(int i, XmlSchemaObject item) {
  		objects.insertElementAt(item, i);
  	}
  	
  	public void add(XmlSchemaObject item) {
  		objects.addElement(item);
  	}
  	
  	public boolean contains(XmlSchemaObject item) {
  		return objects.contains(item);
  	}
  	
  	public int indexOf(XmlSchemaObject item) {
  		return objects.indexOf(item);
  	}
  	
  	public void remove(XmlSchemaObject item) {
  		objects.remove(item);
  	}
  	
  	public void removeAt(int index) {
  		objects.removeElementAt(index);
  	}
  	
  	public Iterator getIterator() {
  		return objects.iterator();
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		for(int i=0;i<getCount();i++) {
  			xml += getItem(i).toString(prefix, tab);
  		}
  
  		
  		return xml;
  			
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaObjectEnumerator.java
  
  Index: XmlSchemaObjectEnumerator.java
  ===================================================================
  /*
   * XmlSchemaObjectEnumerator.java
   *
   * Created on September 27, 2001, 3:41 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * An enumerator class to walk the XmlSchemaObjectCollection collections.
   *
   * @author  mukund
   */
  public class XmlSchemaObjectEnumerator {
  
      /** Creates new XmlSchemaObjectEnumerator */
      public XmlSchemaObjectEnumerator() {
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaObjectTable.java
  
  Index: XmlSchemaObjectTable.java
  ===================================================================
  /*
   * XmlSchemaObjectTable.java
   *
   * Created on September 27, 2001, 3:41 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import java.util.Hashtable;
  import java.util.Enumeration;
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * A collection class that provides read-only helpers for XmlSchemaObject 
   * objects. This class is used to provide the collections for contained 
   * elements that are within the schema as collections that are accessed 
   * from the XmlSchema class (for example, Attributes, AttributeGroups, 
   * Elements, and so on).
   *
   * @author  mukund
   */
  
  // Vidyanand - 17th Oct - initial implementation
  
  public class XmlSchemaObjectTable {
  
  	Hashtable collection;
      /** Creates new XmlSchemaObjectTable */
      public XmlSchemaObjectTable() {
  		this.collection = new Hashtable();;
      }
  	
  	public int getCount() {
  		return this.collection.size();
  	}
  	
  	public XmlSchemaObject getItem( QualifiedName name ) {
  		return (XmlSchemaObject) collection.get(name);
  	}
  	
  	public Enumeration getNames(){
  		return collection.keys();
  	}
  
  	public Enumeration getValues(){
  		return collection.elements();
  	}
  	
  	public boolean contains(QualifiedName name) {
  		return collection.contains( name );
  	}
  	
  	//TODO: think of smthg better 
  	public Object getEnumerator(){
  		return null;
  	}
  	
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaParticle.java
  
  Index: XmlSchemaParticle.java
  ===================================================================
  /*
   * XmlSchemaParticle.java
   *
   * Created on September 27, 2001, 3:35 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Base class for all particle types.
   *
   * @author  mukund
   */
  
  // October 15th - momo - initial implementation
  
  public class XmlSchemaParticle extends XmlSchemaAnnotated {
  
  	long maxOccurs = 1;
  	String maxOccursString;
  	long minOccurs = 1;
  	String minOccursString;
  	
      /**
  	 * Creates new XmlSchemaParticle 
       * Particle types are usually interchangeable. 
       * A local element declaration or reference to a global element 
       * declaration (element), a compositor ( sequence, choice, or all), 
       * a reference to a named content model group (group), or an element wildcard (any).
       *
  	 */
      public XmlSchemaParticle() {
      }
  
  	public void setMaxOccurs(long maxOccurs) {
  		this.maxOccurs = maxOccurs;
  	}
  	
  	public long getMaxOccurs() {
  		return maxOccurs;
  	}
  	
  	public void setMinOccurs(long minOccurs) {
  		this.minOccurs = minOccurs;
  	}
  	
  	public long getMinOccurs() {
  		return minOccurs;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaPatternFacet.java
  
  Index: XmlSchemaPatternFacet.java
  ===================================================================
  /*
   * XmlSchemaPatternFacet.java
   *
   * Created on September 27, 2001, 3:33 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining pattern facets. Represents the World Wide 
   * Web Consortium (W3C) pattern facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaPatternFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaPatternFacet */
      public XmlSchemaPatternFacet() {
      }
  
  	public XmlSchemaPatternFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaRedefine.java
  
  Index: XmlSchemaRedefine.java
  ===================================================================
  /*
   * XmlSchemaRedefine.java
   *
   * Created on September 27, 2001, 3:20 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Allows simple and complex types, groups, and attribute groups from 
   * external schema files to be redefined in the current schema. This 
   * class provides versioning for the schema elements. Represents the
   * World Wide Web Consortium (W3C) redefine element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaRedefine  extends XmlSchemaExternal {
  
      /** Creates new XmlSchemaRedefine */
      public XmlSchemaRedefine() {
          items = new XmlSchemaObjectCollection();
      }
  
  	XmlSchemaObjectTable attributeGroups, groups, schemaTypes;
  	
  	public XmlSchemaObjectTable getAttributeGroup() {
  		return attributeGroups;
  	}
  	
  	public XmlSchemaObjectTable getGroup() {
  		return groups;
  	}
  	
  	XmlSchemaObjectCollection items;
  	
  	public XmlSchemaObjectCollection getItems() {
  		return items;
  	}
  	
  	public XmlSchemaObjectTable getSchemaTypes() {
  		return schemaTypes;
  	}
  	
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSequence.java
  
  Index: XmlSchemaSequence.java
  ===================================================================
  /*
   * XmlSchemaSequence.java
   *
   * Created on September 27, 2001, 3:37 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Requires the elements in the group to appear in the specified sequence 
   * within the containing element. Represents the World Wide Web Consortium 
   * (W3C) sequence (compositor) element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaSequence extends XmlSchemaGroupBase {
  
      /** Creates new XmlSchemaSequence */
      public XmlSchemaSequence() {
      }
  
  	/**
  	 *  The elements contained within the compositor. 
  	 *	Collection of XmlSchemaElement, XmlSchemaGroupRef, 
  	 *  XmlSchemaChoice, XmlSchemaSequence, or XmlSchemaAny.
  	 */
  	public XmlSchemaObjectCollection getItems() {
  		return items;
  	}	
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  	
  		xml += "<"+prefix+"sequence>\n";
  		for(int i=0;i<items.getCount();i++) {
  			xml += items.getItem(i).toString(prefix, (tab+1));
  		}
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "</"+prefix+"sequence>\n";
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSerializer.java
  
  Index: XmlSchemaSerializer.java
  ===================================================================
  /*
   * XmlSchemaSerializer.java
   * 
   * Construct Document of given XmlSchema component
   *
   * @author  joni
   *
   * Feb 13th 2002 - Joni - First working version
   * Feb 18th 2002 - Joni - add serializer method that just return current
   *                        XmlSchema obj.
   *                        Move functions createDocument and getParts from XUtil.
   * Feb 19th 2002 - Joni - Adding namespace for xml:lang and setting 
   *                        targetNamespace xmlns to targetNamespace if not 
   *                        specified.
   * Feb 20th 2002 - Joni - Problems with include.
   * Feb 21th 2002 - Joni - Porting to using core common util
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  
  import java.io.FileReader;
  import java.util.Enumeration;
  import java.util.ArrayList;
  import java.util.Hashtable;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  import org.w3c.dom.DocumentFragment;
  import org.w3c.dom.Element;
  import org.w3c.dom.Document;
  import org.w3c.dom.NodeList;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  import org.w3c.dom.Text;
  import org.w3c.dom.Attr;
  
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.ParserConfigurationException;
  
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  
  
  public class XmlSchemaSerializer {
      private Hashtable schema_ns;
      
      static String xsdPrefix="xs";
      public static final String xsdNamespace="http://www.w3.org/2001/XMLSchema";
      ArrayList docs;
      Element schemaElement;
  
      private XmlSchemaSerializer() {
  		docs = new ArrayList();
  		schema_ns = new Hashtable();
      }
      
      public static void main(String[] args) throws Exception{    
          XmlSchema schema = XmlSchema.read(new java.io.FileReader(
  																 "E:/projects/core/xml/schema/test/serializerTestCase/"
  																 +"Test8ElementRefTest.xsd"), null);
          //XmlSchemaSerializer serializer = new XmlSchemaSerializer();
          Document[] serializedSchemas = XmlSchemaSerializer.serializeSchema(schema, true);
      }
      
      
      /************************************************************************
  	 * Document[]  serializeSchema(XmlSchema schemaObj, 
  	 *   boolean serializeIncluded)
  	 *
  	 * Serialize XmlSchema object pass back the document containing a schema
  	 * element as its root.
  	 *
  	 * Parameter:
  	 * schemaObj - Schema object to serialize.
  	 * serialzeIncluded - whether to serialize the included(imported) 
  	 *                    schema or not. pass true for serialize all included 
  	 *                    schema. 
  	 *
  	 * Return:
  	 * Array of Documents that include/imported. 
  	 ************************************************************************/
      public static Document[] serializeSchema(XmlSchema schemaObj, 
  											 boolean serializeIncluded) throws XmlSchemaSerializerException{
          return new XmlSchemaSerializer().serializeSchemaElement(schemaObj, 
  																serializeIncluded);
      }
      
      Document[]  serializeSchemaElement(XmlSchema schemaObj, 
  									   boolean serializeIncluded) throws XmlSchemaSerializerException{
       
          XmlSchemaObjectCollection items = schemaObj.getItems();
  		Document serializedSchemaDocs = null;
  		try{    
  			DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();            
  			docFac.setNamespaceAware(true);
  			DocumentBuilder builder = docFac.newDocumentBuilder();
  			serializedSchemaDocs = builder.newDocument();
  		}catch( ParserConfigurationException e ){
  			throw new XmlSchemaException(e.getMessage());	
  		}
  
          Element serializedSchema;
         
  		serializedSchema = setupNamespaces(serializedSchemaDocs, schemaObj);
  		schemaElement = serializedSchema;
          
          if(schemaObj.targetNamespace != null){
              serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, 
  											"targetNamespace",schemaObj.targetNamespace);
  
              Object targetNS = 
                  schema_ns.get(schemaObj.targetNamespace);
              
              //if the namespace is not entered then add 
              //the targetNamespace as its
              if(targetNS == null){
                  serializedSchema.setAttributeNS("http://www.w3.org/2000/xmlns/", 
  												"xmlns", schemaObj.targetNamespace);
                  schema_ns.put(schemaObj.targetNamespace.toString(), "");
              }
          }
          
          
          //todo: implement xml:lang, 
          if(schemaObj.attributeFormDefault != null ){ 
              String formQualified =  schemaObj.attributeFormDefault.getValue();
              
              if(!formQualified.equals("None"))
                  serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, 
  												"attributeFormDefault",convertString(formQualified));
          }
          
          if(schemaObj.elementFormDefault != null){
              String formQualified =  schemaObj.elementFormDefault.getValue();
              
              if(!formQualified.equals("None"))
                  serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, 
  												"elementFormDefault",convertString(formQualified));
          }
          
          
          if(schemaObj.annotation != null){
              Element annotation = serializeAnnotation(serializedSchemaDocs,
  													 schemaObj.annotation, schemaObj);
              serializedSchema.appendChild(annotation);
          }
          if(schemaObj.id != null){
              serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, "id", 
  											schemaObj.id);
          }
          if(schemaObj.blockDefault != null){
              String blockDefault = schemaObj.blockDefault.getValue();
              if(!blockDefault.equals("None")){
                  blockDefault = convertString(blockDefault);
                  serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, 
  												"blockDefault", blockDefault);
              }
          }
          if(schemaObj.finalDefault != null){
              String finalDefault = schemaObj.finalDefault.getValue();
              if(!finalDefault.equals("None")){
                  finalDefault = convertString(finalDefault);
                  serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, 
  												"finalDefault", finalDefault);
              }
          }
          
          if(schemaObj.version != null){
              serializedSchema.setAttributeNS(schemaObj.SCHEMA_NS, 
  											"version", schemaObj.version);
          }
          
          //after serialize the schema add into documentation 
          //and add to document collection array  which at the end 
          //returned
          serializeSchemaChild(items,serializedSchema, serializedSchemaDocs, 
  							 schemaObj, serializeIncluded);
      
          serializedSchemaDocs.appendChild(serializedSchema);
          docs.add(serializedSchemaDocs);
  
          
          Document[] serializedDocs = new Document[docs.size()];
          docs.toArray(serializedDocs);
          
          return serializedDocs;
      }
      
      private void serializeSchemaChild(XmlSchemaObjectCollection items,
  									  Element serializedSchema, Document serializedSchemaDocs, 
  									  XmlSchema schemaObj, boolean serializeIncluded) 
          throws XmlSchemaSerializerException{
              
          int itemsLength = items.getCount();
          /**
           * For each of the items that belong to this schema, 
           * serialize each member found.  
           * Permittable member is: element, simpleType, complexType,
           * group, attrributeGroup, Attribute, include, import and redefine.
           * if any of the member found then serialize the component.
           */
          for(int i=0;i < itemsLength ;i++){
              XmlSchemaObject obj = items.getItem(i);
              
              if(obj instanceof XmlSchemaElement){
                  Element e = serializeElement(serializedSchemaDocs, 
  											 (XmlSchemaElement)obj, schemaObj);
                  serializedSchema.appendChild(e);
                  
              }else if(obj instanceof XmlSchemaSimpleType){
                  Element e = serializeSimpleType(serializedSchemaDocs, 
  												(XmlSchemaSimpleType)obj, schemaObj);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaComplexType){
                  Element e = serializeComplexType(serializedSchemaDocs, 
  												 (XmlSchemaComplexType)obj, schemaObj);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaGroup){
                  Element e = serializeGroup(serializedSchemaDocs,
  										   (XmlSchemaGroup)obj, schemaObj);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaAttributeGroup){
                  Element e = serializeAttributeGroup(serializedSchemaDocs, 
  													(XmlSchemaAttributeGroup)obj, schemaObj);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaAttribute){
                  Element e = serializeAttribute(serializedSchemaDocs, 
  											   (XmlSchemaAttribute)obj, schemaObj);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaRedefine){
                  Element e = serializeRedefine(serializedSchemaDocs, 
  											  (XmlSchemaRedefine)obj, schemaObj);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaInclude ){
                  Element e = serializeInclude(serializedSchemaDocs, 
  											 (XmlSchemaInclude)obj, schemaObj, serializeIncluded);
                  serializedSchema.appendChild(e);
              }else if(obj instanceof XmlSchemaImport){
                  Element e = serializeImport(serializedSchemaDocs, 
  											(XmlSchemaImport)obj, schemaObj, serializeIncluded);
                  serializedSchema.appendChild(e);
              }
          }
      }
      
      /**
       * Set up <schema> namespaces appropriately and append that attr
       * into specified element
       */
      private Element setupNamespaces(Document schemaDocs, XmlSchema schemaObj){
          Enumeration prefixs = schemaObj.namespaces.keys();
          Enumeration values = schemaObj.namespaces.elements();
  
          /**
           * check all namespace added and register all namespace in 
           * hashtable.  When finish then set namespace to schema 
           * element appropriatelly.
           */
          for(;prefixs.hasMoreElements() && values.hasMoreElements();){
              String namespace = values.nextElement().toString();
              String prefix = prefixs.nextElement().toString();
              /*
               * if the prefix is there 
               * check whether it is an xsd schema namespace
               * set prefix and namespace to the default attribute
               * then register the prefix on hashtable
               */
              if(/*prefix.trim().length()<1 &&*/ namespace.equals(xsdNamespace)){
                  xsdPrefix = prefix;
                  schemaObj.schema_ns_prefix = xsdPrefix;
              }
  			
              schema_ns.put(namespace, prefix);
          }
  		//for schema that not set the xmlns attrib member
          if(schema_ns.get(xsdNamespace)== null){    
              schema_ns.put(xsdNamespace, xsdPrefix);
              schemaObj.schema_ns_prefix = xsdPrefix;
          }
  
          Element schemaEl = createNewElement(schemaDocs, "schema" , 
  											schemaObj.schema_ns_prefix ,schemaObj.SCHEMA_NS);
  
          Enumeration keys = schema_ns.keys();
  
          while(keys.hasMoreElements()){
              //let it crash for null pointer because then either the schema
              //is wrong(namespace not set properly or bug in setting ns)
              String key = keys.nextElement().toString();
              String value = schema_ns.get(key).toString();
              value = (value.length()>1)? "xmlns:"+value : "xmlns";
              schemaEl.setAttributeNS("http://www.w3.org/2000/xmlns/", 
  									value, key);
          }
          return schemaEl;
      }
  
      /************************************************************************
       * Element serializeInclude(Document doc, XmlSchemaInclude includeObj,
       *      XmlSchema schema)throws XmlSchemaSerializerException 
       *
       * set appropriate attribute as per this object attribute availability.
       * Call included schema to append to this schema document collection.
       * Then add the document created into document pool.
       *
       * Parameter:
       * doc          - Document the parent use.
       * includeObj   - XmlSchemaInclude that will be serialized.
       * schema       - Schema Document object of the parent.
       *
       * Return:
       * Element object representation of XmlSchemaInclude
       ************************************************************************/
      Element serializeInclude(Document doc, XmlSchemaInclude includeObj,
  							 XmlSchema schema, boolean serializeIncluded)
          throws XmlSchemaSerializerException {
          
          Element includeEl = createNewElement(doc, "include", 
  											 schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          if(includeObj.schemaLocation != null){
              includeEl.setAttributeNS(schema.SCHEMA_NS, "schemaLocation", 
  									 includeObj.schemaLocation);
          }
          
          if(includeObj.id != null)
              includeEl.setAttributeNS(schema.SCHEMA_NS, "id", includeObj.id);
          
          if(includeObj.annotation != null){
              Element annotation = serializeAnnotation(doc,
  													 includeObj.annotation, schema);
              includeEl.appendChild(annotation);
          }
  
          //Get the XmlSchema obj and append that to the content
          XmlSchema includedSchemaObj = includeObj.getSchema();
          if(includedSchemaObj != null && serializeIncluded){
              XmlSchemaSerializer includeSeri = new XmlSchemaSerializer();
              includeSeri.serializeSchemaElement(includedSchemaObj, true);
              XmlSchemaObjectCollection ii = includedSchemaObj.getItems();
              Document d = (Document)includeSeri.docs.get(0);
              docs.addAll(includeSeri.docs);
          }
          
          return includeEl;
      }
  
      /************************************************************************
       * Element serializeImport(Document doc, XmlSchemaImport importObj,
       *      XmlSchema schema)throws XmlSchemaSerializerException 
       *
       * Add each of the attribute of XmlSchemaImport obj into import Element 
       * Then serialize schema that is included by this import.  Include the 
       * serialized schema into document pool.
       *
       * Parameter:
       * doc          - Document the parent use.
       * includeObj   - XmlSchemaInclude that will be serialized.
       * schema       - Schema Document object of the parent.
       *
       * Return:
       * Element object representation of XmlSchemaImport
       ************************************************************************/
      Element serializeImport(Document doc, XmlSchemaImport importObj, 
  							XmlSchema schema, boolean serializeIncluded)
          throws XmlSchemaSerializerException {
          
          Element importEl = createNewElement(doc, "import", 
  											schema.schema_ns_prefix, schema.SCHEMA_NS);
  
          if(importObj.namespace != null)
              importEl.setAttributeNS(schema.SCHEMA_NS, "namespace", 
  									importObj.namespace);
          
          if(importObj.schemaLocation != null && !importObj.schemaLocation.trim().equals(""))
              importEl.setAttributeNS(schema.SCHEMA_NS, "schemaLocation", 
  									importObj.schemaLocation);
  
          if(importObj.id != null)
              importEl.setAttributeNS(schema.SCHEMA_NS, "id", importObj.id);
          
          if(importObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 importObj.annotation, schema);
              
              importEl.appendChild(annotation);
          }
  
          if(importObj.schema != null&& serializeIncluded ){
              
              
              XmlSchemaSerializer importSeri = new XmlSchemaSerializer();
              importSeri.serializeSchemaElement(importObj.schema,serializeIncluded);
              docs.addAll(importSeri.docs);
          }
          
          return importEl;
      }
      
      /************************************************************************
       * Element serializeRedefine(Document doc, XmlSchemaRedefine redefineObj, 
       *      XmlSchema schema)throws XmlSchemaSerializerException  
       *
       * Add each of the attribute of XmlSchemaImport obj into import Element 
       * Then serialize schema that is included by this import.  Include the 
       * serialized schema into document pool.
       *
       * Parameter:
       * doc           - Document the parent use.
       * redefineObj   - XmlSchemaInclude that will be serialized.
       * schema        - Schema Document object of the parent.
       *
       * Return:
       * Element object representation of XmlSchemaRedefine
       ************************************************************************/
      Element serializeRedefine(Document doc, XmlSchemaRedefine redefineObj, 
  							  XmlSchema schema)throws XmlSchemaSerializerException {
  
          Element redefine = createNewElement(doc, "redefine", 
  											schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          if(redefineObj.schemaLocation != null)
              redefine.setAttributeNS(schema.SCHEMA_NS, "schemaLocation", 
  									redefineObj.schemaLocation);
          else
              throw new XmlSchemaSerializerException("redefine must have "
  												   + "schemaLocation fields fill");
  
          if(redefineObj.id != null)
              redefine.setAttributeNS(schema.SCHEMA_NS, "id", redefineObj.id);
          
          if(redefineObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 redefineObj.annotation, schema);
              redefine.appendChild(annotation);
          }
          int itemsLength = redefineObj.items.getCount();
          for(int i=0;i<itemsLength;i++){
              XmlSchemaObject obj = redefineObj.items.getItem(i);
              if(obj instanceof XmlSchemaSimpleType){
                  Element simpleType = serializeSimpleType(doc, 
  														 (XmlSchemaSimpleType)obj, schema);
                  redefine.appendChild(simpleType);
              }else if(obj instanceof XmlSchemaComplexType){
                  Element complexType = serializeComplexType(doc, 
  														   (XmlSchemaComplexType)obj, schema);
                  redefine.appendChild(complexType);
              }else if(obj instanceof XmlSchemaGroupRef){
                  Element groupRef = serializeGroupRef(doc, 
  													 (XmlSchemaGroupRef)obj, schema);
                  redefine.appendChild(groupRef);
              }else if(obj instanceof XmlSchemaGroup){
                  Element group = serializeGroup(doc, 
  											   (XmlSchemaGroup)obj, schema);
                  redefine.appendChild(group);
              }else if(obj instanceof XmlSchemaAttributeGroup){
                  Element attributeGroup = serializeAttributeGroup(doc, 
  																 (XmlSchemaAttributeGroup)obj, schema);
                  redefine.appendChild(attributeGroup);
              }else if(obj instanceof XmlSchemaAttributeGroupRef){
                  Element attributeGroupRef = serializeAttributeGroupRef(doc, 
  																	   (XmlSchemaAttributeGroupRef)obj, schema);
                  redefine.appendChild(attributeGroupRef);
              }
          }
          return redefine;
      }
      
      /************************************************************************
  	 * Element serializeElement(Document doc, XmlSchemaElement elementObj, 
  	 *   XmlSchema schema) throws XmlSchemaSerializerException
  	 *
  	 * Each member of Element will be appended and pass the element
  	 * created.  Element processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc           - Document the parent use.
  	 * elementObj   - XmlSchemaInclude that will be serialized.
  	 * schema        - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element object of element.
  	 ************************************************************************/
      Element serializeElement(Document doc, XmlSchemaElement elementObj, 
  							 XmlSchema schema) throws XmlSchemaSerializerException{
          Element serializedEl = createNewElement(doc, "element" , 
  												schema.schema_ns_prefix ,schema.SCHEMA_NS);
  
          
          if(elementObj.refName != null){
              
              String resolvedName = resolveQualifiedName(
  													   elementObj.refName, schema);
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "ref", resolvedName);
          }
          
          else if(elementObj.name != null && elementObj.name.length() > 0){
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "name", 
  										elementObj.name);
          }
          
          if(elementObj.isAbstract)
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "abstract", "true");
  
          String block =elementObj.block.getValue(); 
          if(!block.equals("None")){
              block = convertString(block);
              serializedEl.setAttributeNS(schema.SCHEMA_NS,"block",block);
          }
          if(elementObj.defaultValue != null)
              serializedEl.setAttributeNS(schema.SCHEMA_NS,"default",
  										elementObj.defaultValue);
  
          String finalDerivation = elementObj.finalDerivation.getValue(); 
          if(!finalDerivation.equals("None")){
              finalDerivation = convertString(finalDerivation);
              serializedEl.setAttributeNS(schema.SCHEMA_NS,"final",
  										finalDerivation);
          }
          if(elementObj.fixedValue!=null)
              serializedEl.setAttributeNS(schema.SCHEMA_NS,"fixed",
  										elementObj.fixedValue);
  
          String formDef = elementObj.form.getValue();
          if(!formDef.equals("None")){
              formDef = convertString(formDef);
              serializedEl.setAttributeNS(schema.SCHEMA_NS,"form",formDef);
          }
          if(elementObj.id != null)
              serializedEl.setAttributeNS(schema.SCHEMA_NS,"id",elementObj.id);
  
          if(elementObj.maxOccurs < Long.MAX_VALUE && elementObj.maxOccurs > 1)
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  										elementObj.maxOccurs +"");
          else if(elementObj.maxOccurs == Long.MAX_VALUE)
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  										"unbounded");
          //else not serialized
          
          /*if(elementObj.minOccurs >1)
  		  serializedEl.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  		  elementObj.minOccurs + "");*/
          
          //Change - SK and Ragu cos it wasnt picking up
          // minOccurs = 0
          if(elementObj.minOccurs < Long.MAX_VALUE && elementObj.minOccurs != 1)
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  										elementObj.minOccurs +"");
          else if(elementObj.minOccurs == Long.MAX_VALUE)
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  										"unbounded");
              
          /*
  		  if(elementObj.maxOccursString != null)
  		  serializedEl.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  		  elementObj.maxOccursString);
  		  else if(elementObj.maxOccurs > 1)
  		  serializedEl.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  		  elementObj.maxOccurs + "");
  
  		  if(elementObj.minOccurs > 1)
  		  serializedEl.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  		  elementObj.minOccurs + "");
  		*/
          if(elementObj.substitutionGroup != null){
              String resolvedQName = resolveQualifiedName(
  														elementObj.substitutionGroup, schema);
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "substitutionGroup", 
  										resolvedQName);
          }
          if(elementObj.schemaTypeName  != null){
              String resolvedName = resolveQualifiedName(
  													   elementObj.schemaTypeName, schema);
              serializedEl.setAttributeNS(schema.SCHEMA_NS, "type", resolvedName);
          }
          if(elementObj.annotation != null){
              Element annotationEl = serializeAnnotation(doc, 
  													   elementObj.annotation, schema);
              serializedEl.appendChild(annotationEl);
          }
          if(elementObj.schemaType != null){
              if(elementObj.schemaType instanceof XmlSchemaComplexType){
                  Element complexType  = serializeComplexType(doc, 
  															(XmlSchemaComplexType)elementObj.schemaType, schema);
                  serializedEl.appendChild(complexType);
              }else if(elementObj.schemaType instanceof XmlSchemaSimpleType){
                  Element simpleType  = serializeSimpleType(doc, 
  														  (XmlSchemaSimpleType)elementObj.schemaType, schema);
                  serializedEl.appendChild(simpleType);
              }
          }
          if(elementObj.constraints.getCount() > 0){
              for(int i=0; i<elementObj.constraints.getCount();i++){
                  Element constraint = serializeIdentityConstraint(doc, 
  																 (XmlSchemaIdentityConstraint)elementObj.constraints.getItem(i), 
  																 schema);
                  serializedEl.appendChild(constraint);
              }
          }
  
          return serializedEl;
      }
      
      /************************************************************************
  	 * Element serializeSimpleType(Document doc, 
  	 *    XmlSchemaSimpleType simpleTypeObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *
  	 * Each member of simple type will be appended and pass the element
  	 * created.  Simple type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * simpleTypeObj     - XmlSchemaSimpleType that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element object of SimpleType
  	 ************************************************************************/
      Element serializeSimpleType(Document doc, XmlSchemaSimpleType simpleTypeObj, 
  								XmlSchema schema) throws XmlSchemaSerializerException{
          
  		Element serializedSimpleType = createNewElement(doc, "simpleType",
  														schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          
          String tmp;
          tmp = simpleTypeObj.finalDerivation.getValue();
          if(!tmp.equals("None")){
  
              tmp = convertString(tmp);
              serializedSimpleType.setAttributeNS(schema.SCHEMA_NS, "final", tmp);
          }
          if(simpleTypeObj.id != null)
              serializedSimpleType.setAttributeNS(schema.SCHEMA_NS, "id", 
  												simpleTypeObj.id);
          if((simpleTypeObj.name != null)&&(!simpleTypeObj.name.equals("")))
              serializedSimpleType.setAttributeNS(schema.SCHEMA_NS, "name", 
  												simpleTypeObj.name);
          if(simpleTypeObj.annotation != null){
              Element annotationEl = serializeAnnotation(doc, 
  													   simpleTypeObj.annotation, schema);
              serializedSimpleType.appendChild(annotationEl);
          }
          if(simpleTypeObj.content != null){
              if(simpleTypeObj.content instanceof XmlSchemaSimpleTypeRestriction){
                  Element restEl = serializeSimpleTypeRestriction(doc, 
  																(XmlSchemaSimpleTypeRestriction)simpleTypeObj.content, 
  																schema);
                  serializedSimpleType.appendChild(restEl);
              }else if(simpleTypeObj.content instanceof XmlSchemaSimpleTypeList){
                  Element listEl = serializeSimpleTypeList(doc, 
  														 (XmlSchemaSimpleTypeList)simpleTypeObj.content, schema);
                  serializedSimpleType.appendChild(listEl);
              }else if(simpleTypeObj.content instanceof XmlSchemaSimpleTypeUnion){
                  Element unionEl = serializeSimpleTypeUnion(doc, 
  														   (XmlSchemaSimpleTypeUnion)simpleTypeObj.content, schema);
                  serializedSimpleType.appendChild(unionEl);
              }/*else 
  			   throw new XmlSchemaSerializerException("Invalid type inserted "
  			   + "in simpleType content, the content is: " 
  			   + simpleTypeObj.content.getClass().getName()
  			   + " valid content should be XmlSchemaSimpleTypeunion, "
  			   + "XmlSchemaSimpleTyperestriction or list");*/
          }/*else
  		   throw new XmlSchemaSerializerException("simple type must be set "
  		   + "with content, either union, restriction or list");*/
          
          return serializedSimpleType;
      }
      
      /************************************************************************
  	 * Element serializeSimpleTypeRestriction(Document doc, 
  	 *    XmlSchemaSimpleTypeRestriction restrictionObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *
  	 * Each member of simple type will be appended and pass the element
  	 * created.  Simple type's <restriction> processed according to w3c 
  	 * Recommendation May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * restrictionObj    - XmlSchemaRestriction that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of simple type restriction and its child.
  	 ************************************************************************/
      Element serializeSimpleTypeRestriction(Document doc, 
  										   XmlSchemaSimpleTypeRestriction restrictionObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          //todo: need to implement any attribute that related to non schema namespace
          Element serializedRestriction = createNewElement(doc, "restriction" , 
  														 schema.schema_ns_prefix ,schema.SCHEMA_NS);
  
          if(schema.schema_ns_prefix.length()>0)
              serializedRestriction.setPrefix(schema.schema_ns_prefix);
          if(restrictionObj.baseTypeName != null){
              String baseType = resolveQualifiedName(restrictionObj.baseTypeName, schema);
              serializedRestriction.setAttributeNS(schema.SCHEMA_NS, "base",baseType);
          }else if(restrictionObj.baseType != null && restrictionObj.baseType
  				 instanceof XmlSchemaSimpleType){
              Element inlineSimpleType = serializeSimpleType(doc, 
  														   (XmlSchemaSimpleType)restrictionObj.baseType, schema);
              serializedRestriction.appendChild(inlineSimpleType);
          }else 
              throw new XmlSchemaSerializerException("restriction must be define "
  												   + "with specifying base or inline simpleType");
              
          if(restrictionObj.id != null)
              serializedRestriction.setAttributeNS(schema.SCHEMA_NS, "id", 
  												 restrictionObj.id);
         
          if(restrictionObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 restrictionObj.annotation, schema);
              serializedRestriction.appendChild(annotation);
          }
          if(restrictionObj.facets.getCount() >0){
              int facetsNum =restrictionObj.facets.getCount(); 
              for(int i=0;i<facetsNum;i++){
                  Element facetEl = serializeFacet(doc, 
  												 (XmlSchemaFacet)restrictionObj.facets.getItem(i), schema);
                  serializedRestriction.appendChild(facetEl);
              }
          }
          return serializedRestriction;
      }    
      /************************************************************************
  	 * Element serializeFacet(Document doc, XmlSchemaFacet facetObj, 
  	 *   XmlSchema schema) throws XmlSchemaSerializerException{
  	 *
  	 * detect what type of facet and cass appropriatelly, 
  	 * construct the element and pass it.
  	 *
  	 * Parameter:
  	 * doc       - Document the parent use.
  	 * facetObj  - XmlSchemaFacet that will be serialized.
  	 * schema    - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of simple type with facet.
  	 ************************************************************************/
      Element serializeFacet(Document doc, XmlSchemaFacet facetObj, 
  						   XmlSchema schema) throws XmlSchemaSerializerException{
          
          Element serializedFacet;
          String facetName = facetObj.getClass().getName();
          
          if(facetObj instanceof XmlSchemaMinExclusiveFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "minExclusive");
          else if(facetObj instanceof  XmlSchemaMinInclusiveFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "minInclusive");
          else if(facetObj instanceof XmlSchemaMaxExclusiveFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "maxExclusive");
          else if(facetObj instanceof XmlSchemaMaxInclusiveFacet)   
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "maxInclusive");
          else if(facetObj instanceof XmlSchemaTotalDigitsFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "totalDigits");
          else if(facetObj instanceof XmlSchemaFractionDigitsFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "fractionDigits");
          else if(facetObj instanceof XmlSchemaLengthFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "length");
          else if(facetObj instanceof XmlSchemaMinLengthFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "minLength");
          else if(facetObj instanceof XmlSchemaMaxLengthFacet)
              serializedFacet = constructFacet(facetObj, doc,schema,
  											 "maxLength");
          else if(facetObj instanceof XmlSchemaEnumerationFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "enumeration");
          else if(facetObj instanceof  XmlSchemaWhiteSpaceFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "whiteSpace");
          else if(facetObj instanceof XmlSchemaPatternFacet)
              serializedFacet = constructFacet(facetObj, doc,schema, 
  											 "pattern");
          else
              throw new XmlSchemaSerializerException("facet not exist " 
  												   + facetObj.getClass().getName() );
      
          if(facetObj.id != null)
              serializedFacet.setAttributeNS(schema.SCHEMA_NS, "id", facetObj.id);
          if(facetObj.annotation != null){
              Element annotation = serializeAnnotation(doc, facetObj.annotation, 
  													 schema);
              serializedFacet.appendChild(annotation);
          }
               
          return serializedFacet;
      }
      
      private Element constructFacet(XmlSchemaFacet facetObj, Document doc, 
  								   XmlSchema schema, String tagName){
              
          Element facetEl = createNewElement(doc, tagName , 
  										   schema.schema_ns_prefix ,schema.SCHEMA_NS);
  
          facetEl.setAttributeNS(schema.SCHEMA_NS, "value", 
  							   facetObj.value.toString());
          if(facetObj.fixed)
              facetEl.setAttributeNS(schema.SCHEMA_NS, "fixed", "true");
          
          if(facetObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 facetObj.annotation,  schema);
              facetEl.appendChild(annotation);
          }
          return facetEl;
      }
      
      /************************************************************************
  	 * Element serializeComplexType(Document doc, 
  	 *    XmlSchemaComplexType complexTypeObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc             - Document the parent use.
  	 * complexTypeObj  - XmlSchemaFacet that will be serialized.
  	 * schema          - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of complexType.
  	 ************************************************************************/
      Element serializeComplexType(Document doc, 
  								 XmlSchemaComplexType complexTypeObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          //todo: need to implement abstract, id, mixed
          Element serializedComplexType = createNewElement(doc , 
  														 "complexType", schema.schema_ns_prefix, schema.SCHEMA_NS  );
          
          if ((complexTypeObj.name != null)&&(!complexTypeObj.name.equals("")))
              serializedComplexType.setAttributeNS(schema.SCHEMA_NS, "name", 
  												 complexTypeObj.name);
          /*if(complexTypeObj.annotation != null){
  		  Element annotationEl = serializeAnnotation(doc, 
  		  complexTypeObj.annotation, schema);
  		  serializedComplexType.appendChild(annotationEl);
  		  }*/
          
          if(complexTypeObj.isMixed)
              serializedComplexType.setAttributeNS(schema.SCHEMA_NS, 
  												 "mixed", "true");
          if(complexTypeObj.isAbstract)
              serializedComplexType.setAttributeNS(schema.SCHEMA_NS, 
  												 "abstract", "true");
          if(complexTypeObj.id != null)
              serializedComplexType.setAttributeNS(schema.SCHEMA_NS, "id", 
  												 complexTypeObj.id);      
              
          if(complexTypeObj.contentModel instanceof XmlSchemaSimpleContent){
              Element simpleContent = serializeSimpleContent(doc, 
  														   (XmlSchemaSimpleContent)complexTypeObj.contentModel, schema);
              serializedComplexType.appendChild(simpleContent);
          }else if(complexTypeObj.contentModel instanceof 
  				 XmlSchemaComplexContent){
              
              Element complexContent = serializeComplexContent(doc, 
  															 (XmlSchemaComplexContent)complexTypeObj.contentModel, schema);
              serializedComplexType.appendChild(complexContent);
          }
  
          if(complexTypeObj.particle instanceof XmlSchemaSequence){
              Element sequence = serializeSequence(doc, 
  												 (XmlSchemaSequence)complexTypeObj.particle, schema);
              serializedComplexType.appendChild(sequence);
          }else if(complexTypeObj.particle instanceof XmlSchemaChoice){
              Element choice = serializeChoice(doc, 
  											 (XmlSchemaChoice)complexTypeObj.particle, schema);
              serializedComplexType.appendChild(choice);
          }else if(complexTypeObj.particle instanceof XmlSchemaAll){
              Element all = serializeAll(doc, 
  									   (XmlSchemaAll)complexTypeObj.particle, schema);
              serializedComplexType.appendChild(all);
          }else if(complexTypeObj.particle instanceof XmlSchemaGroupRef){
              Element group = serializeGroupRef(doc, 
  											  (XmlSchemaGroupRef)complexTypeObj.particle, schema);
              serializedComplexType.appendChild(group);
          }
          
          String block = complexTypeObj.block.getValue();
          if(!block.equals("None")){
              block = convertString(block);
              serializedComplexType.setAttributeNS(schema.SCHEMA_NS, 
  												 "block", block);
          }
          String finalDerivation = complexTypeObj.finalDerivation.getValue();
          if(!finalDerivation.equals("None")){
              finalDerivation = convertString(finalDerivation);
              serializedComplexType.setAttributeNS(schema.SCHEMA_NS, "final", 
  												 finalDerivation);
          }
          
          XmlSchemaObjectCollection attrColl = complexTypeObj.attributes;
          if(attrColl.getCount() > 0)
              setupAttr(doc, attrColl, schema,serializedComplexType);
          
          return serializedComplexType;
      } 
      
      /************************************************************************
  	 * Element serializeSequence(Document doc, XmlSchemaSequence sequenceObj, 
  	 *    XmlSchema schema)throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  `Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc             - Document the parent use.
  	 * sequenceObj  - XmlSchemaFacet that will be serialized.
  	 * schema          - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of sequence particle.
  	 ************************************************************************/
      Element serializeSequence(Document doc, XmlSchemaSequence sequenceObj, 
  							  XmlSchema schema)throws XmlSchemaSerializerException{
          
          Element sequence = createNewElement(doc, "sequence", 
  											schema.schema_ns_prefix, schema.SCHEMA_NS);
         
          
          if(sequenceObj.id != null)
              sequence.setAttributeNS(schema.SCHEMA_NS, "id", sequenceObj.id);
  
          
          if(sequenceObj.maxOccurs < Long.MAX_VALUE && sequenceObj.maxOccurs > 1)
              sequence.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  									sequenceObj.maxOccurs +"");
          else if(sequenceObj.maxOccurs == Long.MAX_VALUE)
              sequence.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  									"unbounded");
          //else not serialized
          
              
          if(sequenceObj.minOccurs > 1)
              sequence.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  									sequenceObj.minOccurs + "");
          
          XmlSchemaObjectCollection seqColl = sequenceObj.items;
          int containLength = seqColl.getCount();
          for(int i=0; i<containLength;i++){
              XmlSchemaObject obj = seqColl.getItem(i);
              if(obj instanceof XmlSchemaElement){
                  Element el = serializeElement(doc, 
  											  (XmlSchemaElement)obj, schema);
                  sequence.appendChild(el);
              }else if(obj instanceof XmlSchemaGroupRef){
                  Element group = serializeGroupRef(doc, 
  												  (XmlSchemaGroupRef)obj, schema);
                  sequence.appendChild(group);
              }else if(obj instanceof XmlSchemaChoice){
                  Element choice = serializeChoice(doc, 
  												 (XmlSchemaChoice)obj, schema);
                  sequence.appendChild(choice);
              }else if(obj instanceof XmlSchemaSequence){
                  Element sequenceChild = serializeSequence(doc, 
  														  (XmlSchemaSequence)obj, schema);
                  sequence.appendChild(sequenceChild);
              }else if(obj instanceof XmlSchemaAny){
                  Element any = serializeAny(doc,(XmlSchemaAny)obj, schema);
                  sequence.appendChild(any);
              }
          }
          return sequence;
      }
      /************************************************************************
  	 * Element serializeAttribute(Document doc, XmlSchemaAttribute attributeObj, 
  	 *    XmlSchema schema) throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  `Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc             - Document the parent use.
  	 * attributeObj    - XmlSchemaAttribute that will be serialized.
  	 * schema          - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of attribute.
  	 ************************************************************************/
      Element serializeAttribute(Document doc, XmlSchemaAttribute attributeObj, 
  							   XmlSchema schema) throws XmlSchemaSerializerException{
          
  		Element attribute = createNewElement(doc, "attribute", 
  											 schema.schema_ns_prefix, schema.SCHEMA_NS);
  		if(attributeObj.refName != null){
              String refName =  
                  resolveQualifiedName(attributeObj.refName, schema);
              attribute.setAttributeNS(schema.SCHEMA_NS, "ref", refName);
          }
          else if(attributeObj.name != null)
              attribute.setAttributeNS(schema.SCHEMA_NS, "name", 
  									 attributeObj.name);
              
          if(attributeObj.schemaTypeName != null){
              String typeName =  
                  resolveQualifiedName(attributeObj.schemaTypeName, schema);
              attribute.setAttributeNS(schema.SCHEMA_NS, "type", typeName);
          }
          
          if(attributeObj.defaultValue != null)
              attribute.setAttributeNS(schema.SCHEMA_NS, "default",
  									 attributeObj.defaultValue);
          if(attributeObj.fixedValue != null)
              attribute.setAttributeNS(schema.SCHEMA_NS, "fixed", 
  									 attributeObj.fixedValue);
          
          String formType = attributeObj.form.getValue(); 
          if(!formType.equals("None")){
              formType = convertString(formType);
              attribute.setAttributeNS(schema.SCHEMA_NS, "form", formType);
          }
          if(attributeObj.id != null)
              attribute.setAttributeNS(schema.SCHEMA_NS, "id", attributeObj.id);
         
          String useType =attributeObj.use.getValue(); 
          if(!useType.equals("None")){
              useType = convertString(useType);
              attribute.setAttributeNS(schema.SCHEMA_NS, "use", useType);
          }
          if(attributeObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 attributeObj.annotation, schema);
              attribute.appendChild(annotation);
          }
          
          
          if(attributeObj.schemaType != null){
              try{
                  XmlSchemaSimpleType simpleType = 
                      (XmlSchemaSimpleType)attributeObj.schemaType;
                  Element simpleTypeEl = serializeSimpleType(doc, 
  														   simpleType, schema);
                  attribute.appendChild(simpleTypeEl);
              }catch(ClassCastException e){
                  throw new XmlSchemaSerializerException(
  													   "only inline simple type allow as attribute's inline type");
              }
          }
  		
  		Attr[] unhandled = attributeObj.getUnhandledAttributes();
  
  		Hashtable namespaces = new Hashtable();
  		
  		if (unhandled != null){
  			
  			// this is to make the wsdl:arrayType work 
  			// since unhandles attributes are not handled this is a special case
  			// but the basic idea is to see if there is any attibute whose value has ":"
  			// if it is present then it is likely that it is a namespace prefix
  			// do what is neccesary to get the real namespace for it and make 
  			// required changes to the prefix 
  			
  			for (int i=0;i<unhandled.length;i++){ 
  				String name = unhandled[i].getNodeName();
  				String value = unhandled[i].getNodeValue();
  				if(  name.equals( "xmlns") ) {
  					namespaces.put( "", value);
  				}else if( name.startsWith( "xmlns" )){
  					namespaces.put( name.substring(name.indexOf(":") + 1) , value);
  				}
  			}
  			
  			for (int i=0;i<unhandled.length;i++){
  				String value = unhandled[i].getNodeValue();
  				String nodeName = unhandled[i].getNodeName();
  				if( value.indexOf( ":") > -1 && ! nodeName.startsWith( "xmlns") ) {
  					String prefix = value.substring( 0, value.indexOf( ":" ));
  					String oldNamespace = null;
  					if(( oldNamespace =  ( String) namespaces.get( prefix )) != null) {
  						value = value.substring( value.indexOf(":") + 1 );
  						Hashtable realNamespaces = schema.getPrefixToNamespaceMap();
  						java.util.Iterator iter = realNamespaces.keySet().iterator();
  						while( iter.hasNext()){
  							prefix = ( String) iter.next();
  							String namespace = ( String ) realNamespaces.get( prefix );
  							if( namespace.equals( oldNamespace)) 
  								value = prefix + ":" + value;
  						}
  					}
  					
  				}
  				if (unhandled[i].getNamespaceURI()!= null)
  					attribute.setAttributeNS(unhandled[i].getNamespaceURI(),nodeName,value);
  			    else
  					attribute.setAttribute(nodeName,value);
  			}
  		}
          return attribute;
      }
      /************************************************************************
  	 * Element serializeChoice(Document doc, XmlSchemaChoice choiceObj, 
  	 *   XmlSchema schema) throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc             - Document the parent use.
  	 * choiceObj       - XmlSchemaChoice that will be serialized.
  	 * schema          - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of choice schema object.
  	 ************************************************************************/
      Element serializeChoice(Document doc, XmlSchemaChoice choiceObj, 
  							XmlSchema schema) throws XmlSchemaSerializerException{
          //todo: handle any non schema attri ?
          
          Element choice = createNewElement(doc, "choice", 
  										  schema.schema_ns_prefix,  schema.SCHEMA_NS);
          if(choiceObj.id!= null)
              if(choiceObj.id.length()>0)
                  choice.setAttributeNS(schema.SCHEMA_NS, "id", choiceObj.id);
          
           
          if(choiceObj.maxOccurs < Long.MAX_VALUE && choiceObj.maxOccurs > 1)
              choice.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  								  choiceObj.maxOccurs +"");
          else if(choiceObj.maxOccurs == Long.MAX_VALUE)
              choice.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  								  "unbounded");
          //else not serialized
          
          if(choiceObj.minOccurs >1)
              choice.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  								  choiceObj.minOccurs + "");
                 
  
          /*
  		  if(choiceObj.maxOccursString != null)
  		  choice.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  		  choiceObj.maxOccursString);
  		  else if(choiceObj.maxOccurs > 1)
  		  choice.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  		  choiceObj.maxOccurs +"");
  		*/  
              
          
          if(choiceObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 choiceObj.annotation, schema);
              choice.appendChild(annotation);
          }
              
          
          XmlSchemaObjectCollection itemColl = choiceObj.items;
  
          if(itemColl != null){
              int itemLength = itemColl.getCount();
  
              for(int i=0;i<itemLength;i++){
                  XmlSchemaObject obj = itemColl.getItem(i);
  
                  if(obj instanceof  XmlSchemaElement){
                      Element el = serializeElement(doc, 
  												  (XmlSchemaElement)obj, schema);
                      choice.appendChild(el);
                  }else if(obj instanceof XmlSchemaGroupRef){
                      Element group = serializeGroupRef(doc, 
  													  (XmlSchemaGroupRef)obj, schema);
                      choice.appendChild(group);
                  }else if(obj instanceof XmlSchemaChoice){
                      Element inlineChoice = serializeChoice(doc,
  														   (XmlSchemaChoice)obj, schema);
                      choice.appendChild(inlineChoice);
                  }else if(obj instanceof XmlSchemaSequence){
                      Element inlineSequence = serializeSequence(doc, 
  															   (XmlSchemaSequence)obj, schema);
                      choice.appendChild(inlineSequence);
                  }else if(obj instanceof XmlSchemaAny){
                      Element any = serializeAny(doc, (XmlSchemaAny)obj, schema);
                      choice.appendChild(any);
                  }
              }
          }
          return choice;
      }
      /************************************************************************
  	 * Element serializeAll(Document doc, XmlSchemaAll allObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc             - Document the parent use.
  	 * allObj          - XmlSchemaAll that will be serialized.
  	 * schema          - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of particle all.
  	 ************************************************************************/
      Element serializeAll(Document doc, XmlSchemaAll allObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          Element allEl = createNewElement(doc, "all", schema.schema_ns_prefix, 
  										 schema.SCHEMA_NS);
          
  		if(allObj.minOccurs == 0)
              allEl.setAttributeNS(schema.SCHEMA_NS, "minOccurs", "0");
  
          
          if(allObj.annotation != null){
              Element annotation = serializeAnnotation(doc, allObj.annotation,
  													 schema);
              allEl.appendChild(annotation);
          }
  
          XmlSchemaObjectCollection itemColl = allObj.items;
          
          if(itemColl != null){
              int itemLength = itemColl.getCount();
  
              for(int i=0;i<itemLength;i++){
                  XmlSchemaObject obj = itemColl.getItem(i);
                  if(obj instanceof XmlSchemaElement){
                      Element el = serializeElement(doc, (XmlSchemaElement)obj, 
  												  schema);
                      allEl.appendChild(el);
                  }else
                      throw new XmlSchemaSerializerException("Only element "
  														   + "allowed as child of all model type");
              }
          }
          
          return allEl;
      }
  
      /************************************************************************
  	 * Element serializeSimpleTypeList(Document doc, 
  	 *    XmlSchemaSimpleTypeList listObj, XmlSchema schema)
  	 *        throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc             - Document the parent use.
  	 * listObj         - XmlSchemaSimpleTypeList that will be serialized.
  	 * schema          - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of simple type with list method.
  	 ************************************************************************/
      Element serializeSimpleTypeList(Document doc, 
  									XmlSchemaSimpleTypeList listObj, XmlSchema schema)
  		throws XmlSchemaSerializerException{
  
          Element list = createNewElement(doc, "list" , 
  										schema.schema_ns_prefix ,schema.SCHEMA_NS);
  
          if(listObj.itemTypeName != null){
              String listItemType = resolveQualifiedName(listObj.itemTypeName,
  													   schema);
              list.setAttributeNS(schema.SCHEMA_NS, "itemType", listItemType);
          }
          if(listObj.id != null)
              list.setAttributeNS(schema.SCHEMA_NS, "id", listObj.id);
          
          else if(listObj.itemType != null){
              Element inlineSimpleEl = serializeSimpleType(doc, listObj.itemType, 
  														 schema);
              list.appendChild(inlineSimpleEl);
          }
          if(listObj.annotation != null){
              Element annotation = serializeAnnotation(doc, listObj.annotation, schema);
              list.appendChild(annotation);
          }
          return list;
      }
      
      /************************************************************************
  	 * Element serializeSimpleTypeUnion(Document doc, 
  	 *    XmlSchemaSimpleTypeUnion unionObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc              - Document the parent use.
  	 * unionObj         - XmlSchemaSimpleTypeUnion that will be serialized.
  	 * schema           - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of simple type with union method.
  	 ************************************************************************/
      Element serializeSimpleTypeUnion(Document doc, 
  									 XmlSchemaSimpleTypeUnion unionObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          
          Element union = createNewElement(doc, "union", 
  										 schema.schema_ns_prefix, schema.SCHEMA_NS);
          if(unionObj.id != null)
              union.setAttributeNS(schema.SCHEMA_NS, "id", unionObj.id);
          
          if(unionObj.memberTypesSource != null)
              union.setAttributeNS(schema.SCHEMA_NS, "memberTypes", 
  								 unionObj.memberTypesSource);
          else if(unionObj.baseTypes.getCount() > 0){
              int baseTypesLength = unionObj.baseTypes.getCount();
              Element baseType;
              for(int i=0; i<baseTypesLength; i++){
                  try{
                      baseType = serializeSimpleType(doc, 
  												   (XmlSchemaSimpleType)unionObj.baseTypes.getItem(i), 
  												   schema);
                      union.appendChild(baseType);
                  }catch(ClassCastException e){
                      throw new XmlSchemaSerializerException(
  														   "only inline simple type allow as attribute's "
  														   + "inline type");
                  }
              }
          }
          if(unionObj.annotation != null){
              Element annotation = serializeAnnotation(doc, unionObj.annotation, 
  													 schema);
              union.appendChild(annotation);
          }
          return union;
      }    
  
      /************************************************************************
  	 * Element serializeAny(Document doc, XmlSchemaAny anyObj, XmlSchema schema)
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc              - Document the parent use.
  	 * anyObj           - XmlSchemaAny that will be serialized.
  	 * schema           - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of any that is part of its parent.
  	 ************************************************************************/
      Element serializeAny(Document doc, XmlSchemaAny anyObj, XmlSchema schema){
          Element anyEl = createNewElement(doc, "any", schema.schema_ns_prefix , 
  										 schema.SCHEMA_NS);
          if(anyObj.id != null)
              if(anyObj.id.length()>0)
                  anyEl.setAttributeNS(schema.SCHEMA_NS, "id", anyObj.id);
   
          
  		if(anyObj.maxOccurs < Long.MAX_VALUE && anyObj.maxOccurs > 1)
              anyEl.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  								 anyObj.maxOccurs +"");
          else if(anyObj.maxOccurs == Long.MAX_VALUE)
              anyEl.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  								 "unbounded");
          //else not serialized
          
          if(anyObj.minOccurs >1)
              anyEl.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  								 anyObj.minOccurs + "");
   
          if(anyObj.namespace != null)
              anyEl.setAttributeNS(schema.SCHEMA_NS, "namespace", 
  								 anyObj.namespace);
          
          if(anyObj.processContent != null){
              String value = anyObj.processContent.getValue();
              if(!value.equals("None")){
                  String processContent = convertString(value);
                  anyEl.setAttributeNS(schema.SCHEMA_NS, "processContents", 
  									 processContent);
              }
          }
          if(anyObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 anyObj.annotation, schema);
              anyEl.appendChild(annotation);
          }
          
          return anyEl;
      }
      
      /************************************************************************
  	 * Element serializeGroup(Document doc, XmlSchemaGroup groupObj, 
  	 *    XmlSchema schema) throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                - Document the parent use.
  	 * groupObj           - XmlSchemaGroup that will be serialized.
  	 * schema             - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of group elements.
  	 ************************************************************************/
      Element serializeGroup(Document doc, XmlSchemaGroup groupObj, 
  						   XmlSchema schema) throws XmlSchemaSerializerException{
              
          Element group = createNewElement(doc, "group", 
  										 schema.schema_ns_prefix,schema.SCHEMA_NS);
          
          if(groupObj.name != null){
              if(groupObj.name.length() > 0){
                  group.setAttributeNS(schema.SCHEMA_NS, "name", groupObj.name);
              }
          }else
              throw new XmlSchemaSerializerException("Group must have " + 
  												   "name or ref");
                  
          
          if(groupObj.particle instanceof XmlSchemaSequence){
              Element sequence = serializeSequence(doc, 
  												 (XmlSchemaSequence)groupObj.particle, schema);
              group.appendChild(sequence);
          }else if(groupObj.particle instanceof XmlSchemaChoice){
              Element choice = serializeChoice(doc, 
  											 (XmlSchemaChoice)groupObj.particle, schema);
              group.appendChild(choice);
          }else if(groupObj.particle instanceof XmlSchemaAll){
              Element all = serializeAll(doc, 
  									   (XmlSchemaAll)groupObj.particle, schema);
              group.appendChild(all);
          }
          if(groupObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 groupObj.annotation, schema);
              group.appendChild(annotation);
          }
          return group;
      }
      
      /************************************************************************
  	 * Element serializeGroupRef(Document doc, XmlSchemaGroupRef groupRefObj, 
  	 *    XmlSchema schema) throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                   - Document the parent use.
  	 * groupRefObj           - XmlSchemaGroupRef that will be serialized.
  	 * schema                - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of group elements ref inside its parent.
  	 ************************************************************************/
      Element serializeGroupRef(Document doc, XmlSchemaGroupRef groupRefObj, 
  							  XmlSchema schema) throws XmlSchemaSerializerException{
          
          Element groupRef = createNewElement(doc, "group", 
  											schema.schema_ns_prefix,schema.SCHEMA_NS);
          
          if(groupRefObj.refName != null){
              String groupRefName = resolveQualifiedName(groupRefObj.refName, 
  													   schema);
              groupRef.setAttributeNS(schema.SCHEMA_NS, "ref", groupRefName);
          }else 
              throw new XmlSchemaSerializerException("Group must have name or ref");
          
          if(groupRefObj.maxOccurs < Long.MAX_VALUE && groupRefObj.maxOccurs > 1)
              groupRef.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  									groupRefObj.maxOccurs +"");
          else if(groupRefObj.maxOccurs == Long.MAX_VALUE)
              groupRef.setAttributeNS(schema.SCHEMA_NS, "maxOccurs", 
  									"unbounded");
          //else not serialized
          
          if(groupRefObj.minOccurs >1)
              groupRef.setAttributeNS(schema.SCHEMA_NS, "minOccurs", 
  									groupRefObj.minOccurs + "");
  
          
          /*
  		  if(groupRefObj.maxOccursString != null)
  		  groupRef.setAttributeNS(schema.SCHEMA_NS, 
  		  "maxOccurs", groupRefObj.maxOccursString);
  		  else if(groupRefObj.maxOccurs > 1)
  		  groupRef.setAttributeNS(schema.SCHEMA_NS, 
  		  "maxOccurs", groupRefObj.maxOccurs + "");
  		*/
          
          if(groupRefObj.particle != null){
              Element particleEl;
              if(groupRefObj.particle instanceof XmlSchemaChoice)
                  particleEl = serializeChoice(doc,
  											 (XmlSchemaChoice)groupRefObj.particle, schema);
              else if(groupRefObj.particle instanceof XmlSchemaSequence)
                  particleEl = serializeSequence(doc, 
  											   (XmlSchemaSequence)groupRefObj.particle, schema);
              else if(groupRefObj.particle instanceof XmlSchemaAll)
                  particleEl = serializeAll(doc, 
  										  (XmlSchemaAll)groupRefObj.particle, schema);
              else
                  throw new XmlSchemaSerializerException("The content of group "
  													   + "ref particle should be"
  													   + " sequence, choice or all reference:  " 
  													   + "www.w3.org/TR/xmlschema-1#element-group-3.7.2");
          }
          if(groupRefObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 groupRefObj.annotation, schema);
              groupRef.appendChild(annotation);
          }
          
          return groupRef;
      }
      
      /************************************************************************
  	 * Element serializeSimpleContent(Document doc, 
  	 *    XmlSchemaSimpleContent simpleContentObj, XmlSchema schema) 
  	 *        throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * simpleContentObj  - XmlSchemaSimpleContent that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of complex type simple content.
  	 ************************************************************************/
      Element serializeSimpleContent(Document doc, 
  								   XmlSchemaSimpleContent simpleContentObj, XmlSchema schema) 
  		throws XmlSchemaSerializerException{
          Element simpleContent = createNewElement(doc, "simpleContent", 
  												 schema.schema_ns_prefix, schema.SCHEMA_NS);
         
          Element content;
          if(simpleContentObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 simpleContentObj.annotation, schema);
              simpleContent.appendChild(annotation);
          }
          if(simpleContentObj.content instanceof 
  		   XmlSchemaSimpleContentRestriction)
              content = serializeSimpleContentRestriction(doc, 
  														(XmlSchemaSimpleContentRestriction)simpleContentObj.content, 
  														schema);
          else if(simpleContentObj.content instanceof 
  				XmlSchemaSimpleContentExtension)
              content = serializeSimpleContentExtension(doc, 
  													  (XmlSchemaSimpleContentExtension)simpleContentObj.content, 
  													  schema);
          else 
              throw new XmlSchemaSerializerException("content of simple content "
  												   +"must be restriction or extension");
           
          simpleContent.appendChild(content);
          return simpleContent;
      }
      
      /************************************************************************
  	 * Element serializeComplexContent(Document doc, 
  	 *    XmlSchemaComplexContent complexContentObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                - Document the parent use.
  	 * complexContentObj  - XmlSchemaComplexContent that will be serialized.
  	 * schema             - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of complex type complex content.
  	 ************************************************************************/
      Element serializeComplexContent(Document doc, 
  									XmlSchemaComplexContent complexContentObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          Element complexContent = createNewElement(doc, "complexContent", 
  												  schema.schema_ns_prefix, schema.SCHEMA_NS);
  
  
          if(complexContentObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 complexContentObj.annotation, schema);
              complexContent.appendChild(annotation);
          }
  
          if(complexContentObj.mixed)
              complexContent.setAttributeNS(schema.SCHEMA_NS, "mixed", "true");
          if(complexContentObj.id != null)
              complexContent.setAttributeNS(schema.SCHEMA_NS, "id", 
  										  complexContentObj.id);
          
          Element content;
          if(complexContentObj.content instanceof 
  		   XmlSchemaComplexContentRestriction)
              
              content = serializeComplexContentRestriction(doc, 
  														 (XmlSchemaComplexContentRestriction)complexContentObj.content, 
  														 schema);
          else if(complexContentObj.content instanceof
  				XmlSchemaComplexContentExtension)
              content = serializeComplexContentExtension(doc, 
  													   (XmlSchemaComplexContentExtension)complexContentObj.content, 
  													   schema);
          else 
              throw new XmlSchemaSerializerException("content of complexContent "
  												   +"must be restriction or extension");
           
          complexContent.appendChild(content);
           
          return complexContent;
      }
      
      /************************************************************************
  	 * Element serializeIdentityConstraint(Document doc, 
  	 *    XmlSchemaIdentityConstraint constraintObj, XmlSchema schema) 
  	 *        throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * constraintObj     - XmlSchemaIdentityConstraint that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of key, keyref or unique that part of its parent.
  	 ************************************************************************/
      Element serializeIdentityConstraint(Document doc, 
  										XmlSchemaIdentityConstraint constraintObj, XmlSchema schema) 
  		throws XmlSchemaSerializerException{
  
          Element constraint;
          
          if(constraintObj instanceof XmlSchemaUnique)
              constraint = createNewElement(doc, "unique", 
  										  schema.schema_ns_prefix, schema.SCHEMA_NS);
          else if(constraintObj instanceof XmlSchemaKey)
              constraint = createNewElement(doc, "key", 
  										  schema.schema_ns_prefix, schema.SCHEMA_NS);
          else if(constraintObj instanceof XmlSchemaKeyref){
              constraint = createNewElement(doc, "keyref", 
  										  schema.schema_ns_prefix, schema.SCHEMA_NS);
              XmlSchemaKeyref keyref = (XmlSchemaKeyref)constraintObj;
              if(keyref.refer != null){
                  String keyrefStr = resolveQualifiedName(keyref.refer, schema);
                  constraint.setAttributeNS(schema.SCHEMA_NS, 
  										  "refer", keyrefStr);
              }
          }else
              throw new XmlSchemaSerializerException("not valid identity "
  												   + "constraint");
          
          if(constraintObj.name != null)
              constraint.setAttributeNS(schema.SCHEMA_NS, "name", 
  									  constraintObj.name);
          if(constraintObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 constraintObj.annotation, schema);
              constraint.appendChild(annotation);
          }
          
          if(constraintObj.selector != null){
              Element selector = serializeSelector(doc, 
  												 constraintObj.selector, schema);
              constraint.appendChild(selector);
          }
          XmlSchemaObjectCollection fieldColl = constraintObj.fields;
          if(fieldColl != null){
              int fieldLength = fieldColl.getCount();
              for(int i=0; i<fieldLength;i++){
                  Element field = serializeField(doc, 
  											   (XmlSchemaXPath)fieldColl.getItem(i), schema);
                  constraint.appendChild(field);
              }
          }       
          return constraint;
      }    
  
      /************************************************************************
  	 * Element serializeSelector(Document doc, XmlSchemaXPath selectorObj,
  	 *    XmlSchema schema) throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * selectorObj      - XmlSchemaXPath that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of selector with collection of xpath as its attrib.  The selector
  	 * itself is the part of identity type.  eg <key><selector xpath="..."
  	 ************************************************************************/
      Element serializeSelector(Document doc, XmlSchemaXPath selectorObj,
  							  XmlSchema schema) throws XmlSchemaSerializerException{
      
          Element selector = createNewElement(doc, "selector", 
  											schema.schema_ns_prefix, schema.SCHEMA_NS);
      
          if(selectorObj.xpath != null)
              selector.setAttributeNS(schema.SCHEMA_NS, "xpath", 
  									selectorObj.xpath);
          else
              throw new XmlSchemaSerializerException("xpath can't be null");
          
          if(selectorObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 selectorObj.annotation, schema);
              selector.appendChild(annotation);
          }
          return selector;
      }
     
      /************************************************************************
  	 * Element serializeField(Document doc, XmlSchemaXPath fieldObj, 
  	 *    XmlSchema schema) throws XmlSchemaSerializerException
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc           - Document the parent use.
  	 * fieldObj      - XmlSchemaXPath that will be serialized.
  	 * schema        - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * field element that part of constraint.
  	 ************************************************************************/
      Element serializeField(Document doc, XmlSchemaXPath fieldObj, 
  						   XmlSchema schema) throws XmlSchemaSerializerException{
      
          Element field = createNewElement(doc, "field", schema.schema_ns_prefix, 
  										 schema.SCHEMA_NS);
      
          if(fieldObj.xpath != null)
              field.setAttributeNS(schema.SCHEMA_NS, "xpath", fieldObj.xpath);
          else
              throw new XmlSchemaSerializerException("xpath can't be null");
          
          if(fieldObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 fieldObj.annotation, schema);
              field.appendChild(annotation);
          }
          
          return field;
      }
      
      /************************************************************************
  	 * Element serializeAnnotation(Document doc, XmlSchemaAnnotation 
  	 *    annotationObj, XmlSchema schema) 
  	 *
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * annotationObj      - XmlSchemaAnnotation that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * annotation element that part of any type. will contain document and 
  	 * appinfo for child.
  	 ************************************************************************/
      Element serializeAnnotation(Document doc, XmlSchemaAnnotation annotationObj, 
  								XmlSchema schema){
              
          Element annotation = createNewElement(doc, "annotation", 
  											  schema.schema_ns_prefix,schema.SCHEMA_NS);
          
          XmlSchemaObjectCollection contents = annotationObj.items;
          int contentLength = contents.getCount();
          
          for(int i=0; i<contentLength; i++){
              XmlSchemaObject obj = contents.getItem(i);
              
              if(obj instanceof XmlSchemaAppInfo){
                  XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo)obj;
                  Element appInfoEl = serializeAppInfo(doc, appinfo, schema);
                  annotation.appendChild(appInfoEl);
              }else if(obj instanceof XmlSchemaDocumentation){
                  XmlSchemaDocumentation documentation = 
                      (XmlSchemaDocumentation)obj;
                  
                  Element documentationEl = serializeDocumentation(doc, 
  																 documentation, schema);
                  
                  
                  annotation.appendChild(documentationEl);
              }
          }
   
          return annotation;
      }    
   
      /************************************************************************
  	 * Element serializeAppInfo(Document doc,XmlSchemaAppInfo appInfoObj,
  	 *    XmlSchema schema)
  	 *
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * appInfoObj        - XmlSchemaAppInfo that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * App info element that is part of the annotation.
  	 ************************************************************************/
      Element serializeAppInfo(Document doc,XmlSchemaAppInfo appInfoObj,
  							 XmlSchema schema){
              
          Element appInfoEl = createNewElement(doc, "appinfo", 
  											 schema.schema_ns_prefix, schema.SCHEMA_NS);
          if(appInfoObj.source != null)
              appInfoEl.setAttributeNS(schema.SCHEMA_NS, "source", 
  									 appInfoObj.source);
  
          if(appInfoObj.markup != null){
              int markupLength = appInfoObj.markup.getLength();
              for(int j=0;j<markupLength; j++){
                  Node n = appInfoObj.markup.item(j);
                  switch(n.getNodeType()){
  				case Node.ELEMENT_NODE:
  					appendElement(doc, appInfoEl, n, schema);
  					break;
  				case Node.TEXT_NODE:
  					Text t = doc.createTextNode(n.getNodeValue()); 
  					appInfoEl.appendChild(t);
  					break;
  				default:
  					break;
                  }
              }
          }
  
          return appInfoEl;
      }
   
      /************************************************************************
  	 * Element serializeDocumentation(Document doc,XmlSchemaDocumentation 
  	 *    documentationObj, XmlSchema schema){
  	 *
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * documentationObj        - XmlSchemaAppInfo that will be serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element representation of documentation that is part of annotation.
  	 ************************************************************************/
      Element serializeDocumentation(Document doc,XmlSchemaDocumentation 
  								   documentationObj, XmlSchema schema){
          
              
              
          Element documentationEl = createNewElement(doc, "documentation",
  												   schema.schema_ns_prefix, schema.SCHEMA_NS);
          if(documentationObj.source != null)
              documentationEl.setAttributeNS(schema.SCHEMA_NS, "source", 
  										   documentationObj.source);
          if(documentationObj.language != null)
              documentationEl.setAttributeNS(
  										   "http://www.w3.org/XML/1998/namespace", "xml:lang",
  										   documentationObj.language);
  
          if(documentationObj.markup != null){
              int markupLength = documentationObj.markup.getLength();
              for(int j=0;j<markupLength; j++){
                  Node n = documentationObj.markup.item(j);
                  
                  switch(n.getNodeType()){
  				case Node.ELEMENT_NODE:
  					appendElement(doc, documentationEl, n, schema);
  					break;
  				case Node.TEXT_NODE:
  					Text t = doc.createTextNode(n.getNodeValue()); 
  					documentationEl.appendChild(t);
  					break;
  				default:
  					break;
                  }
              }
          }
          return documentationEl;
      }       
   
      /************************************************************************
  	 * Element serializeSimpleContentRestriction(Document doc, 
  	 *    XmlSchemaSimpleContentRestriction restrictionObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc               - Document the parent use.
  	 * restrictionObj    - XmlSchemaSimpleContentRestriction that will be 
  	 *                       serialized.
  	 * schema            - Schema Document object of the parent.
  	 *
  	 * Return:
  	 *   Element of simple content restriction.
  	 ************************************************************************/
      Element serializeSimpleContentRestriction(Document doc, 
  											  XmlSchemaSimpleContentRestriction restrictionObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          Element restriction = createNewElement(doc, "restriction", 
  											   schema.schema_ns_prefix, schema.SCHEMA_NS);
  
          if(restrictionObj.baseTypeName != null){
              String baseTypeName = 
                  resolveQualifiedName(restrictionObj.baseTypeName, schema);
              
              restriction.setAttributeNS(schema.SCHEMA_NS, "base",baseTypeName);
          
          }
          if(restrictionObj.id != null)
  			restriction.setAttributeNS(schema.SCHEMA_NS, "id",restrictionObj.id);
              
          if(restrictionObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 restrictionObj.annotation, schema);
              restriction.appendChild(annotation);
          }
          int attrCollLength = restrictionObj.attributes.getCount();
          for(int i=0; i<attrCollLength;i++){
              XmlSchemaObject obj = restrictionObj.attributes.getItem(i);
              
              if(obj instanceof XmlSchemaAttribute){
                  Element attribute = serializeAttribute(doc, 
  													   (XmlSchemaAttribute)obj, schema);
                  restriction.appendChild(attribute);
              }else if(obj instanceof XmlSchemaAttributeGroupRef){
                  Element attributeGroup = serializeAttributeGroupRef(doc, 
  																	(XmlSchemaAttributeGroupRef)obj, schema);
                  restriction.appendChild(attributeGroup);
              }
          }
          if(restrictionObj.baseType != null){
              Element inlineSimpleType = serializeSimpleType(doc, 
  														   restrictionObj.baseType, schema);
              restriction.appendChild(inlineSimpleType);
          }
          if(restrictionObj.anyAttribute != null){
              Element anyAttribute = serializeAnyAttribute(doc, 
  														 restrictionObj.anyAttribute, schema);
              restriction.appendChild(anyAttribute);
          }
          XmlSchemaObjectCollection facets = restrictionObj.facets;
          int facetLength = facets.getCount();
          for(int i=0;i<facetLength;i++){
              Element facet = serializeFacet(doc, 
  										   (XmlSchemaFacet)facets.getItem(i), schema);
              restriction.appendChild(facet);
          }
          return restriction;
      }    
      
      /************************************************************************
  	 * Element serializeSimpleContentExtension(Document doc, 
  	 *    XmlSchemaSimpleContentExtension extensionObj, XmlSchema schema)
  	 *        throws XmlSchemaSerializerException{
  	 *
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                 - Document the parent use.
  	 * extensionObj        - XmlSchemaSimpleContentExtension 
  	 *                       that will be serialized.
  	 * schema              - Schema Document object of the parent.
  	 *
  	 * Return:
  	 *   Element of simple content extension.
  	 ************************************************************************/
      Element serializeSimpleContentExtension(Document doc, 
  											XmlSchemaSimpleContentExtension extensionObj, XmlSchema schema)
  		throws XmlSchemaSerializerException{
          
          Element extension = createNewElement(doc, "extension",
  											 schema.schema_ns_prefix, schema.SCHEMA_NS);
         
          if(extensionObj.baseTypeName != null){
              String baseTypeName = 
                  resolveQualifiedName(extensionObj.baseTypeName, schema);
              
              extension.setAttributeNS(schema.SCHEMA_NS, "base", baseTypeName);
          }
          
          if(extensionObj.id != null)
              extension.setAttributeNS(schema.SCHEMA_NS, "id", extensionObj.id);
          
          if(extensionObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 extensionObj.annotation, schema);
              extension.appendChild(annotation);
          }
          if(extensionObj.anyAttribute != null){
              Element anyAttribute = serializeAnyAttribute(doc,
  														 extensionObj.anyAttribute, schema);
              extension.appendChild(anyAttribute);
          }
          
          XmlSchemaObjectCollection attributes = extensionObj.attributes;
          int attributeLength = attributes.getCount();
          for(int i=0;i<attributeLength;i++){
              XmlSchemaObject obj = attributes.getItem(i);
              
              if(obj instanceof XmlSchemaAttribute){
                  Element attribute = serializeAttribute(doc, 
  													   (XmlSchemaAttribute)obj, schema);
                  extension.appendChild(attribute);
              }else if(obj instanceof XmlSchemaAttributeGroupRef){
                  Element attributeGroupRef = serializeAttributeGroupRef(doc, 
  																	   (XmlSchemaAttributeGroupRef)obj, schema);
                  extension.appendChild(attributeGroupRef);
              }
          }
          return extension;
      }    
      /************************************************************************
  	 * Element serializeComplexContentRestriction(Document doc, 
  	 *    XmlSchemaComplexContentRestriction restrictionObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                 - Document the parent use.
  	 * restrictionObj        - XmlSchemaSimpleContentRestriction 
  	 *                       that will be serialized.
  	 * schema              - Schema Document object of the parent.
  	 *
  	 * Return:
  	 *   Element of simple content restriction.
  	 ************************************************************************/
      Element serializeComplexContentRestriction(Document doc, 
  											   XmlSchemaComplexContentRestriction restrictionObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          Element restriction = createNewElement(doc, "restriction", 
  											   schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          if(restrictionObj.baseTypeName != null){
              String baseTypeName = resolveQualifiedName(
  													   restrictionObj.baseTypeName, schema);
              restriction.setAttributeNS(schema.SCHEMA_NS, 
  									   "base", baseTypeName);
          }
          
          if(restrictionObj.id != null)
              restriction.setAttributeNS(schema.SCHEMA_NS, "id",
  									   restrictionObj.id);
          
          if(restrictionObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 restrictionObj.annotation, schema);
              restriction.appendChild(annotation);
          }
  
          if(restrictionObj.particle instanceof XmlSchemaSequence){
              Element sequenceParticle = serializeSequence(doc,
  														 (XmlSchemaSequence)restrictionObj.particle, schema);
              restriction.appendChild(sequenceParticle);
          }else if(restrictionObj.particle instanceof XmlSchemaChoice){
              Element choiceParticle = serializeChoice(doc, 
  													 (XmlSchemaChoice)restrictionObj.particle, schema);
              restriction.appendChild(choiceParticle);
          }else if(restrictionObj.particle instanceof XmlSchemaAll){
              Element allParticle = serializeAll(doc, 
  											   (XmlSchemaAll)restrictionObj.particle, schema);
              restriction.appendChild(allParticle);
          }else if(restrictionObj.particle instanceof XmlSchemaGroupRef){
              Element groupRefParticle = serializeGroupRef(doc, 
  														 (XmlSchemaGroupRef)restrictionObj.particle, schema);
              restriction.appendChild(groupRefParticle);
          }
              
          int attributesLength = restrictionObj.attributes.getCount();
          for(int i=0;i<attributesLength;i++){
              XmlSchemaObject obj = restrictionObj.attributes.getItem(i);
              
              if(obj instanceof XmlSchemaAttribute){
                  Element attr = serializeAttribute(doc, 
  												  (XmlSchemaAttribute)obj, schema);
                  restriction.appendChild(attr);
              }else if(obj instanceof XmlSchemaAttribute){
                  Element attrGroup = serializeAttributeGroupRef(doc, 
  															   (XmlSchemaAttributeGroupRef)obj, schema);
                  restriction.appendChild(attrGroup);
              }
          }
      
          if(restrictionObj.anyAttribute != null){
              Element anyAttribute = serializeAnyAttribute(doc, 
  														 restrictionObj.anyAttribute, schema);
              restriction.appendChild(anyAttribute);
          }
              
          return restriction;
      }    
      
      /************************************************************************
  	 * Element serializeComplexContentExtension(Document doc, 
  	 *    XmlSchemaComplexContentExtension extensionObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                 - Document the parent use.
  	 * extensionObj        - XmlSchemaComplexContentRestriction 
  	 *                       that will be serialized.
  	 * schema              - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of complex content extension.
  	 ************************************************************************/
      Element serializeComplexContentExtension(Document doc, 
  											 XmlSchemaComplexContentExtension extensionObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          Element extension = createNewElement(doc, "extension", 
  											 schema.schema_ns_prefix, schema.SCHEMA_NS);
          if(extensionObj.baseTypeName != null){
              String baseType = resolveQualifiedName(extensionObj.baseTypeName, 
  												   schema);
              extension.setAttributeNS(schema.SCHEMA_NS,"base", baseType);
          }
          if(extensionObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 extensionObj.annotation, schema );
              extension.appendChild(annotation);
          }
          
  
          if(extensionObj.particle instanceof XmlSchemaSequence){
              Element sequenceParticle = serializeSequence(doc,
  														 (XmlSchemaSequence)extensionObj.particle, schema);
              extension.appendChild(sequenceParticle);
          }else if(extensionObj.particle instanceof XmlSchemaChoice){
              Element choiceParticle = serializeChoice(doc, 
  													 (XmlSchemaChoice)extensionObj.particle, schema);
              extension.appendChild(choiceParticle);
          }else if(extensionObj.particle instanceof XmlSchemaAll){
              Element allParticle = serializeAll(doc, 
  											   (XmlSchemaAll)extensionObj.particle, schema);
              extension.appendChild(allParticle);
          }else if(extensionObj.particle instanceof XmlSchemaGroupRef){
              Element groupRefParticle = serializeGroupRef(doc, 
  														 (XmlSchemaGroupRef)extensionObj.particle, schema);
              extension.appendChild(groupRefParticle);
          }
              
          int attributesLength = extensionObj.attributes.getCount();
          for(int i=0;i<attributesLength;i++){
              XmlSchemaObject obj = extensionObj.attributes.getItem(i);
              
              if(obj instanceof XmlSchemaAttribute){
                  Element attr = serializeAttribute(doc,
  												  (XmlSchemaAttribute)obj, schema);
                  extension.appendChild(attr);
              }else if(obj instanceof XmlSchemaAttributeGroupRef){
                  Element attrGroup = serializeAttributeGroupRef(doc, 
  															   (XmlSchemaAttributeGroupRef)obj, schema);
                  extension.appendChild(attrGroup);
              }
          }
      
          if(extensionObj.anyAttribute != null){
              Element anyAttribute = serializeAnyAttribute(doc, 
  														 extensionObj.anyAttribute, schema);
              extension.appendChild(anyAttribute);
          }
          
          return extension;
      }    
      /************************************************************************
  	 * Element serializeAnyAttribute(Document doc,
  	 *    XmlSchemaAnyAttribute anyAttributeObj, XmlSchema schema)
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                 - Document the parent use.
  	 * anyAttributeObj     - XmlSchemaAnyAttribute 
  	 *                       that will be serialized.
  	 * schema              - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of any attribute element.
  	 ************************************************************************/
      Element serializeAnyAttribute(Document doc,
  								  XmlSchemaAnyAttribute anyAttributeObj, XmlSchema schema){
          
          Element anyAttribute = createNewElement(doc, "anyAttribute", 
  												schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          
          if(anyAttributeObj.namespace != null)
              anyAttribute.setAttributeNS(schema.SCHEMA_NS, "namespace", 
  										anyAttributeObj.namespace);
          
          if(anyAttributeObj.id != null)
              anyAttribute.setAttributeNS(schema.SCHEMA_NS, "id", 
  										anyAttributeObj.id);
          
          if(anyAttributeObj.processContent != null){
              String processContent = anyAttributeObj.processContent.getValue();
              processContent = convertString(processContent);
              anyAttribute.setAttributeNS(schema.SCHEMA_NS, "processContents", 
  										processContent);
          }
          if(anyAttributeObj.annotation != null){
              Element annotation = serializeAnnotation(doc, 
  													 anyAttributeObj.annotation, schema);
              anyAttribute.appendChild(annotation);
          }
  
          return anyAttribute;
      }    
      /************************************************************************
  	 * Element serializeAttributeGroupRef(Document doc, 
  	 *    XmlSchemaAttributeGroupRef attributeGroupObj, XmlSchema schema) 
  	 *   throws XmlSchemaSerializerException
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                 - Document the parent use.
  	 * attributeGroupObj     - XmlSchemaAttributeGroupRef 
  	 *                       that will be serialized.
  	 * schema              - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of attribute group ref that part of type.
  	 ************************************************************************/
      Element serializeAttributeGroupRef(Document doc, 
  									   XmlSchemaAttributeGroupRef attributeGroupObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
          
          Element attributeGroupRef = createNewElement(doc, "attributeGroup", 
  													 schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          if(attributeGroupObj.refName != null){
              String refName = resolveQualifiedName(attributeGroupObj.refName, 
  												  schema);
              attributeGroupRef.setAttributeNS(schema.SCHEMA_NS, "ref", refName);
          }else
              throw new XmlSchemaSerializerException("Attribute group must have "
  												   + "ref name set");
          
          if(attributeGroupObj.id != null)
              attributeGroupRef.setAttributeNS(schema.SCHEMA_NS,"id", 
  											 attributeGroupObj.id);
          
          if(attributeGroupObj.annotation != null){
              Element annotation = serializeAnnotation(doc,
  													 attributeGroupObj.annotation, schema);
              attributeGroupRef.appendChild(annotation);
          }
          return attributeGroupRef;
      }
      /************************************************************************
  	 * Element serializeAttributeGroup(Document doc, 
  	 *    XmlSchemaAttributeGroup attributeGroupObj, XmlSchema schema) 
  	 *    throws XmlSchemaSerializerException{
  	 *   
  	 * Each member of complex type will be appended and pass the element
  	 * created.  Complex type processed according to w3c Recommendation
  	 * May 2 2001. 
  	 *
  	 * Parameter:
  	 * doc                 - Document the parent use.
  	 * attributeGroupObj     - XmlSchemaAttributeGroup
  	 *                       that will be serialized.
  	 * schema              - Schema Document object of the parent.
  	 *
  	 * Return:
  	 * Element of attribute group.
  	 ************************************************************************/
      Element serializeAttributeGroup(Document doc, 
  									XmlSchemaAttributeGroup attributeGroupObj, XmlSchema schema) 
          throws XmlSchemaSerializerException{
      
          Element attributeGroup = createNewElement(doc, "attributeGroup", 
  												  schema.schema_ns_prefix, schema.SCHEMA_NS);
          
          if(attributeGroupObj.name != null)
              attributeGroup.setAttributeNS(schema.SCHEMA_NS, "name", 
  										  attributeGroupObj.name);
          else
              throw new XmlSchemaSerializerException("Attribute group must"
  												   + "have name");
          if(attributeGroupObj.id != null)
              attributeGroup.setAttributeNS(schema.SCHEMA_NS, "id", 
  										  attributeGroupObj.id);
          
          if(attributeGroupObj.annotation != null){
              Element annotation = serializeAnnotation(doc,
  													 attributeGroupObj.annotation, schema);
              attributeGroup.appendChild(annotation);
          }
          int attributesLength = attributeGroupObj.attributes.getCount();
          for(int i=0;i<attributesLength;i++){
              XmlSchemaObject obj = attributeGroupObj.attributes.getItem(i);
              
              if(obj instanceof XmlSchemaAttribute){
                  Element attr = serializeAttribute(doc, (XmlSchemaAttribute)obj,
  												  schema);
                  attributeGroup.appendChild(attr);
              }else if(obj instanceof XmlSchemaAttributeGroupRef){
                  Element attrGroup = serializeAttributeGroupRef(doc, 
  															   (XmlSchemaAttributeGroupRef)obj, schema);
                  attributeGroup.appendChild(attrGroup);
              }
          }
      
          if(attributeGroupObj.anyAttribute != null){
              Element anyAttribute = serializeAnyAttribute(doc, 
  														 attributeGroupObj.anyAttribute, schema);
              attributeGroup.appendChild(anyAttribute);
          }
          
          return attributeGroup;
      }
      
      //recursively add any attribute, text and children append all 
      //found children base on parent as its root.
      private void appendElement(Document doc, Element parent, 
  							   Node children, XmlSchema schema){
          Element elTmp = (Element) children;
          Element el = createNewElement(doc, elTmp.getTagName(), 
  									  schema.schema_ns_prefix, schema.SCHEMA_NS);
          NamedNodeMap attributes = el.getAttributes();
          //check if child node has attribute  
          //create new element and append it if found
          int attributeLength = attributes.getLength();
          for(int i=0;i<attributeLength;i++){
              Node n = attributes.item(i); 
              //assuming attributes got to throw exception if not later
              el.setAttributeNS(schema.SCHEMA_NS,n.getNodeName(),
  							  n.getNodeValue());
          }
          
          //check any descendant of this node
          //if there then append its child
          NodeList decendants = el.getChildNodes();
          int decendantLength = decendants.getLength();
          for(int i=0;i<decendantLength;i++){
              Node n = decendants.item(i);
              short nodeType = n.getNodeType();
              if(nodeType == Node.TEXT_NODE){
                  String nValue = n.getNodeValue();
                  Text t = doc.createTextNode(nValue);
                  el.appendChild(t);
              }else if(nodeType == Node.ELEMENT_NODE){
                  appendElement(doc, el, n, schema);
              }
          }
      }
      
      //break string with prefix into two parts part[0]:prefix , part[1]:namespace
      private static String[] getParts(String name){
          String[] parts = new String[2];		
  
          int index = name.indexOf(":");
          if( index > -1) {
  			parts[0]= name.substring(0, index);
  			parts[1]= name.substring(index + 1);
          } else {
  			parts[0] = "";
  			parts[1] = name;
          }		
          return parts;
      }
      
      //Convert given string to lower case or w3c standard
      private String convertString(String convert){
          String input = convert.trim();
          if(input.equals("All")){
              return "#all";
          }else
              return input.toLowerCase();
      }
      //Create new element with given local name and namespaces check whether
      //the prefix is there or not.
      private Element createNewElement(Document docs, String localName, 
  									 String prefix, String namespace){
          String elementName = ((prefix.length()>0)? prefix += ":"  : "" )   
              + localName; 
          return docs.createElementNS(namespace, elementName);
      }
  
      //will search whether the prefix is available in global hash table, if it
      //is there than append the prefix to the element name.  If not then it will
      //create new prefix corresponding to that namespace and store that in 
      //hash table.  Finally add the new prefix and namespace to <schema> 
      //element
      private String resolveQualifiedName(QualifiedName names, 
  										XmlSchema schemaObj){
          
          String namespace = names.getNameSpace();
          String type[] = getParts(names.getName());
          String typeName = (type.length > 1)? type[1]: type[0];
          String prefixStr;
          
          Object prefix = schema_ns.get(namespace);
          
          if(prefix==null){
              int magicNumber = new java.util.Random().nextInt(999);
              prefix = "gen" +  magicNumber;
              schema_ns.put(namespace, prefix);
  
              
              //setting xmlns in schema
              schemaElement.setAttributeNS("http://www.w3.org/2000/xmlns/", 
  										 "xmlns:" +prefix.toString() ,  namespace);
          }
              
          prefixStr = prefix.toString();
          prefixStr = (prefixStr.trim().length()>0)?  prefixStr + ":" : "";
  
          return prefixStr + typeName;
      }
      
      //for each collection if it is an attribute serialize attribute and 
      //append that child to container element.
      void setupAttr(Document doc, XmlSchemaObjectCollection collectionObj, 
  				   XmlSchema schema, Element container) throws XmlSchemaSerializerException{
          int collectionLength = collectionObj.getCount();
          for(int i=0;i<collectionLength;i++){
              XmlSchemaObject obj = collectionObj.getItem(i);
              if(obj instanceof XmlSchemaAttribute){
                  XmlSchemaAttribute attr = (XmlSchemaAttribute)obj;
                  Element attrEl = serializeAttribute(doc, attr, schema);
                  container.appendChild(attrEl);
              }
              else if (obj instanceof XmlSchemaAttributeGroupRef){
                  XmlSchemaAttributeGroupRef attr= (XmlSchemaAttributeGroupRef)obj;
                  Element attrEl = serializeAttributeGroupRef(doc, attr, schema);
                  container.appendChild(attrEl);
              }
          }
      }
      
  	public static class XmlSchemaSerializerException extends Exception {
          
          public XmlSchemaSerializerException(String msg){
              super(msg);
          }
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleContent.java
  
  Index: XmlSchemaSimpleContent.java
  ===================================================================
  /*
   * XmlSchemaSimpleContent.java
   *
   * Created on September 27, 2001, 3:19 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for simple types and complex types with a simple content model. 
   * Represents the World Wide Web Consortium (W3C) simpleContent element.  
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaSimpleContent extends XmlSchemaContentModel{
  
      /** Creates new XmlSchemaSimpleContent */
      public XmlSchemaSimpleContent() {
      }
  
  	/*  One of XmlSchemaSimpleContentRestriction or XmlSchemaSimpleContentExtension. */
  	XmlSchemaContent content;
  	
  	public XmlSchemaContent getContent() {
  		return this.content;
  	}
  	
  	public void setContent( XmlSchemaContent content ) {
  		this.content = content;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1) {
  			prefix += ":";	
  		}
  		return xml;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleContentExtension.java
  
  Index: XmlSchemaSimpleContentExtension.java
  ===================================================================
  /*
   * XmlSchemaSimpleContentExtension.java
   *
   * Created on September 27, 2001, 3:18 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  /**
   * Class for simple types that are derived by extension. Extends the simple
   * type content of the element by adding attributes. Represents the World Wide
   * Web Consortium (W3C) extension element for simple content.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaSimpleContentExtension extends XmlSchemaContent {
  
      /** Creates new XmlSchemaSimpleContentExtension */
      public XmlSchemaSimpleContentExtension() {
  		attributes = new XmlSchemaObjectCollection();
      
      }
  
  	/* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
  	XmlSchemaAnyAttribute anyAttribute;
  	
  	public void setAnyAttribute( XmlSchemaAnyAttribute anyAttribute ) {
  		this.anyAttribute = anyAttribute;
  	}
  	
  	public XmlSchemaAnyAttribute getAnyAttribute() {
  		return this.anyAttribute;
  	}
  	
  	/* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/
  	XmlSchemaObjectCollection  attributes;
  	
  	public XmlSchemaObjectCollection getAttributes() {
  		return this.attributes;
  	}
  
  	/* Name of the built-in data type, simple type, or complex type.*/
  	QualifiedName baseTypeName;
  	
  	public void setBaseTypeName( QualifiedName  baseTypeName) {
  		this.baseTypeName = baseTypeName;
  	}
  	
  	public QualifiedName getBaseTypeName() {
  		return this.baseTypeName;
  	}
  	
  }
  
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleContentRestriction.java
  
  Index: XmlSchemaSimpleContentRestriction.java
  ===================================================================
  /*
   * XmlSchemaSimpleContentRestriction.java
   *
   * Created on September 27, 2001, 3:18 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for simple types that are derived by restriction. Restricts the
   * range of values for the element to a subset of the inherited simple types. 
   * Represents the World Wide Web Consortium (W3C) restriction element for simple content.  
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaSimpleContentRestriction extends XmlSchemaContent{
  
      /** Creates new XmlSchemaSimpleContentRestriction */
      public XmlSchemaSimpleContentRestriction() {
  		facets = new XmlSchemaObjectCollection();
  		attributes = new XmlSchemaObjectCollection();
      }
  	
  	/* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
  	XmlSchemaAnyAttribute anyAttribute;
  	
  	public void setAnyAttribute( XmlSchemaAnyAttribute anyAttribute ) {
  		this.anyAttribute = anyAttribute;
  	}
  	
  	public XmlSchemaAnyAttribute getAnyAttribute() {
  		return this.anyAttribute;
  	}
  	/* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/
  	XmlSchemaObjectCollection  attributes;
  	
  	public XmlSchemaObjectCollection getAttributes() {
  		return this.attributes;
  	}
  
  	/*Derived from the type specified by the base value.*/
  	XmlSchemaSimpleType baseType;
  	
  	public void setBaseType( XmlSchemaSimpleType  baseType) {
  		this.baseType = baseType;
  	}
  	
  	public XmlSchemaSimpleType getBaseType() {
  		return this.baseType;
  	}
  	
  	/* Name of the built-in data type, simple type, or complex type.*/
  	QualifiedName baseTypeName;
  	
  	public void setBaseTypeName( QualifiedName  baseTypeName) {
  		this.baseTypeName = baseTypeName;
  	}
  	
  	public QualifiedName getBaseTypeName() {
  		return this.baseTypeName;
  	}
  	
  	/* One or more of the facet classes: */
  	XmlSchemaObjectCollection facets;
  	
  	public XmlSchemaObjectCollection getFacets() {
  		return this.facets;
  	}
  	
  }
  			
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleType.java
  
  Index: XmlSchemaSimpleType.java
  ===================================================================
  /*
   * XmlSchemaSimpleType.java
   *
   * Created on September 27, 2001, 3:39 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class defines a simple type that determines the information and
   * constraints for the values of attributes or elements with text-only
   * content. Represents the World Wide Web Consortium (W3C) simpleType element.
   *
   * @author  mukund
   */
  
  // Oct 15th - momo - initial impl
  
  public class XmlSchemaSimpleType extends XmlSchemaType {
  
  	XmlSchemaSimpleTypeContent content;
  	
      /** Creates new XmlSchemaSimpleType */
      public XmlSchemaSimpleType() {
      }
  
  	public XmlSchemaSimpleTypeContent getContent() {
  		return content;
  	}
  	
  	public void setContent(XmlSchemaSimpleTypeContent content) {
  		this.content = content;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  	
  		
  		xml += "<" + prefix  + "simpleType>\n";
  		
  		if(content != null)
  			xml += content.toString(prefix, (tab+1));
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "</" + prefix  + "simpleType>\n";
  		return xml;
  	}
  
  }
  
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleTypeContent.java
  
  Index: XmlSchemaSimpleTypeContent.java
  ===================================================================
  /*
   * XmlSchemaSimpleTypeContent.java
   *
   * Created on September 27, 2001, 3:38 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Abstract class for simple type content classes.
   *
   * @author  mukund
   */
  
  public abstract class XmlSchemaSimpleTypeContent extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaSimpleTypeContent */
      protected XmlSchemaSimpleTypeContent() {
      }
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleTypeList.java
  
  Index: XmlSchemaSimpleTypeList.java
  ===================================================================
  /*
   * XmlSchemaSimpleTypeList.java
   *
   * Created on September 27, 2001, 3:38 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for the list of simpleType elements. Defines a simpleType element
   * as a list of values of a specified data type. Represents the World Wide
   * Web Consortium (W3C) list element.
   *
   * @author  mukund
   */
  public class XmlSchemaSimpleTypeList extends XmlSchemaSimpleTypeContent{
  
      /** Creates new XmlSchemaSimpleTypeList */
      public XmlSchemaSimpleTypeList() {
      }
  	
  	XmlSchemaSimpleType itemType;
  	
  	public XmlSchemaSimpleType getItemType() {
  		return this.itemType;
  	}
  	
  	public void setItemType( XmlSchemaSimpleType itemType ) {
  		this.itemType = itemType;
  	}
  	
  	QualifiedName itemTypeName;
  	
  	public QualifiedName getItemTypeName() {
  		return this.itemTypeName;
  	}
  	
  	public void setItemTypeName( QualifiedName itemTypeName){
  		this.itemTypeName = itemTypeName;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleTypeRestriction.java
  
  Index: XmlSchemaSimpleTypeRestriction.java
  ===================================================================
  /*
   * XmlSchemaSimpleTypeRestriction.java
   *
   * Created on September 27, 2001, 3:38 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  
  /**
   * Class for the restriction of simpleType elements. Represents the World
   * Wide Web Consortium (W3C) restriction element for simple types.
   *
   * @author  mukund
   */
  
  public class XmlSchemaSimpleTypeRestriction extends XmlSchemaSimpleTypeContent{
  
      /** Creates new XmlSchemaSimpleTypeRestriction */
      public XmlSchemaSimpleTypeRestriction() {
  		facets = new XmlSchemaObjectCollection();
      }
  	
  	XmlSchemaSimpleType baseType;
  	
  	public	XmlSchemaSimpleType getBaseType() {
  		return this.baseType;
  	}
  	
  	public void setBaseType( XmlSchemaSimpleType baseType ) {
  		this.baseType = baseType;
  	}
  	
  	QualifiedName baseTypeName;
  	
  	public QualifiedName getBaseTypeName(){
  		return this.baseTypeName;
  	}
  	
  	public void setBaseTypeName( QualifiedName baseTypeName ) {
  		this.baseTypeName = baseTypeName;
  	}
  	
  	XmlSchemaObjectCollection facets;// = new XmlSchemaObjectCollection();
  	
  	public XmlSchemaObjectCollection getFacets() {
  		return this.facets;
  	}
  	
  	public String toString(String prefix, int tab) {
  		String xml = new String();
  		
  		if(!prefix.equals("") && prefix.indexOf(":") == -1)
  			prefix += ":";
  		
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		
  		xml += "<"+prefix + "restriction ";
  		
  		if(baseTypeName != null) {
  			xml += "base =\"" +  baseTypeName + "\">\n";
  		} else {
  			xml += ">\n";
  			// inline def
  			xml += baseType.toString(prefix, (tab+1));
  		}	
  		
  		xml += facets.toString(prefix, (tab+1));
  		for(int i=0;i<tab;i++)
  			xml += "\t";
  		xml += "</"+prefix+"restriction>\n";	
  	
  		
  		return xml;
  			
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaSimpleTypeUnion.java
  
  Index: XmlSchemaSimpleTypeUnion.java
  ===================================================================
  /*
   * XmlSchemaSimpleTypeUnion.java
   *
   * Created on September 27, 2001, 3:39 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  /**
   * Class for the union of simpleType elements. Defines a simpleType element
   * as a list of values of a specified data type. Represents the World 
   * Wide Web Consortium (W3C) union element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaSimpleTypeUnion extends XmlSchemaSimpleTypeContent{
  
  	XmlSchemaObjectCollection baseTypes;
  	String memberTypesSource;
  	QualifiedName[] memberTypesQNames;
  
  	public XmlSchemaSimpleTypeUnion() {
  		baseTypes = new XmlSchemaObjectCollection();
  	}
  	
  	public XmlSchemaObjectCollection getBaseTypes() {
  		return this.baseTypes;
  	}
  	
  	public void setMemberTypesSource( String memberTypesSources ){
  		this.memberTypesSource = memberTypesSources;
  	}
  	
  	public String getMemberTypesSource(){
  		return this.memberTypesSource;
  	}
          
  	public QualifiedName[] getMemberTypesQNames(){
  		return this.memberTypesQNames;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaTotalDigitsFacet.java
  
  Index: XmlSchemaTotalDigitsFacet.java
  ===================================================================
  /*
   * XmlSchemaTotalDigitsFacet.java
   *
   * Created on September 27, 2001, 3:33 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining totalDigits facets. Represents the World Wide
   * Web Consortium (W3C) totalDigits facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaTotalDigitsFacet extends XmlSchemaNumericFacet {
  
      /** Creates new XmlSchemaTotalDigitsFacet */
      public XmlSchemaTotalDigitsFacet() {
      }
  
  	public XmlSchemaTotalDigitsFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaType.java
  
  Index: XmlSchemaType.java
  ===================================================================
  /*
   * XmlSchemaType.java
   *
   * Created on September 27, 2001, 3:39 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.xml.QualifiedName;
  /**
   * The base class for all simple types and complex types.
   *
   * @author  mukund
   */
  
  // Oct 15th - momo - initial impl
  
  public class XmlSchemaType extends XmlSchemaAnnotated {
  
  	Object baseSchemaType;
  	XmlSchemaDatatype dataType;
  	XmlSchemaDerivationMethod deriveBy, finalDerivation, finalResolved;
  	boolean isMixed;
  	
  	// name of the type
  	String name;
  	QualifiedName qualifiedName;
  	
  	/** Creates new XmlSchemaType */
  	public XmlSchemaType() {
  		finalDerivation = new XmlSchemaDerivationMethod("None");
  	}
  	
  	public Object getBaseSchemaType() {
  		return baseSchemaType;
  	}
  	
  	public XmlSchemaDatatype getDataType() {
  		return dataType;
  	}
  	
  	public XmlSchemaDerivationMethod getDeriveBy() {
  		return deriveBy;
  	}
  	
  	public XmlSchemaDerivationMethod getFinal() {
  		return finalDerivation;
  	}
  	
  	public void setFinal(XmlSchemaDerivationMethod finalDerivation) {
  		this.finalDerivation = finalDerivation;
  	}
  	
  	public XmlSchemaDerivationMethod getFinalResolved() {
  		return finalResolved;
  	}
  	
  	public boolean isMixed() {
  		return isMixed;
  	}
  	
  	public void setMixed(boolean isMixed) {
  		this.isMixed = isMixed;
  	}
  	
  	public String getName() {
  		return name;
  	}
  	
  	public void setName(String name) {
  		this.name = name;
  	}
  	
  	public QualifiedName getQualifiedName() {
  		return qualifiedName;
  	}
  	
  	public void setQualifiedName(QualifiedName qName) {
  		this.qualifiedName = qName;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaUnique.java
  
  Index: XmlSchemaUnique.java
  ===================================================================
  /*
   * XmlSchemaUnique.java
   *
   * Created on September 27, 2001, 3:35 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Identifies a unique constraint among a set of elements. Represents 
   * the World Wide Web Consortium (W3C) unique element.
   *
   * @author  mukund
   */
  
  public class XmlSchemaUnique extends XmlSchemaIdentityConstraint  {
  
      /** Creates new XmlSchemaUnique */
      public XmlSchemaUnique() {
      }
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaUse.java
  
  Index: XmlSchemaUse.java
  ===================================================================
  /*
   * XmlSchemaUse.java
   *
   * Created on September 27, 2001, 3:05 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.enum.Enum;
  
  /**
   * Indicator of how the attribute is used.  
   *
   * @author  mukund
   */
  public class XmlSchemaUse extends Enum {
  
  	static String[] members = new String[] { "None", "Optional", 
  											 "Prohibited", "Required"};
  	
      /** Creates new XmlSchemaUse */
      public XmlSchemaUse() {
  		super();
      }
  	
  	public XmlSchemaUse(String value) {
  		super(value);
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaWhiteSpaceFacet.java
  
  Index: XmlSchemaWhiteSpaceFacet.java
  ===================================================================
  /*
   * XmlSchemaWhiteSpaceFacet.java
   *
   * Created on September 27, 2001, 3:33 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for defining whiteSpace facets. Represents the World Wide
   * Web Consortium (W3C) whiteSpace facet.
   *
   * @author  mukund
   */
  
  // Vidyanand - 16th Oct - initial implementation
  
  public class XmlSchemaWhiteSpaceFacet extends XmlSchemaFacet {
  
      /** Creates new XmlSchemaWhiteSpaceFacet */
      public XmlSchemaWhiteSpaceFacet() {
      }
  
  	public XmlSchemaWhiteSpaceFacet(Object value, boolean fixed) {
  		super( value, fixed );
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSchemaXPath.java
  
  Index: XmlSchemaXPath.java
  ===================================================================
  /*
   * XmlSchemaXPath.java
   *
   * Created on September 27, 2001, 3:40 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  /**
   * Class for XML Path Language (XPath) expressions. Represents the
   * World Wide Web Consortium (W3C) selector element. The World Wide 
   * Web Consortium (W3C) field element is a collection of 
   * XmlSchemaXPath classes.
   *
   * @author  mukund
   */
  
  public class XmlSchemaXPath extends XmlSchemaAnnotated {
  
      /** Creates new XmlSchemaXPath */
      public XmlSchemaXPath() {
      }
  
  	String xpath;
  	
  	public String getXPath() {
  		return xpath;
  	}
  	
  	public void setXPath(String xpath) {
  		this.xpath = xpath;
  	}
  }
  
  
  
  1.1                  xml-axis/proposals/XmlSchema/src/org/apache/axis/xsd/xml/schema/XmlSeverityType.java
  
  Index: XmlSeverityType.java
  ===================================================================
  /*
   * XmlSeverityType.java
   *
   * Created on September 27, 2001, 3:06 AM
   */
  
  package org.apache.axis.xsd.xml.schema;
  
  import org.apache.axis.xsd.enum.Enum;
  
  /**
   * Represents the severity of the validation event.
   *
   * @author  mukund
   */
  
  public class XmlSeverityType extends Enum	{
  
  	static String[] members = new String[] { "Error", "Warning"};
  	
      /** Creates new XmlSeverityType */
      public XmlSeverityType() {
  		super();
  	}
  	
  	public XmlSeverityType(String value) {
  		super(value);
  	}
  	
  	public String[] getValues() {
  		return members;
  	}
  }
  
  
  

Mime
View raw message