如何在Vb .net中反序列化以下xml [英] How to deserialize the following xml in Vb .net

查看:48
本文介绍了如何在Vb .net中反序列化以下xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0"?>
<root>
<Products>
    <Product>
        <Id>123 1234 1237</pin>
        <slno></slno>
        <message>test message</message>
    </Product>
    <Product>
        <Id>123 1234 1238</pin>
        <slno></slno>
        <message>test message</message>
    </Product>
</Products>

推荐答案

学会自己动手:如何:在Visual Basic .NET中序列化和反序列化 [ ^ ]
Learn to do it yourself: HOW TO: Serialize and Deserialize XML in Visual Basic .NET[^]


<Id>123 1234 1237</pin>

此行表明您不能使用方便的框架类,因为这是错误的XML:必须使用< / Id>关闭< Id> 标记; ,无法使用< / pin> 关闭。

如果您要创建错误的XML,请修改编写代码的代码。如果它是由ThirdParty生成的,wtf ...你可能必须编写自己的代码来手动解析文件并生成类。

This line shows that you cannot use the convenient classes of the framework because that is wrong XML: the <Id> tag must be closed with </Id>, it cannot be closed with </pin>.
If it was you to create that wrong XML, fix the code for writing it. If it was produced by ThirdParty, wtf... you'll likely have to write your own code for manually parsing the file and generating the classes.


这篇关于如何在Vb .net中反序列化以下xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆