Hi ,
Will you please try the example with latest SDO and DAS code from svn trunk,

There are some differences in DAS-beta1 (older releases) and the current one
from
https://svn.apache.org/repos/asf/incubator/tuscany/java/. These differences
are due to some
changes in SDO. With the latest one, I am getting something like below-
for
System.out.println(XMLHelper.INSTANCE.save(((DataObject)customers.iterator().next()),
"cust1", "cust1"));

Result -

<?xml version="1.0" encoding="ASCII"?>
<cust1:cust1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:cust1="cust1"
    xmlns:this="http:///org.apache.tuscany.das.rdb.test/customer.xsd";
xsi:type="this:Customer">
  <ID>1</ID>
  <lastName>Williams</lastName>
  <address>1212 foobar lane</address>
</cust1:cust1>

Are you using DAS-beta1?

Regards,
Amita
On 9/6/07, Eborn, Eric D <[EMAIL PROTECTED]> wrote:
>
> I came across this excellent article about how to do basics with SDO
> including writing out a datagraph to an XML document.
>
> http://www.ibm.com/developerworks/xml/library/ws-sdoxmlschema/index.html
>
> What I wish to do is similar, I wish to read data from a MySQL database
> using RDB DAS and then store that information into an XML file using
> XMLHelper (I suppose this is the preferred way).  This XML data will
> eventually be destined for a JMS message for export to its destination.
>
> I'm building off of the sample Customers for now until I get a working
> model...
>
> So far I've added this code to my Customer sample code:
>
>         private void outputXML() throws Exception {
>
>          Command readAll = das.getCommand("AllCustomers");
>          CUSTOMER = readAll.executeQuery();
>          DataObject resultSet =
> DataFactory.INSTANCE.create(RES_NAMESPACE, "resultSetType");
>
>                 OutputStream stream = new FileOutputStream(RES_XML);
>
>                 List allCustomers = CUSTOMER.getList("CUSTOMER");
>                 int i = 1;
>                 for(i=0; i<allCustomers.size(); i++)
>                 {
>
> XMLHelper.INSTANCE.save((DataObject)allCustomers.get(i), RES_NAMESPACE,
> "CUSTOMER", stream);
>                         stream.write(13);                       //writes
> a carraige return to the XML file.
>                         stream.write(10);
>                 }
>
>         }
>
> This does generate an XML file, but its contents are all wrong...  I
> want it to follow the XSD:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns="http://www.example.com/RESULTSET";
> targetNamespace="http://www.example.com/RESRESULTSET";>
>
>     <xsd:element name="CUSTOMER" type="resultSetType"/>
>
>     <xsd:complexType name="resultSetType">
>         <xsd:sequence>
>             <xsd:element name="LASTNAME" type="xsd:string"/>
>             <xsd:element name="ADDRESS" type="xsd:string"/>
>             <xsd:element name="ID" type="xsd:positiveInteger"/>
>         </xsd:sequence>
>     </xsd:complexType>
>
> </xsd:schema>
>
> But my program outputs:
> <?xml version="1.0" encoding="ASCII"?>
> <resSS:CUSTOMER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:das="http:///org.apache.tuscany.das.rdb/das";
>     xmlns:resSS="http://www.example.com/resSS"; xsi:type="das:CUSTOMER"
>     ID="1" LASTNAME="John" ADDRESS="USA"/>
> <?xml version="1.0" encoding="ASCII"?>
> <resSS:CUSTOMER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:das="http:///org.apache.tuscany.das.rdb/das";
>     xmlns:resSS="http://www.example.com/resSS"; xsi:type="das:CUSTOMER"
>     ID="2" LASTNAME="BlueBerry" ADDRESS="INDIA"/>
> <?xml version="1.0" encoding="ASCII"?>
> <resSS:CUSTOMER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:das="http:///org.apache.tuscany.das.rdb/das";
>     xmlns:resSS="http://www.example.com/resSS"; xsi:type="das:CUSTOMER"
>     ID="3" LASTNAME="Patrick" ADDRESS="UK"/>
> <?xml version="1.0" encoding="ASCII"?>
> <resSS:CUSTOMER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:das="http:///org.apache.tuscany.das.rdb/das";
>     xmlns:resSS="http://www.example.com/resSS"; xsi:type="das:CUSTOMER"
>     ID="4" LASTNAME="Jane" ADDRESS="UN"/>
> <?xml version="1.0" encoding="ASCII"?>
> <resSS:CUSTOMER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:das="http:///org.apache.tuscany.das.rdb/das";
>     xmlns:resSS="http://www.example.com/resSS"; xsi:type="das:CUSTOMER"
>     ID="5" LASTNAME="Jenny" ADDRESS="USA"/>
>
> I'm hoping that someone has done something similar and could point me in
> the right direction because at the moment im generating content for 5
> different xml files into one file, when I'd like to have all the rows of
> data contained in one xml file in the format:
>
> <XML>
> <CUSTOMER>
>         <ID>1</ID>
>         <LASTNAME>John</LASTNAME>
>         <ADDRESS>USA</ADDRESS>
> </CUSTOMER>
> <CUSTOMER>
>         <ID>2</ID>
>         <LASTNAME>Blueberry</LASTNAME>
>         <ADDRESS>India</ADDRESS>
> </CUSTOMER>
>
> Etc...
>
> Thanks
> Eric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to