Use namespace prefixes from XSD during serialization
----------------------------------------------------

                 Key: TUSCANY-830
                 URL: http://issues.apache.org/jira/browse/TUSCANY-830
             Project: Tuscany
          Issue Type: Improvement
          Components: Java SDO Implementation
    Affects Versions: Java-Mx
            Reporter: Fuhwei Lwo
            Priority: Minor


I just found out XMLHelper.save() method always uses the dataobject's  
namespace URI to derive its namespace prefix even the prefix has been defined 
in the XSD.

For example, I modify "xmlns:nsPrefix=nsURI" in the simple.xsd located  in the 
resource folder under sdo/impl project from  
xmlns:simple="http://www.example.com/simple"; to  
xmlns:simple="http://www.example.com/simple/1.0"; then modify 
SimpleDynamicTestCase.javato display its serialization output. Here  are the 
XSD and the 
serialization output:

*simple.xsd*

<xsd:schema
    targetNamespace="http://www.example.com/simple/1.0";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:simple="http://www.example.com/simple/1.0";>

     <xsd:element name="stockQuote" type="simple:Quote"/>
     <xsd:complexType name="Quote">
         <xsd:sequence>
            <xsd:element name="symbol" type="xsd:string"/>
            <xsd:element name="companyName" type="xsd:string"/>
            <xsd:element name="price" type="xsd:decimal"/>
            <xsd:element name="open1" type="xsd:decimal"/>
            <xsd:element name="high" type="xsd:decimal"/>
            <xsd:element name="low" type="xsd:decimal"/>
            <xsd:element name="volume" type="xsd:double"/>
            <xsd:element name="change1" type="xsd:double"/>
            <xsd:element  name="quotes" type="simple:Quote" minOccurs="0"  
maxOccurs="unbounded"/>
         </xsd:sequence>
     </xsd:complexType>
 </xsd:schema>

 *Serialization output*

 <?xml version="1.0" encoding="ASCII"?>
 <_1:stockQuote xmlns:_1="http://www.example.com/simple/1.0";>
    <symbol>fbnt</symbol>
    <companyName>FlyByNightTechnology</companyName>
    <price>1000.0</price>
    <open1>1000.0</open1>
    <low>1000.0</low>
    <volume>1000.0</volume>
    <change1>1000.0</change1>
    <quotes>
      <price>2000.0</price>
    </quotes>
 </_1:stockQuote>

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