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

linq to xml(MOSS GetCurrentUser)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
using System.IO;
using System.Data;
using System.Data.Linq;
namespace XmlGetUserInfo
{
public class GetUser:WebPart
{
SPWeb sWeb;
SPUser currUser;
private string AddUser()
{
sWeb = SPControl.GetContextWeb(Context);
currUser = sWeb.CurrentUser;
XElement employees = null;
StringBuilder user = new StringBuilder();

//create and writer xml
//string strFilename = Environment.CurrentDirectory + @"\txtuser.xml";//get filename
string strFilename = System.AppDomain.CurrentDomain.BaseDirectory + @"\txtuser.xml";
if(!File.Exists(strFilename))
{
XmlWriterSettings xws=new XmlWriterSettings();
xws.OmitXmlDeclaration=true;
using (XmlWriter writer = XmlWriter.Create(strFilename,xws))
{
employees = new XElement("Root",
new XElement("Employee",
new XElement("Name", currUser.Name), new XElement("Email", currUser.Email)
)
);
employees.Save(writer);
}
}
else
{
employees = XElement.Load(strFilename);
XElement tree=new XElement("Root",
new XElement("Employee",
new XElement("Name", currUser.Name), new XElement("Email", currUser.Email)),
from el in employees.Elements()
select el);
TextReader tr = new StringReader(tree.ToString());
XElement xel =


Ïà¹ØÎĵµ£º

Java and XML_¶ÁÊé±Ê¼Ç_2010 05 19

2010-05-19
Æß¡¢×ª»»XML
l  ¿ÉÀ©Õ¹Ñùʽ±íÓïÑÔ£¨XSL£©£¬±»¶¨Òå³ÉÁËÒ»ÖÖ±íʾÑùʽ±íµÄÓïÑÔ¡£ÊǹÜÀíÔõÑù´Ó¸ñʽAת»»Ò»¸öÎĵµµ½¸ñʽBµÄ¹æ·¶ÓïÑÔ¡£¸ÃÓïÑÔ×é¼þÓÃÓÚ¹ÜÀíת»»½á¹¹ÖеĴ¦ÀíºÍÉí·ÝÑéÖ¤
n  XSLÊÇÒ»ÖÖÓÃÀ´×ª»»XMLÎĵµµÄÓïÑÔ¡£
n  XSLÊÇÒ»¸öÓÃÀ´Ö¸¶¨XMLÎĵµ¸ñʽµÄ´Ê»ã¿â¡£
l  XSLºÍÊ÷ÐÎÃèÊö£ºÕâ ......

¹ØÓÚHTTP·ÃÎÊXMLÎļþµÄËæ±Ê

×î½üÏîÄ¿ÖÐÒªÓõ½Ò»Ð©web xmlÊý¾ÝµÄ·ÃÎÊ·ÖÎö£¬²ÉÓÃmsxml
1.msxmlÊÇ΢ÈíÌṩµÄ£¬ÔÚ·Ç¿ª·¢»·¾³ÖУ¬ÐèҪע²á
2.xmlÎļþ£¬Ò»°ãÔÚµÚÒ»¾äÓбàÂ뷽ʽ£¬Ò»°ãĬÈÏÊÇutf-8£¬ÊôÓÚÒ»ÖÖunicode
3.´ÓÍøÂç²É¼¯µÄxmlÊý¾Ý£¬ÐèҪʹÓÃwinnetº¯Êý¿â
4.winnet²É¼¯×ÔÍøÂçµÄÊý¾Ý£¬Ä¬ÈϵĶ¼ÊÇCP_ACP¸ñʽµÄ£¬¼òµ¥Ëµ¾ÍÊÇANSI»òUNICODE£¬UTF8µÄ±àÂë ......

ÔÚasp.netÖжÔXMLÎĵµ½øÐеIJÙ×÷£¨²»È«£¬´ýÐø£©

¶ÁXMLÎļþ
DataSet books = new DataSet();
books.ReadXml(MapPath("booklist.xml"));
booklist.DataSource = books;
booklist.DataBind(); ......

xml post(C#)

xmlpost by HttpWebRequest:
protected string PostXmlToURL(string url,string data)
{
    HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(url);
    hwr.Method = "POST";
    Stream stream = hwr.GetRequestStream();
    StreamWri ......

XMLÐòÁл¯(Ò»)

MSDNÉϵĶ¨Ò壺
XML ÐòÁл¯½«¶ÔÏóµÄ¹«¹²×ֶκÍÊôÐÔ»òÕß·½·¨µÄ²ÎÊýºÍ·µ»Øֵת»»£¨ÐòÁл¯£©Îª·ûºÏÌض¨ XML ¼Ü¹¹¶¨ÒåÓïÑÔ (XSD) ÎĵµµÄ XML Á÷¡£XML ÐòÁл¯Éú³ÉÇ¿ÀàÐ͵ÄÀ࣬²¢Îª´æ´¢»ò´«ÊäÄ¿µÄ½«Æ乫¹²ÊôÐÔºÍ×Ö¶Îת»»ÎªÐòÁиñʽ£¨ÔÚ´ËÇé¿öÏÂΪ XML)¼òµ¥µÄ˵¾ÍÊǽ«Ò»¸ö¶ÔÏóת»»³ÉXMLÁ÷»òÊÇÎļþµÄ¹ý³Ì¡£
×¢ÒâÊÂÏҪÐòÁл¯µÄÀ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ