You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by pc...@apache.org on 2003/10/30 02:10:47 UTC

cvs commit: xml-xmlbeans/v2/src/configschema/schema binding-config.xsd

pcal        2003/10/29 17:10:47

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        BindingType.java
               v2/src/binding/org/apache/xmlbeans/impl/binding/compile
                        Java2Schema.java
               v2/src/configschema/schema binding-config.xsd
  Added:       v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        SimpleDocumentBinding.java
  Log:
  root element stuff for bts
  
  Revision  Changes    Path
  1.5       +1 -0      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BindingType.java
  
  Index: BindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BindingType.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BindingType.java	28 Oct 2003 17:51:26 -0000	1.4
  +++ BindingType.java	30 Oct 2003 01:10:47 -0000	1.5
  @@ -141,6 +141,7 @@
           registerClassAndType(JaxbBean.class, org.apache.xmlbeans.x2003.x09.bindingConfig.JaxbBean.type);
           registerClassAndType(ByNameBean.class, org.apache.xmlbeans.x2003.x09.bindingConfig.ByNameBean.type);
           registerClassAndType(SimpleBindingType.class, org.apache.xmlbeans.x2003.x09.bindingConfig.SimpleType.type);
  +        registerClassAndType(SimpleDocumentBinding.class, org.apache.xmlbeans.x2003.x09.bindingConfig.SimpleDocumentBinding.type);
       }
   
   }
  
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/SimpleDocumentBinding.java
  
  Index: SimpleDocumentBinding.java
  ===================================================================
  package org.apache.xmlbeans.impl.binding.bts;
  
  import java.util.*;
  import javax.xml.namespace.QName;
  
  /**
   * Created by IntelliJ IDEA.
   * User: pcal
   * Date: Oct 28, 2003
   * Time: 10:44:54 AM
   * To change this template use Options | File Templates.
   */
  public class SimpleDocumentBinding extends BindingType
  {
    private String mElementName = "";
  
    public SimpleDocumentBinding(BindingTypeName btname, String elementName) {
      super(btname);
      System.out.println("++"+elementName);
      mElementName = elementName;
    }
  
    public SimpleDocumentBinding(org.apache.xmlbeans.x2003.x09.bindingConfig.SimpleDocumentBinding node)
    {
      super(node);
      mElementName = node.getElementName();
    }
  
    /**
     * This function copies an instance back out to the relevant part of the XML file.
     *
     * Subclasses should override and call super.write first.
     */
    protected org.apache.xmlbeans.x2003.x09.bindingConfig.BindingType write(org.apache.xmlbeans.x2003.x09.bindingConfig.BindingType node)
    {
      org.apache.xmlbeans.x2003.x09.bindingConfig.SimpleDocumentBinding sdbNode =
              (org.apache.xmlbeans.x2003.x09.bindingConfig.SimpleDocumentBinding)super.write(node);
      sdbNode.setElementName(mElementName);
      return sdbNode;
    }
  
    public String getElementName() { return mElementName; }
  
    public void setElementName(String name) { mElementName = name; }
  }
  
  
  
  1.4       +9 -1      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Java2Schema.java
  
  Index: Java2Schema.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Java2Schema.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Java2Schema.java	28 Oct 2003 17:51:27 -0000	1.3
  +++ Java2Schema.java	30 Oct 2003 01:10:47 -0000	1.4
  @@ -88,6 +88,7 @@
     private static final String TAG_AT               = "xsdgen:attribute";
     private static final String TAG_AT_NAME          = TAG_AT+".name";
   
  +
     // =========================================================================
     // Variables
   
  @@ -142,8 +143,15 @@
       QName qname = new QName(tns,xsdName);
       xsdType.setName(xsdName);
       // create a binding type
  -    ByNameBean bindType = new ByNameBean(BindingTypeName.forPair(getJavaName(clazz), XmlName.forTypeNamed(qname)));
  +    BindingTypeName btname = BindingTypeName.forPair(getJavaName(clazz),
  +                                                     XmlName.forTypeNamed(qname));
  +    ByNameBean bindType = new ByNameBean(btname);
       mBindingFile.addBindingType(bindType,true,true);
  +    String rootName = getAnnotation(clazz,TAG_CT_ROOT,null);
  +    if (rootName != null) {
  +      SimpleDocumentBinding sdb = new SimpleDocumentBinding(btname,rootName);
  +      mBindingFile.addBindingType(sdb,true,true);
  +    }
       // run through the class' properties to populate the binding and xsdtypes
       //FIXME this is going to have to change to take inheritance into account
       JProperty props[] = clazz.getProperties();
  
  
  
  1.6       +11 -1     xml-xmlbeans/v2/src/configschema/schema/binding-config.xsd
  
  Index: binding-config.xsd
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/configschema/schema/binding-config.xsd,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- binding-config.xsd	29 Oct 2003 20:32:03 -0000	1.5
  +++ binding-config.xsd	30 Oct 2003 01:10:47 -0000	1.6
  @@ -43,12 +43,22 @@
         <!-- todo: maybe more java info, e.g., instanceType, is-interface, is-xmlobj etc? -->
       </xs:sequence>
     </xs:complexType>
  -    
  +
     <xs:complexType name="simple-type">
       <xs:complexContent>
         <xs:extension base="tns:binding-type">
           <xs:sequence>
             <xs:element name="as-xml" type="tns:xml-signature"/>
  +        </xs:sequence>
  +      </xs:extension>
  +    </xs:complexContent>
  +  </xs:complexType>
  +
  +  <xs:complexType name="simple-document-binding">
  +    <xs:complexContent>
  +      <xs:extension base="tns:binding-type">
  +        <xs:sequence>
  +          <xs:element name="element-name" type="xs:string"/>
           </xs:sequence>
         </xs:extension>
       </xs:complexContent>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org