gloox xmlµÄ½âÎöÄ£¿é
gloox×Ô¼ºÊµÏÖÁËxmlµÄ½âÎöÄ£¿é£¬Ã»ÓÐÓõ½µÚÈý·½µÄ¿â(tinyXML£¬expat )
Ö÷񻃾¼°µÄÎļþ:
tag.h (tag.cpp)
taghandler.h
parser.h (parser.cpp)
1. TagÒ»¸öTag¾ÍÊÇÒ»¸öXMLÔªËØ
ÀýÈç:
a.
<book kind='computer'>
<store id='23'/>
<author>
qiang
</author>
</book>
b. <book id='32'/>
c. <book>name1</book>
Ê×ÏȽéÉÜÒ»¸ö¸ÅÄî: escape-string£¬ºÎΪescape-string?
ÔÚescape-stringÖÐ:
'&'ת»»³É&, '<'ת»»³É<, '>'ת»»³É>.
±àÂë±íÈçÏÂ:
//////////////////////////////////////////////////////////////////////////
// ±àÂë±í £¨ÖмäµÄ¿Õ¸ñÈ¥µô£¬ÕâÀïÖ»ÊÇΪÁË·½±ãÏÔʾ£©:
// -------------------------------------------------------
// | ×Ö·û | Ê®½øÖÆ | Ê®Áù½øÖÆ | THML×Ö·û¼¯ | Unicode |
// -------------------------------------------------------
// | " Ë«ÒýºÅ | & # 34; | & # x22; | " | \u0022 |
// -------------------------------------------------------
// | ' µ¥ÒýºÅ | & # 39; | & # x27; | & apos; | \u0027 |
// -------------------------------------------------------
// | & Óë | & # 38; | & # x26; | & amp; | \u0026 |
// -------------------------------------------------------
// | < СÓںŠ| & # 60; | & # x3C; | & lt; | \u003c |
// -------------------------------------------------------
// | > ´óÓںà | & # 62; | & # x3E; | & gt; | \u003e |
// -------------------------------------------------------
gloox - APIs
Tag::escape() ¹¦ÄÜ: string -> escape-string
Tag::relax() ¹¦ÄÜ: escape-string -> string
Ö÷Òª³ÉÔ±±äÁ¿:
attributes - ËùÓÐÊôÐÔµÄlist
name - ½ÚµãÃû×Ö
cdata - ½ÚµãÊý¾Ý£¬ÀýÈç<name>cdata</name>ÖеÄcda
Ïà¹ØÎĵµ£º
using System.Xml;//Í·²¿¼Ó´ËÃüÃû¿Õ¼ä
XmlDocument xd = new XmlDocument();//±íʾXMLÎĵµ
XmlDeclaration xde;//±íʾ XML ÉùÃ÷½Úµã£º<?xml version='1.0'...?>
xde = xd.Cre ......
ͨ¹ýAsp.net(C#)Ó¦ÓóÌÐò¶ÁÈ¡±¾µØÉÏ´«µÄExcleÎļþ,´æ·Åµ½DataSetÖÐ,ͨ¹ýDataSetÖеķ½·¨Ö±½ÓÉú³ÉXMLÎļþ.
C# Code
if (this.FileUpload1.PostedFile != null)
{
string filename = this.FileUpl ......
SAX£¨Simple API for XML¼ò³ÆSAX£©Ê¼þÊÇÎÞ״̬µÄ£¬Ò²¾ÍÊÇ˵£¬µ±½ÓÊÕµ½×Ö·ûÊý¾ÝµÄʼþºó£¬²¢²»ÖªµÀ¸Ã×Ö·ûÊý¾ÝÊÇÄÄÒ»¸öÔªËØµÄ
ÄÚÈÝ¡£Í¬ÑùµØ£¬µ±ÊÕµ½ÔªËØ¿ªÊ¼µÄʼþºó£¬Ò²ÎÞ·¨ÖªµÀ¸ÃÔªËØÊÇ·ñÓи¸ÔªËØ£¬ÊÇ·ñÓÐ×ÓÔªËØ£¬ÕâÊÇ
SAXºÍDOM²»Í¬µÄµØ·½¡£SAX½âÎöÆ÷±¾Éí²¢²»Ìá¹©ÔªËØµÄÉÏÏÂÎÄÐÅÏ¢£¬ËùÓÐÏà¹ØÐÅÏ¢µÄ¼Ç¼ÐèÒªÎÒÃÇ×Ô
¼º±à³ ......
using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using FilmOnLine.Model;
namespace FilmOnLine.DAL
{
public static class FilmService
{
/// <summary>
/// Ìí¼ÓµçÓ°
/// </summary ......
//»ñÈ¡Êý¾Ý¿âÊý¾Ý·µ»Ølist
public List queryAll(int fcateId) {
List list = new ArrayList();
String sql = "select * from g_Account where fCateID=? order by fCode";
Connection con = SqlHelp.getConn();//»ñµÃÁ¬½Ó£¬sqlhelp×Ô¼ºÐ´µÄ¹¤¾ßÀà
PreparedStatement pst = null;
ResultSet rs = null;
......