[ 
http://issues.apache.org/jira/browse/TUSCANY-696?page=comments#action_12433204 
] 
            
Robbie Minshall commented on TUSCANY-696:
-----------------------------------------

As Paul points out the XMLDocumentTestCase.xml defines the schema location for 
http://www.example.com/xmlDocumentSchemaLocation as  
/XMLDocumentSchemaLocation.xsd.

It seems that one good candidate for the issue you are facing here is that the 
root data object is being defined as Type AnyTypeDataObject rather than 
purchaseReport Type as defined in the XMLDocumentSchemaLocation.xsd.  

If I define the types in this xsd explicidly ( hey there spelling ) prior to 
running my junit test I get the following result
List xsdTypes = XSDHelper.INSTANCE.define(getClass()
                                        
.getResourceAsStream("/XMLDocumentSchemaLocation.xsd"), null);
                        

***************RESULT AFTER DEFINING TYPES
<?xml version='1.0' encoding='UTF-8'?><sl:purchaseReport 
periodEnding="2007-12-31" 
xsi:noNamespaceSchemaLocation="/XMLDocumentNoNamespaceSchemaLocation.xsd" 
xsi:schemaLocation="http://www.example.com/xmlDocumentSchemaLocation   
/XMLDocumentSchemaLocation.xsd   http://www.example.com/open    /open.xsd" 
xmlns:sl="http://www.example.com/xmlDocumentSchemaLocation"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <sl:schemaLocationElement>some string</sl:schemaLocationElement>
  <aNoNamespaceSchemaLocationElement date="2006-04-01">
    <anElement>another string</anElement>
  </aNoNamespaceSchemaLocationElement>
</sl:purchaseReport>

=========
Now run the same file with SDO to StaX adapter (XMLStreamHelper): 
xsd defined 2types
        aNoNamespaceSchemaLocationElement
        DocumentRoot
xsd defined 2types
        DocumentRoot
        purchaseReport
Type of rootObject purchaseReport
<p0:purchaseReport periodEnding="2007-12-31"><p0:schemaLocationElement>some 
string</p0:schemaLocationElement><aNoNamespaceSchemaLocationElement 
date="2006-04-01" xmlns=""><anElement>another 
string</anElement></aNoNamespaceSchemaLocationElement>

******************************

This is looking way closer to what we want.  

PROBLEM: 
When an xml file inlines the definition of a schema for a uri the Types within 
this schema shoudl get defined within the type helper.  This is tricky as what 
scope ( TypeHelper scope ) should this be defined on ?

ACTION:
I will post to the dev list to discuss this issue then provide a fix.








> XMLStreamHelper usage
> ---------------------
>
>                 Key: TUSCANY-696
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-696
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>         Environment: Windows XP, java version "1.5.0_07" Java(TM) 2 Runtime 
> Environment, Standard Edition (build 1.5.0_07-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
>            Reporter: Scott Boag
>         Attachments: robbieResults_1.txt, SimpleRun2.java, 
> XMLDocumentNoNamespaceSchemaLocation.xsd, XMLDocumentTestCase.xml
>
>
> Not sure if this is a bug or user problem or both.  I am trying to work on a 
> generic lossless adapter from SDO to a XML data model, without intervening 
> serialization.
> I'm running the following code:
>               XMLHelper xmlHelper = XMLHelper.INSTANCE;
>               XSDHelper xsdHelper = XSDHelper.INSTANCE;
>               TypeHelper typeHelper = TypeHelper.INSTANCE;
>               URL url = SimpleRun2.class.getClassLoader().getResource(
>                               NNS_SCHEMA_LOCATION);
>               List xsdTypes = xsdHelper
>                               .define(url.openStream(), url.toExternalForm());
>               // InputStream is = new FileInputStream(TEST_XML_DOCUMENT);
>               URL testxmlURL = SimpleRun2.class.getClassLoader().getResource(
>                               TEST_XML_DOCUMENT);
>               XMLDocument doc = xmlHelper.load(testxmlURL.openStream());
>               DataObject rootobj = doc.getRootObject();
>               // typeHelper.define(xsdTypes);
>               XMLStreamHelper xmlStreamHelper = SDOUtil
>                               .createXMLStreamHelper(typeHelper);
>               XMLStreamReader streamReader = xmlStreamHelper
>                               .createXMLStreamReader(rootobj);
>               xmlStreamReader2XmlText(streamReader, System.out);
> (xmlStreamReader2XmlText is just a utility method I lifted from somewhere)
> Raymond told me in a private exchange that I needed to do 
> "TypeHelper.INSTANCE.define(InputStream xsd, String schemaLocation); " 
> (though that implies that I know ahead of time the schema). Since TypeHelper 
> doesn't have a define that takes the schema, I assume the above is what he 
> meant.  If I pass the result of the xsdHelper.define to typeHelper.define, it 
> crashes in spectacular ways.
> When I run this code, the result is:
> <p0:AnyTypeDataObject>
> Which is clearly wrong.  I've included the complete program.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to