操作XML檔案

2021-04-27 07:42:17 字數 966 閱讀 2081

1)操作xml檔案的類庫位於system.xml命名空間下

xmlnode:是乙個抽象類,代表乙個節點。其中document,element,attribute,text 等都是特定的節點型別。注意其實現的幾個介面。xmlnodelist是乙個比較有用的集合類

xmldocument:代表乙個dom文件。

xmllinkednode: gets the node immediately preceding or following this node。 表示node之間的關聯性

xmlelement:代表乙個元素。他可以包含子元素和屬性。 元素是一種特殊的node節點。

xmlcharacterdata:provides text manipulation methods that are used by several classes

xmlreader:represents a reader that provides fast, non-cached, forward-only access to xml data.

xmlwriter:represents a writer that provides a fast, non-cached, forward-only means of generating streams or files containing xml data.

3)各個類的主要作用。

xmlelement:在xmlnode的基礎上提供一些element特有的方法,如setattribute(),removeattribute()等

Xml檔案操作

using system using system.text using system.xml class xmloperate private void readxmlfile string filename private void addelement xmldocument xmldocum...

操作XML檔案

操作函式 require rexml document require pathname include rexml filepath file.join pathname.new file.dirname file realpath,book.xml 建立乙個檔案物件 input file.new...

Python操作XML檔案 XML概述

xml 可擴充套件標置語言,為html 超文字標置語言 的補充。html用於顯示資料,而xml用於傳輸和儲存資料 一.xml語法 xml檔案通常分為兩部分 檔案宣告和檔案主體 檔案宣告 位於第一行 version標明此檔案所用的標準的版本號,必須要有 encoding標明此檔案中所使用的字元型別,可...