如何使用C#在asp.net中的这种xml类型中“添加"/编辑/删除记录 [英] how to "Add"/edit/delete record in this type of xml in asp.net with C#

查看:80
本文介绍了如何使用C#在asp.net中的这种xml类型中“添加"/编辑/删除记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,
我是xml的新手,我对xml的了解很少.请任何人帮助我在Xml文件Record上添加/编辑/删除.
此XML文件包含图库数据.
用户可以在xml文件中添加,编辑,删除记录.使用基于Web的图形环境.

用户可以添加新类别,还可以编辑和删除任何类别.

我想在xml文件中编辑那些零件类型.

Please help me,
I am new on xml and i know little information in xml. Please any one help me to Add/ Edit/ Delete on Xml file Record.
This XML File Contain Gallery Data.
User can want to add, edit, delete record in xml file. using a web base graphical environment.

user can add new Category, and edit and delete any category.

i want to edit those part type in xml file.

<category name="GIET Building">
        <image>
            <date>12.31.2011</date>
            <title>GIET Gallery</title>
            <desc>GIET Gallery</desc>
            <thumb>building1.JPG</thumb>
            <img>building1.JPG</img>
        </image>
        <image>
            <date>12.31.2011</date>
            <title>GIET Gallery</title>
            <desc>GIET Gallery</desc>
            <thumb>building2.jpg</thumb>
            <img>building2.jpg</img>
        </image>
        </category>



这是xml源文件,其中包含这些类型的数据.



this is xml source file contain these type of data.

<gallery title="GIET Album" thumbDir="gallery/thumb/" imageDir="gallery/" random="true">
    <category name="GIET Building">
        <image>
            <date>12.31.2011</date>
            <title>GIET Gallery</title>
            <desc>GIET Gallery</desc>
            <thumb>building1.JPG</thumb>
            <img>building1.JPG</img>
        </image>
        <image>
            <date>12.31.2011</date>
            <title>GIET Gallery</title>
            <desc>GIET Gallery</desc>
            <thumb>building2.jpg</thumb>
            <img>building2.jpg</img>
        </image>
        </category>
        <category name="Receiption">
        <image>
            <date>12.31.2011</date>
            <title>GIET Gallery</title>
            <desc>GIET Gallery</desc>
            <thumb>reception1.JPG</thumb>
            <img>reception1.JPG</img>
        </image>
        </category>


</gallery>


</gallery>

推荐答案



请尝试System.Xml;

您可以使用XmlTextwriter添加类别...尝试看看.

谢谢,
Sriniavs
Hi,

Please try System.Xml;

you can use XmlTextwriter for adding categories... try and see.

Thanks,
Sriniavs


这篇关于如何使用C#在asp.net中的这种xml类型中“添加"/编辑/删除记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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