[ 
https://issues.apache.org/jira/browse/TUSCANY-2080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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]

Reply via email to