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 2008/03/14 09:17:24 UTC

[jira] Commented: (TUSCANY-2080) XML Helper Load method fails to return SDO generated class when using the method that takes a java.xml.transform.Source

    [ https://issues.apache.org/jira/browse/TUSCANY-2080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578643#action_12578643 ] 

Kelvin Goodson commented on TUSCANY-2080:
-----------------------------------------

This symptom is seen when there is a mismatch between the input XML and the registered metadata;  usually because the metadata isn't registered.  Here you have registered the metadata,  so we need to see the XML that is being delivered by the DOMSource,  and the metadata that is being used to generate the static classes.   In particular the namespace URI and root element name of the input document must match a global element in the defining schema,  or the type of the root element must be defined by an xsi:type attribute.  Please can you post the input doc and schema,  or create a simulation if you are not able to post those?

I suspect this is not a bug in Tuscany.   It may be better to continue this discussion on the tuscany-user mailing list if you didn't mind,  with a link to the JIRA,  then the user community will find it easier to benefit from this discussion.

> XML Helper Load method fails to return SDO generated class when using the method that takes a java.xml.transform.Source
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-2080
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2080
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: Windows XP
>            Reporter: Jason Dixon
>
> When trying to go from a Document object to a Generated Object using the XML helper only AnyTypeDataObject is being returned. The other SDO operations function propperly. For exampl if I marshall the Document to String and then use the XML load method that takes a string, the correct generated sdo instance is return. Please see the source code example below.
> Thanks in advance!
> 		try {
> 			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
> 			factory.setNamespaceAware(true);
> 			
> 			DocumentBuilder builder = factory.newDocumentBuilder();
> 			System.out.println("Builder is namespace aware " + builder.isNamespaceAware());
> 			
> 			Document dom = builder.parse(new File("results.xml"));		
> 			
> 			//Create a scope and register
> 			HelperContext scope = HelperProvider.getDefaultContext();
> 			DomainFactoryImpl.INSTANCE.register(scope);
> 			//Now load from dom to object
> 			DOMSource source = new DOMSource(dom);
> 			XMLDocument xml = scope.getXMLHelper().load(source, null, null);
> 			Object clazz = xml.getRootObject();
> 			System.out.println(clazz);
> 			
> 		} catch (FactoryConfigurationError e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		} catch (ParserConfigurationException e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		} catch (SAXException e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		} catch (IOException e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}

-- 
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