EDN Admin
Well-known member
I created classes and want to generate the following xml.
<div style="color:black; background-color:white
<pre><span style="color:blue class books
{
<span style="color:blue public VersionInfo version;
[XmlAttribute(<span style="color:#a31515 "book")]
<span style="color:blue public bookinfo[] book
}
<span style="color:blue class VersionInfo
{
<span style="color:blue public <span style="color:blue string name;
}
[XmlRootAttribute(<span style="color:#a31515 "book", IsNullable = <span style="color:blue false)]
<span style="color:blue class bookinfo
{
<span style="color:blue public <span style="color:blue string name;
}
[/code]
This is what I want to get
<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 books<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >1.00<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file1<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file2<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 books<span style="color:blue >
[/code]
but in fact, I can only get xml like the following
<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 books<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >1.00<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file1<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file2<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 books<span style="color:blue >
[/code]
1. I just want <book> information is placed directly under node <books>, how to do it?
2. even if I set the Xml attribut, the <bookinfo> still cant be changed to <book>, whats wrong?
<br/>
Thanks a lot.
<br/>
View the full article
<div style="color:black; background-color:white
<pre><span style="color:blue class books
{
<span style="color:blue public VersionInfo version;
[XmlAttribute(<span style="color:#a31515 "book")]
<span style="color:blue public bookinfo[] book
}
<span style="color:blue class VersionInfo
{
<span style="color:blue public <span style="color:blue string name;
}
[XmlRootAttribute(<span style="color:#a31515 "book", IsNullable = <span style="color:blue false)]
<span style="color:blue class bookinfo
{
<span style="color:blue public <span style="color:blue string name;
}
[/code]
This is what I want to get
<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 books<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >1.00<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file1<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file2<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 books<span style="color:blue >
[/code]
but in fact, I can only get xml like the following
<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 books<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >1.00<span style="color:blue <<span style="color:#a31515 number<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 version<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file1<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 name<span style="color:blue >file2<span style="color:blue </<span style="color:#a31515 name<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 bookinfo<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 book<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 books<span style="color:blue >
[/code]
1. I just want <book> information is placed directly under node <books>, how to do it?
2. even if I set the Xml attribut, the <bookinfo> still cant be changed to <book>, whats wrong?
<br/>
Thanks a lot.
<br/>
View the full article