473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Splitting and Renaming Xml Nodes

Hi,

Please suggest a solution for the following problem.

We get a input xml that need to be processed for grouping and sorting.
The example of one such xml

<Requests>
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>

</Requests>

To obtain some sorting and grouping kind of thing we need to split this xml
as follwoing

<RequestsNew --Xml Node Name changed
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
</Results>
</Request>

<Request>
......
<Results>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>
</Requests>

If the type is different we need to make them as seperate requests,if the
<typeis same we need to maintain the original xml structure.

Please tell me a solution for this.
--
Guhan
Mar 1 '07 #1
1 2198
Read about the Muenchian grouping method -- essentially you need to
determine all <Typeelements with different values and from this node-set
then generate the new xml document -- this is so easy and straightforward.

http://www.jenitennison.com/xslt/grouping/muenchian.xml
Cheers,
Dimitre Novatchev.
"Guhanath" <Gu******@discussions.microsoft.comwrote in message
news:76**********************************@microsof t.com...
Hi,

Please suggest a solution for the following problem.

We get a input xml that need to be processed for grouping and sorting.
The example of one such xml

<Requests>
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>

</Requests>

To obtain some sorting and grouping kind of thing we need to split this
xml
as follwoing

<RequestsNew --Xml Node Name changed
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
</Results>
</Request>

<Request>
......
<Results>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>
</Requests>

If the type is different we need to make them as seperate requests,if the
<typeis same we need to maintain the original xml structure.

Please tell me a solution for this.
--
Guhan

Mar 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William Ahern | last post by:
I'm looking for resources on splitting and merging XML trees. Specifically, on methods to pare large XML documents into smaller documents which can be merged later. Off of the top of my head, I...
5
by: Adam Barr | last post by:
I have a tag foo that I want to copy unchanged when it is a subtag of bar, so I have a template (x is the namespace for the document): <xsl:template match="x:bar/x:foo"> <xsl:copy>...
0
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
1
by: pjeung | last post by:
Say that I have an element <elementA> that has several layers of subelements. In System.Xml.XmlDocument and related classes, how do I rename <elementA> to <elementB> leaving the subelements intact?
13
by: James Conrad St.John Foreman | last post by:
One of the larger tables in our database is now 6.8 million rows (1 per financial transaction since 2000). Every time an amendment is made to a booking, new rows are added to the table for each...
8
by: BillCo | last post by:
I'm updating a legacy app with table naming that makes baby jesus cry. It's a bit of a spider web though... no telling when and where the tables will be called by name. So I wrote this for renaming...
4
by: nikila | last post by:
Hi, I am trying to split large xml files to smaller xml files using c#.net. can you please provide any sample code for this? I have to split the file if the size is more than 10 MB. Also, xml...
29
by: Andrea | last post by:
I want to write a program that: char * strplit(char* str1, char *str2, char * stroriginal,int split_point) that take stroriginal and split in the split_point element of the string the string...
2
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to...
1
by: Nevgar | last post by:
I am fairly new to php / MySQL and have a problem with a query and an insert. I have a database that maybe isn't the best design - it includes a field "Former Names" which is varchar 255. It...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.