高性能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
相关文档:
private XmlDocument xmlDoc;
private void btnCreateXml_Click(object sender, EventArgs e)
{
//自 ......
1、首先下载 xstream.jar和jettison.jar(转换为json时用到),并引入该包。
2、看如下代码吧:
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import c ......
大多数浏览器都内建了供读取和操作 XML 的 XML 解析器。
解析器把 XML 转换为 JavaScript 可存取的对象。
但是IE和其它浏览器是有很大区别的
解析 XML 文件 - 跨浏览器实现
<html>
<body>
<mce:script type="text/javascript"><!--
try //针对IE和基于IE内核的浏览器
{
xmlD ......
<
<
小于
>
>
大于
&
&
和号
'
'
单引号
"
"
引号
注释:在 XML 中,只有字符 "<" 和 "&" 确实是非法的。大于号是合法的,但是用实体引用来代替它是一个好习惯。 ......