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

5.9×ܽá Jaxp ½âÎöxmlÎļþÁ½ÖÖ·½Ê½__TOmcat µÄÅäÖÃ

1.  Jaxp ½âÎöxmlÎļþ Dom·½Ê½
 
<?xml version="1.0" encoding="gbk"?>
<students>
<student id="001">
<name>ÕÅÈý</name>
<age>25</age>
</student>
<student id="002">
<name>ÀîËÄ</name>
<age>23</age>
</student>
<student id="003">
<name>ÍõÎå</name>
<age>35</age>
</student>
<student id="004">
<name>ÖÜÁù</name>
<age>20</age>
</student>

</students>
 
 
 1¡¢»ñÈ¡DocumentBuilder¶ÔÏó
 
                DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance
  2ͨ¹ý¹¤³§»ñÈ¡documentBulider¶ÔÏó
                 DocumentBuilderFatory document=factory.newDocumentBulider();
  3,ʹÓÃDocumentBuilder¶ÔÏóµÄ½âÎö·½·¨£¬ÓëxmlÎļþ¹ØÁª¡£»ñÈ¡¸ÃÎļþµÄ¡£doucment¶ÔÏó¡£
                Document document = (Document) builder.parse(new File("stu.xml"));
---------------------------------------------------------------------------------------------------------------
2    »ñÈ¡Element£º
NodeList list=document.getDocumentElement().getElementsByTagName("student");
for(int i=0;i<list.getLength();i++)
{
Element element=(Element) list.item(i);
NodeList list2=element.getChildNodes();

Node node = list2.item(3);
System.out.println(node.getTextContent()+".."+node.getNodeName()+"..."
+node.getNodeType()+"..."+node.getNodeValue());
}
ÔÚÒÔÉϵijÌÐòÖÐ list2.item(3)»ñÈ¡µÄÊÇstuden±êǩϵÄage ±êÇ© £¬ÒòΪ¿Õ°×ÇøÓòÒ²ÊÇÕ¼ÓÐÒ»¸ö½Úµã
   Èç¹û¸ÄΪ Node node = list2.item(2) ¾Í»áµÃµ½£º
 &nb


Ïà¹ØÎĵµ£º

DataSet¡¢Excel¡¢XMLÖ®¼äµÄµ¼Èëµ¼³ö

class ImportExportToExcel
{
public class ImportExportToExcel
{
private string strConn;
private System.Windows.Forms.OpenFileDialog openFileDlg = new System.Windows.Forms.OpenFileDialog();
private System.Windows.Forms.SaveFileDialog saveFi ......

ÓÉxmlÉú³Éxsd¼°ÊµÌåÀà

ʹÓÃVS2005¹¤¾ßXSD.exe(SDK\v2.0\Bin\xsd.exe)×Ô¶¯Éú³ÉʵÌåÀࣺ
xsd /c /namespace:myCompany /language:CS temp1.xsd
Ò²¿ÉÒÔÉú³ÉDataSetÀàÐ͵ÄÀà:
xsd /dataset /language:CS temp1.xsd
 ( ÀàÎļþºÍXSDÖ®¼ä¿ÉÒÔÏ໥ת»»£¬Ò²¾ÍÊÇ˵£¬ÄãÒ²¿ÉÒÔÏÈÉú³ÉÀ࣬Ȼºó×Ô¶¯Éú³ÉXSD)
    ×Ô¶¯¶ÁÈ¡XMLÊý¾Ý ......

ʹÓÃMsXML¶ÁдXMLÎļþ

// MsXmlTest.cpp : ¶¨Òå¿ØÖÆÌ¨Ó¦ÓóÌÐòµÄÈë¿Úµã¡£
//
#include "stdafx.h"
#include "MsXmlTest.h"
#include <clocale>
#include "comutil.h"
#import "msxml4.dll"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// ΨһµÄÓ¦ÓóÌÐò¶ÔÏó
CWinApp theApp;
using namespace std;
void WritePerson(MSXML2: ......

FusionCharts µÄXML±êÇ©ÊôÐÔ

×Ý×ø±êºº×Ö˵Ã÷  yAxisName='̨' rotateYAxisName='0'
FusionCharts µÄ XML±êÇ©ÊôÐÔÓÐÒ»ÏÂËÄÖÖÊý¾ÝÀàÐÍ
* Boolean - ²¼¶ûÀàÐÍ£¬Ö»ÄÜΪ1»òÕß0¡£ÀýÈ磺<graph showNames=’1′ >
* Number - Êý×ÖÀàÐÍ£¬Ö»ÄÜΪÊý×Ö¡£ÀýÈ磺<graph yAxisMaxValue=’200′ >
* String - ×Ö·û´®ÀàÐÍ£¬Ö ......

°ÑÎı¾¿òµÄֵдÈëµ½xmlÎļþÖÐ

 protected void btn_write_Click(object sender, EventArgs e)
    {
        XmlWriterSettings settings=new XmlWriterSettings();
        settings.Indent=true;
        setting ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ