Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Export data in specific XML format
Chriz L
7y
202
1
Reply
Hello,
I have this web application running and I need to export the data in specific XML format given.
I'm giving you an example of one table to be more specific.
CREATE
TABLE
[dbo].[TEST](
[Id] [
int
] IDENTITY(1,1)
NOT
NULL
,
[Code] [
int
]
NULL
,
[A] [
decimal
](6, 2)
NULL
,
[B] [
decimal
](6, 2)
NULL
,
[C] [
decimal
](6, 2)
NULL
,
[D] [
decimal
](6, 2)
NULL
,
[E] [
decimal
](6, 2)
NULL
,
[F] [
decimal
](6, 2)
NULL
,
[G] [
decimal
](6, 2)
NULL
,
[H] [
decimal
](6, 2)
NULL
,
CONSTRAINT
[PK_TEST]
PRIMARY
KEY
CLUSTERED([Id]
ASC
))
Each column belongs to a group. Group A (A,B,C,D), group B (E,F), group C(G,H).
The XML output must be like the following:
<
table
t
=
"TEST"
>
<
group
g
=
"A"
>
<
u
val
=**column code value**
>
<
col
c
=
"A"
>
<
value
>
**value of column A**
</
value
>
</
col
>
<
col
c
=
"B"
>
<
value
>
**value of column B**
</
value
>
</
col
>
<
col
c
=
"C"
>
<
value
>
**value of column C**
</
value
>
</
col
>
<
col
c
=
"D"
>
<
value
>
**value of column D**
</
value
>
</
col
>
</
u
>
</
group
>
<
group
g
=
"B"
>
<
u
val
=**column code value**
>
<
col
c
=
"E"
>
<
value
>
**value of column E**
</
value
>
</
col
>
<
col
c
=
"F"
>
<
value
>
**value of column F**
</
value
>
</
col
>
</
u
>
</
group
>
<
group
g
=
"C"
>
<
u
val
=**column code value**
>
<
col
c
=
"G"
>
<
value
>
**value of column G**
</
value
>
</
col
>
<
col
c
=
"H"
>
<
value
>
**value of column H**
</
value
>
</
col
>
</
u
>
</
group
>
</
table
>
Any ideas how to create the XML?
Thank you in advance.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
datatable datakeys
Load Image faster in asp.net