You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by pc...@apache.org on 2003/11/13 02:37:07 UTC
cvs commit: xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc JDClassLoaderFactory.java
pcal 2003/11/12 17:37:07
Modified: v2/src/binding/org/apache/xmlbeans/impl/binding/bts
BindingType.java ByNameBean.java
v2/src/binding/org/apache/xmlbeans/impl/binding/compile
Java2Schema.java
v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc
JDClassLoaderFactory.java
Log:
java2schema: workaround xbeans bug, force attributes to go to the end
Revision Changes Path
1.7 +12 -12 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BindingType.java 7 Nov 2003 22:28:28 -0000 1.6
+++ BindingType.java 13 Nov 2003 01:37:07 -0000 1.7
@@ -87,18 +87,18 @@
XmlName.forString(node.getXmlcomponent()));
}
- /**
- * 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.xml.xmlbeans.bindingConfig.BindingType write(org.apache.xml.xmlbeans.bindingConfig.BindingType node)
- {
- node = (org.apache.xml.xmlbeans.bindingConfig.BindingType)node.changeType(kinds.typeForClass(this.getClass()));
- node.setJavatype(btName.getJavaName().toString());
- node.setXmlcomponent(btName.getXmlName().toString());
- return node;
- }
+ /**
+ * 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.xml.xmlbeans.bindingConfig.BindingType write(org.apache.xml.xmlbeans.bindingConfig.BindingType node)
+ {
+ node = (org.apache.xml.xmlbeans.bindingConfig.BindingType)node.changeType(kinds.typeForClass(this.getClass()));
+ node.setJavatype(btName.getJavaName().toString());
+ node.setXmlcomponent(btName.getXmlName().toString());
+ return node;
+ }
public final BindingTypeName getName()
{
1.4 +3 -2 xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/ByNameBean.java
Index: ByNameBean.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/ByNameBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ByNameBean.java 7 Nov 2003 22:28:28 -0000 1.3
+++ ByNameBean.java 13 Nov 2003 01:37:07 -0000 1.4
@@ -103,7 +103,8 @@
*/
protected org.apache.xml.xmlbeans.bindingConfig.BindingType write(org.apache.xml.xmlbeans.bindingConfig.BindingType node)
{
- org.apache.xml.xmlbeans.bindingConfig.ByNameBean bnNode = (org.apache.xml.xmlbeans.bindingConfig.ByNameBean)super.write(node);
+ org.apache.xml.xmlbeans.bindingConfig.ByNameBean bnNode =
+ (org.apache.xml.xmlbeans.bindingConfig.ByNameBean)super.write(node);
for (Iterator i = props.iterator(); i.hasNext(); )
{
QNameProperty qProp = (QNameProperty)i.next();
@@ -112,7 +113,7 @@
}
return bnNode;
}
-
+
/**
* Returns an unmodifiable collection of QNameProperty objects.
*/
1.9 +20 -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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Java2Schema.java 12 Nov 2003 04:06:33 -0000 1.8
+++ Java2Schema.java 13 Nov 2003 01:37:07 -0000 1.9
@@ -60,6 +60,8 @@
import org.w3.x2001.xmlSchema.*;
import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
/**
* Transforms a set of JClasses into a BTS and a schema. This is really just
@@ -184,6 +186,7 @@
//FIXME this is going to have to change to take inheritance into account
JProperty props[] = clazz.getProperties();
Group xsdSequence = null;
+ List attributes = null;
for(int i=0; i<props.length; i++) {
if (props[i].getGetter() == null || props[i].getSetter() == null) {
continue; // we can only deal with read-write props
@@ -221,12 +224,23 @@
xsdElement.setName(propName);
xsdElement.setType(getBuiltinTypeNameFor(props[i].getType()));
} else {
- Attribute xsdAtt = xsdType.addNewAttribute();
+ Attribute xsdAtt = Attribute.Factory.newInstance();
qprop.setAttribute(true);
xsdAtt.setName(propName);
xsdAtt.setType(getBuiltinTypeNameFor(props[i].getType()));
+ if (attributes == null) attributes = new ArrayList();
+ attributes.add(xsdAtt);
}
}
+ // No add the attributes that we saved in the list to the xsdType.
+ // This is a hack around an xbeans bug in which the sequences and
+ // attributes are output in the order in which they were added (the
+ // schema for schemas says the attributes always have to go last).
+ if (attributes != null) {
+ Attribute[] atts = new Attribute[attributes.size()];
+ attributes.toArray(atts);
+ xsdType.setAttributeArray(atts);
+ }
// check to see if they want to create a root elements from this type
JAnnotation[] anns = clazz.getAnnotations(TAG_CT_ROOT);
for(int i=0; i<anns.length; i++) {
@@ -237,6 +251,11 @@
// the binding file here
}
return bindType;
+ }
+
+
+ private void addAttributeFor(QNameProperty prop) {
+
}
//REVIEW seems like having this functionality in jam (getters w/defaults)
1.5 +6 -7 xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc/JDClassLoaderFactory.java
Index: JDClassLoaderFactory.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc/JDClassLoaderFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JDClassLoaderFactory.java 12 Nov 2003 04:06:34 -0000 1.4
+++ JDClassLoaderFactory.java 13 Nov 2003 01:37:07 -0000 1.5
@@ -130,13 +130,12 @@
PrintWriter spewWriter = new PrintWriter(System.out);
JavadocResults.prepare();
- int result =
- com.sun.tools.javadoc.Main.execute("JAM",
- spewWriter,
- spewWriter,
- spewWriter,
- this.getClass().getName(),
- args);
+ int result = com.sun.tools.javadoc.Main.execute("JAM",
+ spewWriter,
+ spewWriter,
+ spewWriter,
+ this.getClass().getName(),
+ args);
RootDoc root = JavadocResults.getRoot();
if (result != 0 || root == null) {
spewWriter.flush();
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org