Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: returned XML


Message #1 by renevazquez@c... on Fri, 21 Jun 2002 09:24:00 -0400
     I defined a Typed dataset called dsRMA wich is defined in the schema 
     showed at the end:
     
     
     But when I Use the GetXml method to retrieve the dataset content as 
     xml I get the result in a format that is not the same of my schema.
     
     My question is why the xml returned do not conform to the schema 
     defined. i don't know if I have to do something extra to extract the 
     correct xml representation from the dataset.
     
     
     this is the code that i use to get the xml
     
     public dsPart data
     data.Namespace = "";
     return data.GetXml();
     
     
     and I get this:
     
     <dsRMA>
     <Table>
     <RMAId>4</RMAId>
     <descr>test</descr>
     <configNo>1</configNo>
     <serialNo>1</serialNo>
     <userId>rene</userId>
     <saleOrdNo>1</saleOrdNo>
     </Table>
     <Table>
     <RMAId>4</RMAId>
     <partNo>x1</partNo>
     <qtty>1</qtty>
     <failId>1</failId>
     <repairId>1</repairId>
     </Table>
     <Table>
     <RMAId>4</RMAId>
     <partNo>x2</partNo>
     <qtty>2</qtty>
     <failId>1</failId>
     <repairId>1</repairId>
     </Table>
     </dsRMA>
     
     instead of what of course would be the correct result, because in my 
     schema I define that I want that the element Table (I don't know why 
     is returned with this name) is RMA and the details must be nested 
     inside the RMA element:
     
     <dsRMA>
     <RMA>
     <RMAId>4</RMAId>
     <descr>test</descr>
     <configNo>1</configNo>
     <serialNo>1</serialNo>
     <userId>rene</userId>
     <saleOrdNo>1</saleOrdNo>
     
     <RMADetails>
     <partNo>x1</partNo>
     <qtty>1</qtty>
     <failId>1</failId>
     <repairId>1</repairId>
     </RMADetails>
     <RMADetails>
     <partNo>x2</partNo>
     <qtty>2</qtty>
     <failId>1</failId>
     <repairId>1</repairId>
     </RMADetails>
     
     </RMA>
     </dsRMA>
     
     
     If anyone knows how can I make that the returned xml is with the 
     desired structure, the help would be great!!
     
     Thanks a Lot.
     
     
     
     
     ***Schema
     
     <?xml version="1.0" encoding="utf-8" ?>
     <xs:schema id="dsPart" targetNamespace="http://tempuri.org/dsPart.xsd" 
     elementFormDefault="qualified" attributeFormDefault="qualified" 
     xmlns="http://tempuri.org/dsPart.xsd" 
     xmlns:mstns="http://tempuri.org/dsPart.xsd" 
     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
     <xs:element name="dsPart" msdata:IsDataSet="true">
     <xs:complexType>
     <xs:choice maxOccurs="unbounded">
     <xs:element name="Part">
     <xs:complexType>
     <xs:sequence>
     <xs:element 
     name="partNo" type="xs:string" />
     <xs:element 
     name="descr" type="xs:string" />
     <xs:element 
     name="price" type="xs:decimal" />
     <xs:element 
     name="ret" type="xs:boolean" />
     <xs:element 
     name="sentaiCode" type="xs:string" />
     </xs:sequence>
     </xs:complexType>
     </xs:element>
     </xs:choice>
     </xs:complexType>
     <xs:unique name="dsPartKey1" msdata:PrimaryKey="true">
     <xs:selector xpath=".//mstns:Part" /> <xs:field xpath="mstns:partNo" 
     />
     </xs:unique>
     </xs:element>
     </xs:schema>


  Return to Index