You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org> on 2007/07/06 11:41:05 UTC

[jira] Resolved: (TUSCANY-1358) Exception in thread "main" java.lang.IllegalArgumentException: Cannot generate XSD since SDO Type 'item' was orginally generated from XSD. Use original XSD

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

Kelvin Goodson resolved TUSCANY-1358.
-------------------------------------

    Resolution: Invalid

> 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org