D:\xmljava\tutorial\xmlprogj>javac
JdomTwo.java:44: 找不到符号
符号: 方法 setTrimAllWhite(boolea
位置: 类 org.jdom.output.XMLOutpu
xo.setTrimAllWhite(true);
方法找不到符号,可能是因为工具包升级了,这里是因为jdom1.1升级左,不用setTrimAllWhite(boolean)方法了.
如果是找不到类,可能是因为路径的错误,没有能够导入类所致.
新的JdomTwo.java
/*
* (C) Copyright IBM Corp. 2003. All rights reserved.
*
* US Government Users Restricted Rights Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* The program is provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* IBM will not be liable for any damages suffered by you as a result
* of using the Program. In no event will IBM be liable for any
* special, indirect or consequential damages or lost profits even if
* IBM has been advised of the possibility of their occurrence. IBM
* will not be liable for any third party claims against you.
*/
import java.io.File;
import org.jdom.Document;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
import org.jdom.output.Format;
public class JdomTwo
{
public static void main(String[] argv)
{
if (argv.length == 0 ||
(argv.length == 1 && argv[0].equals("-help")))
{
System.out.println("\nUsage: java JdomTwo uri");
System.out.println(" where uri is the URI of your XML document.");
System.out.println(" Sample: java JdomTwo sonnet.xml");
System.out.println("\nUses the JDOM API to parse an XML document, " +
"then write it back to the console.");
System.out.println("This code is different from JDOMOne because it " +
"ignores whitespace.");
System.exit(1);
}
try
{
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(new File(argv[0]));
XMLOutputter xo = new XMLOutputter();
//xo.setTrimAllWhite(true);
xo.setFormat(Format.getCompactFormat());
xo.output(doc, System.out);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
分享到:
相关推荐
从IBM developerWorks中国下载的xml简介。 由于html看起来较麻烦,自己制作成了pdf。
关于Axis2IBM DeveloperWorks上的资料,深入Axis2必读文章
dom4j是一个十分优秀的JavaXML API,具有性能优异、功能强大和极其易使用的特点,它的性能超过sun公司官方的dom技术,同时它也是一个开放源代码的软件,可以在SourceForge上找到它。在IBM developerWorks上面还可以...
NULL 博文链接:https://jacky-dai.iteye.com/blog/2311509
有几个网站从事一些非盈利服务,提供一些可轻松设置和使用的表单来进行民意测验和数据收集。本教程介绍一个简单的架构来为 Android ... http://www.ibm.com/developerworks/cn/xml/tutorials/x-andddyntut/index.html
在此之后,您现有的 developerWorks 中国会员 ID 将不再有效,请您即刻申请新的 IBM ID,以便获取您需要的产品及服务。 当您完成注册后,您可以使用您的 IBM ID 和密码访问 developerWorks 中国网站或 ...
在IBM developerWorks上面可以找到一篇文章,对主流的Java XML API进行的性能、功能和易用性的评测,dom4j无论在那个方面都是非常出色的。如今你可以看到越来越多的Java软件都在使用dom4j来读写XML,特别值得一提的...
dom4j是一个十分优秀的JavaXML API,具有性能优异、功能强大和极其易使用的特点,它的性能超过sun公司官方的dom技术,同时它也是一个开放源代码的软件,可以在SourceForge上找到它。在IBM developerWorks上面还可以...
IBM开发人员我为IBM Developer编写的文章和教程的源代码(以前是IBM Code,以前是IBM developerWorks) 您将在此存储库中找到目录(截至2020年6月7日): IBM-Developer/├── IntroToJava├── Kotlin├── ...
时常看到一些人说掌握了Java,但是让他们用Java做一个实际的项目可能又困难重重,在这里...
Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click any of the topics below to link ...
http://www.ibm.com/developerworks/java/jdk/上下的 ibm-java-javacomm-3.0-0.0-linux-x86_64.tgz
dom4j是一个十分优秀的JavaXML API,具有性能优异、功能强大和极其易使用的特点,它的性能超过sun公司官方的dom技术,同时它也是一个开放源代码的软件,可以在SourceForge上找到它。在IBM developerWorks上面还可以...
http://www.ibm.com/developerworks/cn/xml/wa-ajaxintro1.html 掌握 Ajax,第 2 部分: 使用 JavaScript 和 Ajax 发出异步请求 http://www.ibm.com/developerworks/cn/xml/wa-ajaxintro2/ 掌握 Ajax,第 3 部分: ...
Websphere同样可以下载到免费的试用版本,到IBM的developerWorks网站可以看到Websphere试用产品的下载和相关的Websphere的资料,developerWorks中文网站的连接是:http:///developerWorks/cn/wsdd/ ,Websphere的...
IBM的developerWorks网站,英语好的直接去英文主站点看。这里不但是一个极好的面向对象的分析设计网站,也是WebServices,Java,Linux极好的网站。强烈推荐!!! 3、http://www.javaworld.com/(英文) 关于Java很多...
在IBM developerWorks上面可以找到一篇文章,对主流的Java XML API进行的性能、功能和易用性的评测,dom4j无论在那个方面都是非常出色的。如今你可以看到越来越多的Java软件都在使用dom4j来读写XML,特别值得一提的...
本实例参考网上代码:http://www.ibm.com/developerworks/cn/java/j-javadev2-24/ 通过Jest和Junit单元测试的方法创建索引和检索 第一步:启动一个elasticsearch服务,bin目录下的elasticsearch.bat 第二步:建索引,...
Java hotswap示例。参考http://www.ibm.com/developerworks/cn/java/j-lo-hotswapcls/
IBM developerworks 上的面向对象软件开发和过程教程