高性能XML解析类
//pugxml.h
///////////////////////////////////////////////////////////////////////////////
//
// Pug XML Parser - Version 1.0002
// --------------------------------------------------------
// Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
// Released into the Public Domain. Use at your own risk.
// See pugxml.xml for further information, history, etc.
// Contributions by Neville Franks (readonly@getsoft.com).
//
///////////////////////////////////////////////////////////////////////////////
#if !defined(_PUGXML_)
#define _PUGXML_
#pragma once
//#define PUGOPT_MEMFIL //Uncomment to enable memory-mapped file parsing support.
//#define PUGOPT_NONSEG //Uncomment to enable non-destructive (non-segmenting) parsing support.
#ifdef PUGOPT_MEMFIL
# ifndef PUGOPT_NONSEG
# define PUGOPT_NONSEG //PUGOPT_MEMFIL implies PUGOPT_NONSEG.
# endif
#endif
#include <iostream>
#include <ostream>
#include <string>
#if defined(PUGOPT_MEMFIL) | defined(PUGOPT_NONSEG)
# include <assert.h>
#endif
#ifndef HIWORD
# define HIWORD(X) ((unsigned short)((unsigned long)(X)>>16))
# define LOWORD(X) ((unsigned short)((unsigned long)(X)&0xFFFF))
#endif
//<summary>
// Library variant ID. The ID 0x58475550 is owned by Kristen Wegner. You *MUST*
// provide your own unique ID if you modify or fork the code in this library to
// your own purposes. If you change this then *you* are now the maintainer, not me.
// Change also in the package section of pugxml.xml, and append yourself to the
// authors section.
//</summary>
#define PUGAPI_INTERNAL_VARIANT 0x58475550
//<summary>Major version. Increment for each major release. Only change if you own the variant.</summary>
#define PUGAPI_INTERNAL_VERSION_MAJOR 1
//<summary>Minor version. Increment for each minor release. Only change if you own the variant ID.</summary>
#define PUGA
相关文档:
xml中有以下字符不能出现,否则,xml将不能被正确解析:
&><'
如果在xml中出现了非法字符呢必须将其过滤掉!过滤的方法很简单,替换就可以了:
例如在php xml_parser_create 中,就可以这么做:
$parser = xml_parser_create(); //创建一个parser编辑器
xml_set_element_handler($parser, "startElement", " ......
■ 开发前要求配置
■ Select XML格式数据
■ Insert XML格式数据
■ Updata XML格式数据
■ Delete XML格式数据
开发前要求配置
必须安装Oracle客户端
把Classpath指向
classes111.zip ......
源xml文件
<?xml version="1.0" encoding="iso-8859-1"?>
<books>
<stock>
<name>The Picasso Code</name>
<author>Dan Blue</author>
<category>Fiction</category>
<description>Cubist paintings reveal a secret society of people ......
1. 基础:对XML进行简单的查询, 插入, 删除, 编辑操作
在数据量不是很大的情况下,可以用xml代替数据库存储数据,但是要定义xsd文件来验证xml文件,保证xml数据格式。
以下网页介绍了如何利用C#实现xml的查询,插入,删除和更新操作,这表明xml可以代替数据库存储一定量的数据。
http://blog.csdn.net/cmoonc/archive/20 ......
<
<
小于
>
>
大于
&
&
和号
'
'
单引号
"
"
引号
注释:在 XML 中,只有字符 "<" 和 "&" 确实是非法的。大于号是合法的,但是用实体引用来代替它是一个好习惯。 ......