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

SAX½âÎöXML,Ϊʲô»á±¨ÄÚ´æÒç³ö£¿

ÓÃÏÂÃæµÄSAX·½Ê½£¬½âÎöÒ»¸ö450MµÄxmlÎļþʱ£¬»á±¨ÄÚ´æÒç³ö£¿
Ϊʲô£¿Java code:

import java.io.File;
import java.io.FileInputStream;
import java.util.*;

import javax.xml.parsers.*;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

public class SaxXml {
public SaxXml() {
}

public void readXML(String FileName) throws Exception{
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
MySAXHandler handler = new MySAXHandler();
sp.parse(new FileInputStream(new File(FileName)), handler);
}

class MySAXHandler extends DefaultHandler{
java.util.Stack tagStack = new java.util.Stack();

@SuppressWarnings("unchecked")
public void startElement(String namespace,String localName,String qName,Attributes atts){
tagStack.push(qName);
System.out.println("qName:"+qName);
}
public void endElement(String namespace,String localName,String qName){

}
public void characters(char[] chs,int start,int length){

}

}


public static void main(String[] args){
String name = "f:/data/AuditBizDataDataSet2.xml";
SaxXml q = new SaxXml();
try {
q.readXML(name);
} catch (Exception e) {
e.printStackTrace();
}
}
}





ÄÇÎÒÓ¦¸ÃÔÚ


Ïà¹ØÎÊ´ð£º

ÀûÓÃC#±àдtxtת»¯µ½xmlµÄ³ÌÐò

txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔ­Êý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......

ÈçºÎÌá½»xmlÀàÐÍÊý¾Ý - .NET¼¼Êõ / ASP.NET

Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
  <a>aaa
  </a>
  <b>bbb
  </b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......

ÇóJavaÈçºÎʵÏÖxmlÎļþ

ÒÑÖªÎļþ1.xmlºÍÊý¾ÝÎļþdb.xml£¬ÈçºÎÓÃjava±àд³ÌÐò£¬µÃ³ö2.xmlÎļþ£¿
1.ÒÑÖªxmlÎļþ 1.xml½á¹¹ÈçÏ£º
<cs>
  <cs name="cs1" details="This is cs1" country="China&q ......

ÔÚÕâÑùÒ»¸öxmlÎļþÀïÈçºÎÑ¡ÔñÌØµã½Úµã

<?xml version="1.0" encoding="UTF-8" ?> 
<root> 
<video> 
  <device deviceid="\\?\usb#vid_0c45&pid_613b#5&2d0620de& ......

oracleµ¼³öÊý¾Ýµ½xmlÖÐ - Oracle / »ù´¡ºÍ¹ÜÀí

ÏÖÔÚÎÒдÁË´æ´¢¹ý³Ì£¬°Ñ±íÀïÃæµÄÊý¾Ýµ¼³öµ½xmlÖУ¬ÏÖÔڵĸñʽÊÇ£º
<?xml version="1.0" encoding="GBK" ?> 
<PEOPLE>
<PERSON PERSONID="1">
  &l ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ