如何在c#中使用XML

编程入门 行业动态 更新时间:2024-10-25 06:33:49
本文介绍了如何在c#中使用XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在我的应用程序中使用xml woking xml是

I want to use an xml in my application the woking xml is

<pre>rasol.Send("<iq to='" + textBox1.Text + "@jabber' type='get' id='mir635'><query xmlns='jabber/protocol/profile'/></iq>");

但我的文本框已经包含完整的JID,如jid@jabber所以我删除了@ jabber 因为我删除它后xml停止工作。

But my textbox already contained full JID like jid@jabber so i removed "@jabber" since i removed it the xml is stopped working.

project.Send("<iq to='" + textBox1.Text + "' type='get' id='mir653'><query xmlns='jabber/protocol/profile'/></iq>");

i认为''

i think there is some error in ' "

推荐答案

有一些错误.NET FCL提出了使用XML的不同方法,你应该更好熟悉,所有这些。这是我对他们的简短概述: .NET FCL suggests different ways of working with XML which you should better be familiar with, all of them. This is my short overview of them:
  • 使用 System.Xml.XmlDocument class 。它实现了DOM接口;如果文档的大小不是太大,这种方式是最简单和最好的。参见 msdn.microsoft/en-us/library/system.xml.xmldocument.aspx [ ^ ]。
  • 使用类 System.Xml.XmlTextWriter 和 System.Xml.XmlTextReader ;这是最快的阅读方式,特别是你需要跳过一些数据。参见 msdn.microsoft/en-us/library/system.xml.xmlwriter.aspx [ ^ ], msdn.microsoft/en-us/library/system.xml.xmlreader.aspx [ ^ ]。
  • 使用类系统.Xml.Linq.XDocument ;这是类似于 XmlDocument 的最合适的方式,支持LINQ to XML Programming。参见 msdn.microsoft/en-us/library/system.xml.xmldocument.aspx [ ^ ],msdn.microsoft/en-us/library/bb387063.aspx [ ^ ]。
  • Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.See msdn.microsoft/en-us/library/system.xml.xmldocument.aspx[^].
  • Use the classes System.Xml.XmlTextWriter and System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.See msdn.microsoft/en-us/library/system.xml.xmlwriter.aspx[^], msdn.microsoft/en-us/library/system.xml.xmlreader.aspx[^].
  • Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.See msdn.microsoft/en-us/library/system.xml.xmldocument.aspx[^], msdn.microsoft/en-us/library/bb387063.aspx[^].
  • -SA

    更多推荐

    如何在c#中使用XML

    本文发布于:2023-11-03 06:40:56,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1554474.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如何在   XML

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!