.netÖУ¬¶ÁÈ¡XMLÔÚÒ³ÃæÏÔʾ£¬²¼¾ÖÓÃRepeater¿Ø¼þ
public static IList<News> GetAllNews()
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load("Äã¶ÁÈ¡µÄµØÖ·£ºÀýÈ磺http://www.123.com/ok/a.xml");
IList<News> news = new List<News>();
XmlNode root = xdoc.DocumentElement;
foreach (XmlNode node in root.ChildNodes)
{
if (node.Name == "match")
{
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.Name == "m")
{
News n = new News();
foreach (XmlNode childElement in childNode.Ch
Ïà¹ØÎĵµ£º
Ä¿Ç°ÔÚʹÓÃDOMºÍdom4j¶ÔXMLÎļþ½øÐÐÔöɾ¸Ä²é£¬Èç¹ûÎÒÔÚͬһ¸öÏß³ÌÖÐ×ö¶à´ÎÔöɾ¸Ä²Ù×÷£¬ÈçºÎ±£Ö¤DOMÄÚ´æͬ²½ºÍÎïÀíÎļþͬ²½£¿ÓÖÈçºÎÇåÀíÔÚÄÚ´æÖÐÒѼÓÔصÄÊý¾Ý£¿
ÎÊÌâ²¹³ä£º
Äã˵µÄÕâÖÖ¾ÍÊǺܵ¥´¿µÄÔÚÒ»¸öÏß³ÌÖÐÖ´ÐÐËùÓеIJÙ×÷£¬Èç¹ûÎÒÊÇÔÚµ¥Ïß³ÌÖвÙ×÷£¬Ã¿×öÒ»´ÎÔöɾ¸Ä²éµÄÒ»ÖÖ£¬ÎÒ¶¼Òª±£´æµ½ÎļþÖÐÈ¥£¬È磺
µÚÒ»´Î£ºÔö¼ ......
package book.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.Default ......
¼òµ¥µØ˵£¬xslÊÇ˵Ã÷xmlÈçºÎ±í´ï³öÀ´µÄÑùʽÎļþ£¬¶øxsd¸ø³öxmlÎļþµÄ¸ñʽÃèÊö
Èç¹û˵xmlÊÇÒ»µþ³®Æ±£¬xsd¾ÍÊÇÑé³®»ú£¬¿´¿´ÀïÃæÓÐûÓмٳ®£¬¶øxslÊǵ㳮»ú£¬¿´¿´µ½µ×ÊǶàÉÙÇ®¡£ÓÃxml¿ÉÒÔ²»ÓÃxsd£¬¾ÍÏñ»¨Ç®µÄʱºò²»Ò»¶¨ÒªÑé³®Ò»Ñù£¬µ«ÊÇÊÕÇ®µÄÈËÒ»°ãÊÇÏëÒªÑéµÄ¡£¶ø»¨Ç®µÄʱºò²»Äܲ»µã³®£¬²»µãÄǾͲ»ÊÇ»¨Ç®ÁË£¬ÊÇÍæÇ®¡£µ±È»ÁË£ ......
¶Á£º
//´ò¿ªÄ³Îļþ(¼ÙÉèweb.configÔÚ¸ùĿ¼ÖÐ)
string filename=Server.MapPath("/") + @"WebApplication1\web.config";
XmlDocument xmldoc= new XmlDocument();
xmldoc.Load(filename);
//µÃµ½¶¥²ã½ÚµãÁбí
XmlNodeList topM=xmldoc.DocumentElement.ChildNodes;
foreach(XmlElement element in topM)
{
if(ele ......
·´ÉäÊÇ Java ÓïÑÔ±»ÊÓΪ¶¯Ì¬»ò×¼¶¯Ì¬ÓïÑÔµÄÒ»¸ö¹Ø¼üÐÔÖÊ£¬½áºÏ·´ÉäºÍ XML »á°ïÖúÎÒÃǸü¿ì¡¢¸ü·½±ãµØʵÏÖһЩ¶¯Ì¬´úÂ룬´Ó¶ø½â¾ö±à³ÌÖпÉÄÜÓöµ½µÄ²»È·¶¨ÎÊÌâ¡£±¾ÎĽ«½áºÏ·´ÉäÓë XML ¶Ô Java ±à³ÌµÄ¶¯Ì¬ÐÔ½øÐÐÉîÈëdz³öµÄÌÖÂÛ¡£ÔÚÀí½â±¾ÎĵÄ˼ÏëÖ®ºó£¬Äú¿ÉÒÔ½«ÆäÓ¦Óõ½³ÌÐòÖÐÒÔ´´½¨Áé»îµÄ´úÂë¡£
ÒýÑÔ
ÔÚÏÖʵÉú»îÖУ¬¾³£»á·¢ ......