[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-tabpanelfocusedCommentId=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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[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-tabpanelfocusedCommentId=12578666#action_12578666 ] Kelvin Goodson commented on TUSCANY-2080: - I just re-read your report, and see that I had misunderstood a detail, apologies. So if you go via string, the correct class is generated for the root object. This does sound more like a bug. We need to create a test case, so if you can post your schema and results.xml file that would be great. 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[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-tabpanelfocusedCommentId=12578674#action_12578674 ] Kelvin Goodson commented on TUSCANY-2080: - I knocked up a quick test for this which does not fail, see the commit on the commits tab of this jira https://issues.apache.org/jira/browse/TUSCANY-2080?page=com.atlassian.jira.plugin.ext.subversion:subversion-commits-tabpanel 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[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-tabpanelfocusedCommentId=12578714#action_12578714 ] Jason Dixon commented on TUSCANY-2080: -- Kelvin, thanks for the research. After reviewing the attached example code, I realized that the only thing that could be causing the issue is the input xml. To determine what the issue was, I marshalled the Generated Object to a xml file. The generated XML was qualified to the correct namespace. The only difference between the file that works and the file that doesnt is the prefix of the namespace. I then changed the xml that didnt work to have the same prefix and of course now it works perfectly. Should the marshalling or metadata make assumptions about the prefix used to qualify the namespace in the xml document since anyone could use whatever prefix they prefer to qualify a namespace? I cant provide the project version of the code I am working on but could mock up an example if you would like to investigate this further? Thanks again for your help. 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[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-tabpanelfocusedCommentId=12578823#action_12578823 ] Kelvin Goodson commented on TUSCANY-2080: - This issue seems to be restricted to the conditions of creating the graph via a DOMSource AND the prefix is bound to the namespace. Any other prefix seems fine. If you parse a document direct from an inputstream that has the prefix, then all is well, but going via a DOMSource brings out the problem. So far I have trapped this down to the EMF XMLHelperImpl$NamespaceSupport having no table entry for the prefix. Here's the stack (I have to do other things for a while, if you can follow up at all that would be great) XMLHelperImpl$NamespaceSupport.getURI(String) line: 1419 SDOXMLResourceImpl$SDOXMLHelperImpl(XMLHelperImpl).getURI(String) line: 1253 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).getFeature(EObject, String, String, boolean) line: 2707 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).handleFeature(String, String) line: 1541 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createDocumentRoot(String, String, String, EFactory, boolean) line: 1237 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createObjectByType(String, String, boolean) line: 1165 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createTopObject(String, String) line: 1247 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).processElement(String, String, String) line: 883 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).startElement(String, String, String) line: 866 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).startElement(String, String, String, Attributes) line: 627 SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(String, String, String, Attributes) line: 405 SDOXMLResourceImpl$SDOXMLLoadImpl(XMLLoadImpl).traverse(Node, XMLLoadImpl$AttributesProxy, DefaultHandler, LexicalHandler) line: 566 SDOXMLResourceImpl$SDOXMLLoadImpl(XMLLoadImpl).traverse(Node, XMLLoadImpl$AttributesProxy, DefaultHandler, LexicalHandler) line: 538 SDOXMLResourceImpl$SDOXMLLoadImpl(XMLLoadImpl).load(XMLResource, Node, Map) line: 409 SDOXMLResourceImpl(XMLResourceImpl).doLoad(Node, Map) line: 606 SDOXMLResourceImpl(XMLResourceImpl).load(Node, Map) line: 570 XMLDocumentImpl.load(Node, Object) line: 249 XMLHelperImpl.load(Source, String, Object) line: 113 SimpleStaticTestCase.testSimpleStaticViaDomSource2() line: 114 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 Attachments: tuscany_example.zip 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
[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-tabpanelfocusedCommentId=1257#action_1257 ] Jason Dixon commented on TUSCANY-2080: -- After reading your latest comment, I update the xml to have something other than an empty string for the prefix and it works. So it appears that this issue will only occur when the namespace prefix is . I am betting there is some logic that skips the addition of the prefix and namespace if it is equal to an empty string. I will try to look at the EMF code, but since I dont have this pulled down it may take a while to get to it. I have a temporary work around for this issue where we can make sure that a prefix is declared for the namespace. Thanks for your help. I will update the issue if I am able to find the bug. 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 Attachments: tuscany_example.zip 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]