哪跟哪啊
整个一关公战秦琼建议驱看看SAX和DOM的基础知识先
整个一关公战秦琼建议驱看看SAX和DOM的基础知识先
解决方案 »
- java.lang.IllegalArgumentException怎么解决?
- struts2验证框架,判断密码和确认密码是否相等,怎么判断
- 用JAVA代码启动程序。
- icefaces(JSF)中的message不显示
- 哪位大哥能帮在下写一个完整的JDBC数据库操作类?过年了,帮帮忙,我实在是没米了。。。
- 简单Java问题!
- 如何在jsp页中将字段值作为初值赋给文本域?
- 我每次编译完ejb之后就会出现一个警告,不只是何意思?!请指教!!
- 求大家给推荐一本ejb好书
- 请问,部署了EJB后,在客户端测试也可以成功调用Remote中地接口,返回值也是正常地...but..but..
- 如何使用javascript语言实现在打开PAGE的时候,自动弹出另外一个窗口PAGE2,
- 请问一个Sql语句从多个表中查找几个字段,用什么方法对这几个字段操作,例如取到这几个字段的名字(仅仅是这几个)
DOM先把整个树状结构读入内存,可以随机操作我只是想知道能不能把DOM树作为输入,
用SAX的操作方式做处理,因为我这里获得的是一个
客户端传过来的DOM,而想做的处理用DOM操作
略嫌复杂。
/ \ / \
| \ / |
| ︵ \ / ︵ |
\︶\︶\︶|︶| \ \ / / |︶|︶/︶/︶/
\ \ \ | | ︶ ︶ | | / / /
︶ ︶╰| | | |╯︶ ︶
|︶| |︶|
| | !!!!! | |
︶ ︶
拼装特殊语句(如sql)
不过我现在用dom也已经实现了
拼装特殊语句(如sql)
----------------------用DOM实现不了吗?还要倒退回去干吗呢
dom用的递归,一不小心就乱了
One of the interesting features of JDOM is its interoperability with other APIs. Using JDOM, you can output a document not only to a Stream or a Reader, but also as a SAX Event Stream or as a DOM Document. This flexibility allows JDOM to be used in a heterogeneous environment or to be added to systems already using another method for handling XML. As we'll see in a later example, it also allows JDOM to use other XML tools that don't yet recognize the JDOM data structures natively. Another use of JDOM is the ability to read and manipulate XML data that already exists. Reading a well-formed XML file is done by using one of the classes in org.jdom.input. In this example, we'll use SAXBuilder: Listing 12. Parsing an XML file with SAXBuilder
try {
SAXBuilder builder = new SAXBuilder();
Document anotherDocument =
builder.build(new File("/some/directory/sample.xml"));
} catch(JDOMException e) {
e.printStackTrace();
} catch(NullPointerException e) {
e.printStackTrace();
} You can manipulate the document built through this process in the same ways shown back in Listings 2 through 7.Another practical application of JDOM combines it with the Xalan product from Apache (see Resources). Using the car example above, we will construct a Web page for an online car dealer presenting the details of a particular car. First, we will assume that the document we built above represents the information about the car we are going to present to the user. Next, we will combine this JDOM Document with an XSL stylesheet and output the HTML-formatted results to a servlet's OutputStream for display in the user's browser.