Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ʵÀýÆÊÎöxmlÓ¦Óã¨1£©

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 //µ¼ÈëʹÓÃxmlÓ¦ÓÃËùÐèµÄÃüÃû¿Õ¼ä
using System.Xml.XPath;
using System.Xml;
using System.IO;
using System.Xml.Xsl;
public partial class login0 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
    }
    protected void btnok_Click(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();//н¨Êý¾Ý¼¯¶ÔÏó
        ds.ReadXml(Server.MapPath("ad/user.xml"));//ʹÓøöÔÏóµÄReadXml()·½·¨·ÃÎÊxmlÎļþ
     
        DataTable dt = ds.Tables[0];//н¨Êý¾Ý±í¶ÔÏ󣬽«Êý¾Ý¼¯¶ÔÏóÖеĵÚÒ»¸ö±í¸³¸øÕâ¸ö¶ÔÏó
        DataRow[] dta = dt.Select("userName='" + userName.Text.Trim() + "'");//ÓÃÊý¾Ý±í¶ÔÏóµÄSelect()·½·¨²éѯËù¸øÌõ¼þÊÇ·ñ´æÔÚ
     
        if (dta != null && dta.Length > 0)//Èô´æÔÚ£¬Âú×ã¸ÃÌõ¼þµÄÐн«¸³¸ødtaÊý¾ÝÐм¯¶ÔÏó
        {
            DataRow dr = dta[0];//°Ñ¼¯ÖеÚÒ»Ðи³¸øÊý¾ÝÐжÔÏó
            string strPwd = (string)dr["userPwd"];//ÕÒ³ö¸ÃÐÐÖÐÃÜÂëÁУ¬¸³¸ø±äÁ¿strPwd
            if (strPwd == this.userPwd.Text.Trim())//Èç¹ûÓëÎı¾¿òÄÚÈÝÆ¥Åä
            {
 &nbs


Ïà¹ØÎĵµ£º

XML XQuery

--XQuery »ùÓÚÏÖÓÐµÄ XPath ²éѯÓïÑÔ£¬²¢Ö§³Ö¸üºÃµÄµü´ú¡¢¸üºÃµÄÅÅÐò½á¹ûÒÔ¼°¹¹Ôì±ØÐèµÄ XML µÄ¹¦ÄÜ¡£
--1.ÉùÃ÷Ò»¸ö xml ÀàÐ͵ıäÁ¿£¬È»ºóʹÓà xml Êý¾ÝÀàÐ굀 query() ·½·¨À´²éѯ´Ë±äÁ¿
DECLARE @x xml
SET @x = '<ROOT><a>111</a></ROOT>'
SELECT @x.query('/ROOT/a')
--²éÕÒÊôÐÔaid=20µÄa½ ......

DTD£¬XML SchemaºÍRelax NGµÄ±È½Ï¼°Ï໥ת»¯£¡

±È½Ï£º
1. DTD
a. ×îÔçµÄXML Contraint
b. ÓÉW3C¶¨Òå
C. ·Ç³£¼òµ¥
2. XML Schema
a. ĿǰӦÓÃ×î¹ãµÄXML Contraint
b. ÓÉW3C¶¨Òå
c. ºÜÁé»î£¬µ«·Ç³£¸´ÔÓ
3. Relax NG
a. ÊǸöÒ°º¢×Ó£¬²»ÊÇÓÉW3C¶¨Òå
b. ·Ç³£·Ç³£¼òµ¥Ö±¹Û
c. ¶ÔÓÚÐèҪƵ·±¶¨ÒåContraintµÄEngineer·Ç³£ºÏÊÊ
Ï໥ת»¯£º
1. XML Document -> DTD ......

php»ñÈ¡xmlÊôÐÔÖµ

<!-- xml¸ñʽ
<foo xmlns="test">
<bar attr='a'></bar>
<bar attr='b'></bar>
<bar attr='c'></bar>
</foo>
-->
<?php
$dom = new DOMDocument();
if (!$dom->load('attr.xml'))
{
echo "load books.xml failed!<br>";
re ......

C#ÖжÔXML½Úµã½øÐÐÔöɾ¸Ä²é

ºÅ³ÆxmlhelperµÄÒ»¸öÀà
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XMLÎĵµ²Ù×÷¹ÜÀíÆ÷
/// </summary>
public class XMLHelper
{
public X ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ