XMLɾ³ý맪ÓÐÌõ¼þµÄ×Ó½Úµã
<power_line>
<name>¼Î»ª305Ïß </name>
<sap_id>5020-S-0000-0065 </sap_id>
<dydj>35kV </dydj>
<poles>
<pole>
<name>¼Î»ª305ÏßµçÀµçÀÂ#0 </name>
<xh>0 </xh>
<sap_id>000000000040719166 </sap_id>
</pole>
<pole>
<name>¼Î»ª305ÏßµçÀÂÖ§¼Ü </name>
<xh>0 </xh>
<sap_id>000000000040627384 </sap_id>
<jd>120.7071280158 </jd>
<wd>30.6240158394 </wd>
</pole>
<pole>
<name>¼Î»ª305ÏßµçÀµçÀÂ#1 </name>
<xh>1 </xh>
<sap_id>000000000040716119 </sap_id>
</pole>
</poles>
</power_line>
ÎÒÏë°Ñ²»º¬ÓÐ <jd>µÄ×ӽڵ㶼ɾ³ýµô.ÇëÎÊÒªÔõô×ö?
±éÀú pole + ÅÐ¶Ï É¾³ý...
»òÕߣº
C# code:
using System;
using System.Diagnostics;
using System.Xml;
namespace ConsoleApplication9 {
class Program {
static void Main() {
string xml = @"
<power_line>
<name>¼Î»ª305Ïß </name>
<sap_id>50
Ïà¹ØÎÊ´ð£º
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' ´ò¿ª¸Õ´´½¨µÄÎļþ¡£
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' ¶ÁÈëËùÓÐ×Ö·ûµ½±äÁ¿ÖÐ ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎĶ¼¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
ÈçºÎÓÃATL´°ÌåÓ¦ÓóÌÐòÖÐÓÃSystem.Xml±éÀúÒ»¸öXmlÎļþ
Äã˵µÄÊÇÍйܴúÂ룿
¡£
vc¿ÉÓÃmsxml
http://msdn.microsoft.com/en-us/library/ms767594(VS.85).aspx
MSXML4
//ÒýÈëmsxml4.dll &nbs ......
ÏÂÃæÊÇXML³õʼÎļþÄÚÈÝ
XML code:
<upd:Update xmlns:lar="http://schemas.microsoft.com/msus/2002/12/LogicalApplicabilityRules" xmlns:cmd="http://schemas.microsoft.com/msus/2002/12/Up ......
ÈçÌ⣬ÎÒÏëÓÃdom4jÀ´¶ÁÈ¡xmlµÄÎļþ
public Document read(String fileName) throws MalformedURLException, DocumentException {
SAXReader reader = new SAXReader();
Document document = read ......