ÀûÓÃSqlHelper(ExecuteXmlReaderʹÓÃ)£¬×ª»»µ½xml¸ñʽ
ÀûÓÃsqlhelperÖеÄExcuteXmlReader·½·¨£¬¶ÁÈ¡Êý¾Ý²¢±£´æΪxmlÎļþ
string strConn = Properties.Settings.Default.Connections;
SqlConnection connection = new SqlConnection(strConn);
---×¢Ò⣺ºóÃæµÄfor¸ñʽ
string strsql = "select * from p where name=@name and other=@other FOR XML AUTO,root('root'),elements";
SqlParameter[] sqlp = new SqlParameter[2];
sqlp[0] = new SqlParameter("@name", "pp");
sqlp[1] = new SqlParameter("@other", "ss");
xr = SqlHelper.ExecuteXmlReader(connection, CommandType.Text, strsql,
sqlp);
XmlDocument xml = new XmlDocument();
xml.Load(xr);
xml.Save(Application.StartupPath + "\\test1.xml");
Ïà¹ØÎĵµ£º
ÓÐʱºòÎÒÃÅÐèÒª°ÑEXCEL±í¸ñÖеÄÊý¾Ýת»»³ÉXML¸ñʽ ÕâÐèÒªÓõ½JXL(·ÖÎöEXCEL)°üºÍJDOM°ü(¹¹³ÉXML)
import java.io.*;
import jxl.*;
import org.jdom.Element;
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
/**
*
* @author guo
*/
public class EtoX {
  ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white" viewSourceURL="srcview/index.html">
<mx:S ......
Ò».ÕªÒª
.NetÔÊÐí¿ª·¢ÈËÔ±ÔÚÔ´´úÂëÖвåÈëXML×¢ÊÍ£¬ÕâÔÚ¶àÈËÐ×÷¿ª·¢µÄʱºòÏÔµÃÌرðÓÐÓᣠC#½âÎöÆ÷¿ÉÒÔ°Ñ´úÂëÎļþÖеÄÕâЩXML±ê¼ÇÌáÈ¡³öÀ´£¬²¢×÷½øÒ»²½µÄ´¦ÀíΪÍⲿÎĵµ¡£ ÕâƪÎÄÕ½«Õ¹Ê¾ÈçºÎʹÓÃÕâЩXML×¢ÊÍ¡£ ÔÚÏîÄ¿¿ª·¢ÖУ¬ºÜ¶àÈ˲¢²»ÀÖÒâд·±ÔÓµÄÎĵµ¡£µ«ÊÇ£¬¿ª·¢×鳤ϣÍû´úÂë×¢Ê;¡¿ÉÄÜÏêϸ£»ÏîÄ¿ ......
ÔÚXMLÎĵµÖеÄËùÓÐÎı¾¶¼»á±»½âÎöÆ÷½âÎö¡£
Ö»ÓÐÔÚCDATA²¿¼þÖ®ÄÚµÄÎı¾»á±»½âÎöÆ÷ºöÂÔ¡£
½âÎöÊý¾Ý
XML ½âÎöÆ÷ͨ³£Çé¿öÏ»ᴦÀíXMLÎĵµÖеÄËùÓÐÎı¾¡£
µ±XMLÔªËر»½âÎöµÄʱºò£¬XMLÔªËØÄÚ²¿µÄÎı¾Ò²»á±»½âÎö:
<message>This text is also parsed</message>
XML½âÎöÆ÷ÕâÑù×öµÄÔÒòÊÇXMLÔªËØÄÚ²¿¿ÉÄÜ» ......
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
private XmlDo ......