Retrieving an XML document using Ajax
Retrieving an XML document using Ajax
http://www.javascriptkit.com/dhtmltutors/ajaxgetpost3.shtml
When making a server request in Ajax, the data returned can be in either
plain text/html, or an XML document instead. The later is technically
just a text file as well, but with some special instructions, Ajax can
retrieve that well formed XML text file and return it back to you as a
XML object. This enables the XML data to be easily parsed using
standard DOM
methods
.
Here's a simple XML document in RSS format I'll be using for illustration (lets name it "javascriptkit.xml
"):
<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="0.91">
<channel>
<title>JavaScriptKit.com</title>
<link>http://www.javascriptkit.com</link>
<description>JavaScript tutorials and over 400+ free scripts!</description>
<language>en</language>
<item>
<title>Document Text Resizer</title>
<link>http://www.javascriptkit.com/script/script2/doctextresizer.shtml</link>
<description>This script adds the ability for your users to toggle your
webpage's font size, with persistent cookies then used to remember the
setting</description>
</item>
<item>
<title>JavaScript Reference- Keyboard/ Mouse Buttons Events</title>
<link>http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml</link>
<description>The latest update to our JS Reference takes a hard look at
keyboard and mouse button events in JavaScript, including the unicode value
of each key.</description>
</item>
<item>
<title>Dynamically loading an external JavaScript or CSS file</title>
<link>http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml</link>
<description>External JavaScript or CS
相关文档:
使用JDOM解析XML(转载,简单又详细)
http://www.blogjava.net/haha/archive/2006/09/01/67153.html
一、前言
JDOM是Breet Mclaughlin和Jason Hunter两大Java高手的创作成果,2000年初,JDOM作为一个开放源代码项目正式开始研发。JDOM是一种解析XML的Java工具包。
&nbs ......
很多人对Xpath可能比较熟悉,但不知道有没有直接操作过数据库,我们都知道 在Sql2005里公支持的几种查询有Raw,Auto,Path模式等,如果在2000里使用过 Path模式的朋友应该知道,是不容易处理查询结果的,那么在2005里对这一块做了很好的提升
我先来介绍一下什么是Sql F ......
一、测试用的em.xml
<?xml version="1.0" encoding="GB2312"?>
<EW cmd="login" mod="Login" version="6.0">
<Source uns="" type="user"/>
<Username>zhangzhiyun@hp</Username>
<Password>111111</Password> ......
实例说明会更清楚些,假设有如下XML文件:
File: message_hutaow.xml
<?xml version="1.0" encoding="UTF-8"?>
<hutaow:Message version="1.0" xmlns:hutaow="http://wangtao.cublog.cn">
<hutaow:Head>
<hutaow:Date>20080502</hutaow:Date>
<hutaow:Source>
......
package com.flxx.docUrl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jd ......