CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    France
    Posts
    109

    question about XML form of dataset

    hi,
    i do have a dataset containing some tables (retrieved from a SQL query). when i make a myDataset.WriteXML it gives me an XML file i'd like to transform later by myself. The problem is that the XML structure is not very good, the nodes struture is not like what i'd like.
    Is there a way to customize the XML structure so that the WriteXML() gives me exactly what i want ?

    ============================
    example :

    i get this
    Code:
    	<BudgetItemXML>
    		<SERV_ServiceName>Translation</SERV_ServiceName>
    		<CAT_CategoryName>Other translation</CAT_CategoryName>
    		<BIT_ItemName>test 2                        </BIT_ItemName>
    		<PC_PriceCodeName>XltTranslatorHour</PC_PriceCodeName>
    		</BudgetItemXML>
    	<BudgetItemXML>
    		<SERV_ServiceName>Translation</SERV_ServiceName>
    		<CAT_CategoryName>Software translation</CAT_CategoryName>
    		<BIT_ItemName>test 1                        </BIT_ItemName>
    		<PC_PriceCodeName>XltSoftwareWord</PC_PriceCodeName>
    	</BudgetItemXML>
    	<BudgetItemXML>
    		<SERV_ServiceName>Translation</SERV_ServiceName>
    		<CAT_CategoryName>Software translation</CAT_CategoryName>
    		<BIT_ItemName>test 1                        </BIT_ItemName>
    		<PC_PriceCodeName>XltSoftwareWord</PC_PriceCodeName>
    	</BudgetItemXML>

    i want this :


    Code:
    <SERV_ServiceName name="Translation">
    	<CAT_CategoryName name="Other translation">
    		<BudgetItemXML>
    			<BIT_ItemName>test 2   </BIT_ItemName>
    			<PC_PriceCodeName>XltTranslatorHour</PC_PriceCodeName>
    		</BudgetItemXML>
    	</CAT_CategoryName>
    	<CAT_CategoryName name="Software translation">
    		<BudgetItemXML>
    			<BIT_ItemName>test 1 </BIT_ItemName>
    			<PC_PriceCodeName>XltSoftwareWord</PC_PriceCodeName>
    		</BudgetItemXML>
    		<BudgetItemXML>
    			<BIT_ItemName>test 1 </BIT_ItemName>
    			<PC_PriceCodeName>XltSoftwareWord</PC_PriceCodeName>
    		</BudgetItemXML>
    	</CAT_CategoryName>
    </SERV_ServiceName>

  2. #2
    Join Date
    Apr 2001
    Location
    France
    Posts
    109

    or do you think i should...

    should i creete a new typed dataset ?
    the database tables are not strutured like i want as you can see from the sample : each item is in a row with its own service category and properties. But maybe with a customs xsd file i could "force" the data to be sorted by category and service ?
    or should i take the generated XML and parse it in VB.NET to transform it (select each same node and modif the XML ...) what is the easier ? what is the better solution ?

    regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured