如何复杂的XML转换为.NET类?转换为、复杂、XML、NET

2023-09-03 05:29:11 作者:想你的夜~

我有这样的 XML ,只是想知道我怎么能转换成 C#类

 < XML版本=1.0编码=UTF-8&GT?;
< TextScrollerItems的xmlns:XSD =htt​​p://www.w3.org/2001/XMLSchema的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instance>

    <项目类型=文本ID =234>
     <文字颜色=蓝>
       示例文本...
     < /文字>
    < /项目>

    <项目类型=形象ID =2456>
        <图像>
          clientLogo.png
        < /图片>
    < /项目>

    < / TextScrollerItems>
 

解决方案

给一个尝试xsd.exe工具随Visual Studio中。 下面是一些文档: http://www.$c$cproject.com/Articles/11317/From-XML-to-Strong-Types-in-C

I have this XML and just wondering how I can convert into C# class?

<?xml version="1.0" encoding="utf-8"?>
<TextScrollerItems xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <Item type="text" ID="234">
     <Text Color="Blue">
       Sample text...
     </Text>
    </Item>

    <Item type="image" ID="2456">
        <Image>
          clientLogo.png
        </Image>
    </Item>

    </TextScrollerItems>
VB.Net XML处理

解决方案

give a try to the XSD.exe tool shipped with Visual Studio. Here's some docs: http://www.codeproject.com/Articles/11317/From-XML-to-Strong-Types-in-C