我就是想写下面这样一个xml文件。
<note xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
只是我强调了一下其中我搞不定的地方是xmlns="http://www.w3schools.com"这个属性。
<note xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
只是我强调了一下其中我搞不定的地方是xmlns="http://www.w3schools.com"这个属性。
解决方案 »
- struts2的action怎么复用bean的属性及getter和setter?
- 急!!!!!FCF_MSColumn3D.swf
- 使用DWR的推技术,怎么指定将信息推送到 某一个 打开的 浏览器啊?
- 求将excel数据解析为xml,然后插入数据库的实现思路或源代码.
- 找工作之前 要做什么样的准备
- 在strut中什么情况下使用动态FromBean(使用它又什么好处)?
- 关于培训的问题。
- 初学JBOSS问题,我已经部署了一个应用在一个TOMCAT里面,现在需要JMS的东西,所以在另外装了一个JBOSS
- 作为即将毕业的学生,要学java到社么程度去公司才不用参培训
- 请教各位大虾,如何获得ms_dos命令的执行结果或如何如何获得网卡的MAC地址?急急急!!!
- 一个spring问题
- hibernate 运行hbm2java时报错
Element roorElement = doc.getRootElement();
roorElement.addNamespace("","http://www.w3schools.com");
其实我就是想写一个符合这个xsd要求的xml,xsd如下:
<xs:schema xmlns="http://xxx.com/xxx" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xxx.com/xxx" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="report">
<xs:annotation>
<xs:documentation>root element</xs:documentation>
</xs:annotation>
......
......
我再发问,呵呵
Document doc = xr.read(xmlFile);
Element roorElement = doc.getRootElement();
roorElement.addNamespace("","http://www.w3schools.com");你把你程序贴出来看看
ele.addAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");