[ 
https://issues.apache.org/jira/browse/TUSCANY-1358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506437
 ] 

lizhantao commented on TUSCANY-1358:
------------------------------------

related source:
if ( !xsdHelper.isXSD( dataType ) )
            {
                if ( dataType.isDataType() )
                {
                    schemaTypeName =  buildSimpleSchemaType(dataType);
                }
                else
                {
                    schemaTypeName =  buildComplexSchemaType(dataType);
                }
            }
            else
            {
                throw new IllegalArgumentException("Cannot generate XSD since 
SDO Type '" + 
                        dataType.getName() + "' was orginally generated from 
XSD.  Use original XSD");
            }

> Exception in thread "main" java.lang.IllegalArgumentException: Cannot 
> generate XSD since SDO Type 'item' was orginally generated from XSD.  Use 
> original XSD
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1358
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1358
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-beta1
>            Reporter: lizhantao
>            Priority: Blocker
>             Fix For: Java-SDO-1.0
>
>
> package com.hollycrm.sdo;
> import java.io.FileWriter;
> import java.io.Writer;
> import java.util.Iterator;
> import java.util.List;
> import org.apache.tuscany.samples.sdo.SdoSampleConstants;
> import org.apache.tuscany.sdo.util.SDOUtil;
> import commonj.sdo.Type;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.TypeHelper;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.helper.XSDHelper;
> public class POXSDTest {
>       public static void main(String[]argv)throws Exception{
>               HelperContext hc = SDOUtil.createHelperContext(true);
>               
>               
> hc.getXSDHelper().define(ClassLoader.getSystemResourceAsStream("po.xsd"), 
> null);           
>               List allTypes = SDOUtil.getTypes(hc.getTypeHelper(), 
> "http://www.example.com/PO";);
>               removeDocumentRootType(allTypes);
>               String xsd = hc.getXSDHelper().generate(allTypes);
>               Writer w = new FileWriter("po2.xsd");
>               w.write(xsd);
>       }
>       /**
>        * eliminate a bug
>        * @param allTypes
>        */
>       private static void removeDocumentRootType(List allTypes) {
>               for (Iterator iter = allTypes.iterator(); iter.hasNext();) {
>                       Type t = (Type) iter.next();
>                       if ("DocumentRoot".equals(t.getName())) {
>                               iter.remove();
>                               continue;
>                       }
>                       
>               }
>       }
> }
> ----------------------------console out-----------------------------------
> Exception in thread "main" java.lang.IllegalArgumentException: Cannot 
> generate XSD since SDO Type 'item' was orginally generated from XSD.  Use 
> original XSD
>       at 
> org.apache.tuscany.sdo.helper.XSDHelperImpl.generate(XSDHelperImpl.java:291)
>       at 
> org.apache.tuscany.sdo.helper.XSDHelperImpl.generate(XSDHelperImpl.java:235)
>       at com.hollycrm.sdo.POXSDTest.main(POXSDTest.java:24)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to