http://www.simdesign.nl/xml.html

This software component contains a small-footprint Object Pascal (Delphi) XML implementation that allows to read and write XML documents. You basically only need one unit and you can simply add it to the "uses" clause.

You can use this software to read XML documents from files, streams or strings. The load routine generates events that can be used to display load progress on the fly. You can also use it to create and save XML documents.

Features

    • Read XML directly from stringstream or file with fast parser (1Mb/sec on 1.5GHz P3), writes to string, stream and file even faster.
    • Import of all common tags, including comments, CDATA, XML declarations and stylesheets.
    • Load from streaming media is supported; you can set up events to work with the node data while it comes in. See example 1. No need to keep the whole XML document in memory! Works well for huge documents. This is the SAX-like approach.
    • Save to file, string or stream in readablepreserve or compact format. Readable format will add linefeeds and indents to make the file readable in a text editor. Compact format sticks to the Xml specification and adds minimal control characters. Preserve format keeps the markup of the document exactly as it was.
    • Directly add blobs or streams in the XML file, they will be encoded as Binhex or Base64 (but you don't have to worry about that).
    • Many native Delphi types can be stored directly to the nodes, making this code very suitable to use while writing storage methods.
      Store and load boolean, single, double, word, integer, string, TFont, TColor, TPen, TBrush, TDateTime.
      You don't have to worry about escaping the strings; this is done automatically.
    • Loads and saves ANSI, UTF-8 as well as Unicode (UTF-16) documents and implements proper conversion warnings. Recognises streams even without byte order marks. NativeXml works internally with UTF8 encoded strings to preserve extended characters, and supports widestrings.
    • Unique feature: Store, read and create any TPersistent object to/from XML directly (see Example5). This is done by iterating through all of the objects' published properties by use of RTTI (runtime type information). This feature is only available for D5 and up.
    • New! Now you can use the binary format of NativeXml. This avoids the expensive parsing process to get the textual xml data into the document (DOM). And even better, the binary file size is much smaller, ~50% of file size with uncompressed binary files, and ~15% of the file size in zlib-compressed files. And you can use AES encryption to keep your sensitive files safe from prying eyes.
      The interface is the same whether textual xml or binary xml files are used, so you can work with binary files for speed and size purposes, then always send them to the public as normal xml files.
  // TsdElementType enumerates the different kinds of elements that can be found
// in the XML document.
TsdElementType = (
xeElement, // normal element <name {attr}> [value] [sub-elements] </name> xeAttribute, // attribute ( name='value' or name="value") : <element name='value'>....</element>

xeCharData, // character data in a node : <element>char data</element>

xeComment, // comment <!--{comment}-->

xeCData, // literal data <![CDATA[{data}]]>

xeCondSection, // conditional section <![ IGNORE / INCLUDE [ markup ]]>

xeDeclaration, // xml declaration <?xml{declaration}?>

xeStylesheet, // stylesheet <?xml-stylesheet{stylesheet}?>

xeDocType, // doctype dtd declaration <!DOCTYPE{spec}>

xeDtdElement, // dtd element <!ELEMENT >

xeDtdAttList, // dtd attlist <!ATTLIST >

xeDtdEntity, // dtd entity <!ENTITY >

xeDtdNotation, // dtd notation <!NOTATION >

xeInstruction, // processing instruction <?...?>

xeWhiteSpace, // chardata with only whitespace

xeQuotedText, // quoted text: "bla" or 'bla'

xeEndTag, // </...> and signal function in binary xml

xeError // some error or unknown
);
TsdElementTypes = set of TsdElementType;
  // End-Of-Line style
TsdEolStyle = (
esLF, // write End-Of-Line as just LF (#$0A) like normalised xml
esCRLF, // write End-Of-Line as CR + LF (#$0D + #$0A), for the windows platform
esCR // write End-Of-Line as CR (#$0D), for the mac platform
);
  // Note on TNativeXml.XmlFormat:
// - xfCompact (default) to save the xml fully compliant and at smallest size
// - xfReadable writes additional nonsignificant whitespace so the client can easily read the xml file with a standard editor.
// - xfPreserve aims to preserve whitespace data just as it is parsed
TXmlFormatType = (
xfCompact, // Save without any control chars except LF after declaration
xfReadable, // Save in readable format with indents and end-of-lines
xfPreserve // Preserve whitespace whenever possible
);
{
NativeXmlNodes:
Parsing and writing methods for XML nodes:
Attribute, CDATA, CharData, Comment, Declaration, DocType, DTD-AttList, DTD-Element, DTD-Entity, DTD-Notation, Element, (processing) Instruction, QuotedText, StyleSheet and ancestors: TXmlNode
TsdContainerNode
TsdElement
TsdDtdElement
TsdDtdAttList
TsdDtdEntity
TsdDtdNotation
TsdDocType
TsdDeclaration
TsdStyleSheet
TsdCharData
TsdQuotedText
TsdProcessingInstruction
TsdComment
TsdCData
TsdConditionalSection
TsdAttribute
}

NativeXml: A native Delphi XML parser and writer的更多相关文章

  1. 【Java规划】DOM XML Parser分解、遍历、创XML

    1.前言 DOM XML Parser简介 DOM 它是 W3C 处理 XML 规范 API,这是很多其他的 XML 地基处理相关标准,不仅是 Java,其他的,如 Javascript,PHP.MS ...

  2. PHP XML Parser

    安装 XML Parser 函数是 PHP 核心的组成部分.无需安装即可使用这些函数. PHP XML Parser 函数 PHP:指示支持该函数的最早的 PHP 版本. 函数 描述 PHP utf8 ...

  3. (转载)XML Tutorial for iOS: How To Choose The Best XML Parser for Your iPhone Project

    There are a lot of options when it comes to parsing XML on the iPhone. The iPhone SDK comes with two ...

  4. 雷林鹏分享:XML Parser

    XML Parser 所有现代浏览器都有内建的 XML 解析器. XML 解析器把 XML 文档转换为 XML DOM 对象 - 可通过 JavaScript 操作的对象. 解析 XML 文档 下面的 ...

  5. HTTP 响应实体主体:XML 及 XML parser

    本文内容 HTTP 响应实体主体:XML XML parser 总结 各编程语言实现的 XML parser   HTTP 响应实体主体:XML 实体主体(entity-body)通常是HTTP响应里 ...

  6. PHP的XML Parser(转)

    PHP处理XML文件 一.读取,更新(创建或者操作)一个XML文档,需要XML解析器 .有两种XML parsers: 1. Tree-based parser:将XML文档转化为DOM Tree结构 ...

  7. PHP XML Parser函数

    PHP XML Parser 函数 PHP XML Parser 简介 XML 函数允许您解析 XML 文档,但无法对其进行验证. XML 是一种用于标准结构化文档交换的数据格式.您可以在我们的 XM ...

  8. PHP XML Parser 函数

    PHP XML Parser 简介 XML 函数允许您解析 XML 文档,但无法对其进行验证. XML 是一种用于标准结构化文档交换的数据格式.您可以在我们的 XML 教程 中找到更多有关 XML 的 ...

  9. XML Parser Errors See Details for more Information XML Parser Error on line 1: Document root ele

    1.错误描写叙述 XML Parser Errors See Details for more Information XML Parser Error on line 1: Document roo ...

随机推荐

  1. MySQL启动很慢的原因

    我们在启动MySQL的时候,常常会遇到的是, 当执行启动命令后,它会"Start MySQL ....." 一直不停的执行,也不中断,也不成功 这里会出现此现象的原因有以下三条: ...

  2. Ubuntu下Hadoop的安装和配置

    最近又需要要搭hadoop环境,所以开始学习,下面是我的笔记,仅供大家参考! Hadoop安装: JDK1.6+ 操作系统:Linux,Window和Unix也可以做Hadoop的开发,只有Linux ...

  3. JAVA封装消息中间件调用一(kafka生产者篇)

    这段时间因为工作关系一直在忙于消息中间件的发开,现在趁着项目收尾阶段分享下对kafka的一些使用心得. kafka的原理我这里就不做介绍了,可参考http://orchome.com/kafka/in ...

  4. hdu 1597(矩阵快速幂)

    1597: 薛XX后代的IQ Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 228  Solved: 55[Submit][Status][Web Bo ...

  5. JAVA邻接矩阵实现拓扑排序

    由于一直不适用邻接表 ,现在先贴一段使用邻接矩阵实现图的拓扑排序以及判断有无回路的问题.自己做的图.将就看吧. package TopSort; import java.util.LinkedList ...

  6. 洛谷P1615 西游记公司 题解

    题目传送门 这道题题面写得非常好. 但好像并没有什么ruan用. 这道题貌似就是把时间差求出来,乘上猪八戒能偷的电脑数就好了.(注意long long) #include<bits/stdc++ ...

  7. Codeforces Round #491 (Div. 2) E - Bus Number + 反思

    E - Bus Number 最近感觉打CF各种车祸.....感觉要反思一下, 上次读错题,这次想当然地以为18!肯定暴了longlong 而没有去实践, 这个题我看到就感觉是枚举每个数字的个数,但是 ...

  8. bzoj 1108

    思路:水题, 将所有点按x轴对称反转,就变成了两堆点的坐标和的差.. #include<bits/stdc++.h> #define LL long long #define fi fir ...

  9. Java 中的静态嵌套类和非静态嵌套类

    Java 中的静态嵌套类和非静态嵌套类 术语:嵌套类分为两类:静态嵌套类和非静态嵌套类.声明 static 的嵌套类称为静态嵌套类,非静态嵌套类也称为内部类. class OuterClass { p ...

  10. php实现var_dump函数

    <?php class VarDump { private static $isInLoop = false; private static $buffer = false; public st ...