我的问题是,在修改我的XML文件后,我使用JDOM的XMLOutputter将其写入输出XML文件,它在输出XML文件中写了很多额外的东西。我想避免这种情况。
我原来的xml片段是:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE COMMENTARYDOC PUBLIC "-//LEXISNEXIS//DTD GLP Commentarydoc v006//EN" "commentarydoc-norm.dtd"><COMMENTARYDOC xmlns:lnvxe="http://www.lexis-nexis.com/lnvxe" xmlns:lnvx="http://www.lexis-nexis.com/lnvx" xmlns:lnv="http://www.lexis-nexis.com/lnv" xmlns:lnvni="http://www.lexis-nexis.com/lnvni" xmlns:lnci="http://www.lexis-nexis.com/lnci" xmlns:lnlit="http://www.lexis-nexis.com/lnlit" xmlns:lnclx="http://www.lexis-nexis.com/lnclx" xmlns:lncle="http://www.lexis-nexis.com/lncle" xmlns:lndel="http://www.lexis-nexis.com/lndel" xmlns:lngntxt="http://www.lexis-nexis.com/lngntxt" xmlns:lndocmeta="http://www.lexis-nexis.com/lndocmeta" xmlns:glp="http://www.lexis-nexis.com/glp" xmlns:case="http://www.lexis-nexis.com/glp/case" xmlns:leg="http://www.lexis-nexis.com/glp/leg" xmlns:ci="http://www.lexis-nexis.com/ci" xmlns:in="http://www.lexis-nexis.com/glp/in" xmlns:dig="http://www.lexis-nexis.com/glp/dig" xmlns:cttr="http://www.lexis-nexis.com/glp/cttr" xmlns:comm="http://www.lexis-nexis.com/glp/comm" xmlns:frm="http://www.lexis-nexis.com/glp/frm" xmlns:admt="http://www.lexis-nexis.com/glp/admt" xmlns:dict="http://www.lexis-nexis.com/glp/dict" xmlns:jrnl="http://www.lexis-nexis.com/glp/jrnl" xmlns:op="http://www.lexis-nexis.com/glp/op" xmlns:xhtml="http://www.w3c.org/1999/xhtml" xmlns:docinfo="http://www.lexis-nexis.com/glp/docinfo" xmlns:nitf="urn:nitf:iptc.org.20010418.NITF"><docinfo partitionnum="COMM1" browseprev="true" browsenext="true"><docinfo:doc-heading>S. 9. INTERIM MEASURES, ETC. BY COURT</docinfo:doc-heading><docinfo:doc-id>dlac_p01_c02_s09</docinfo:doc-id><docinfo:doc-lang lang="en"/><docinfo:doc-country iso-cc="IN"/><docinfo:hier><docinfo:hierlev role="ancestor"><heading><title>THE ARBITRATION AND CONCILIATION ACT, 1996</title></heading><docinfo:hierlev role="ancestor"><heading><title>PART I ARBITRATION</title></heading><docinfo:hierlev role="ancestor"><heading><title>CHAPTER 2 ARBITRATION AGREEMENT</title></heading><docinfo:hierlev role="ancestor"><heading><title>POWER OF JUDICIAL AUTHORITY TO REFER PARTIES TO ARBITRATION</title></heading><docinfo:hierlev role="me"><heading><title>S. 9. Interim measures, etc. by court</title></heading></docinfo:hierlev></docinfo:hierlev></docinfo:hierlev></docinfo:hierlev></docinfo:hierlev></docinfo:hier><docinfo:bookseqnum>1100</docinfo:bookseqnum><docinfo:lbu-meta><docinfo:metaitem name="lbu-sourcename" value="Law of Arbitration & Conciliation"/></docinfo:lbu-meta><docinfo:selector>Commentary</docinfo:selector></docinfo><comm:info><publication>C R Datta Law of Arbitration & Conciliation</publication><pubdate><date year="2007">2007</date> 2007</pubdate><edition>1 Edition 2007</edition><isbn>9788180382505</isbn><copyright>Copyright 2007 LexisNexis Butterworths Wadhwa Nagpur</copyright><contrib><person><name.detail><name.family>Datta</name.family></name.detail></person></contrib></comm:info><comm:body><level leveltype="comm1"><bodytext searchtype="LEGISLATION"><legfragment><leg:level><leg:level-vrnt leveltype="section"><leg:heading inline="true"><desig searchtype="SEC-NUM"><desiglabel>S.</desiglabel><designum>9.</designum></desig><title searchtype="FORM-TITLE"><refpt id="dlacs009" type="ext"/>Interim measures, etc. by court.</title></leg:heading><leg:levelbody><leg:bodytext><pgrp><p><text>—A party may, before, or during arbitral proceedings or at any time after the making of the arbitral award but before it is enforced in accordance with <ci:cite searchtype="LEG-REF"><ci:sesslaw><ci:sesslawinfo><ci:jurisinfo><ci:in/></ci:jurisinfo><ci:hier><ci:hierlev label="section" num="36"/></ci:hier></ci:sesslawinfo><ci:sesslawref><ci:standardname normpubcode="IN1996AACA01"/></ci:sesslawref></ci:sesslaw><ci:content>section 36</ci:content></ci:cite>, apply to a court—</text></p><l><li><lilabel>( <emph typestyle="it">i</emph>)</lilabel><p><text>for the appointment of a guardian for a minor or a person of unsound mind for the purposes of arbitral proceedings; or</text></p></li><li><lilabel>( <emph typestyle="it">ii</emph>)</lilabel><p><text>for an interim measure of protection in respect of any of the following matters, namely :—</text><l><li><lilabel>( <emph typestyle="it">a</emph>)</lilabel><p><text>the preservation, interim custody or sale of any goods which are the subject-matter of the arbitration agreement;</text></p></li><li><lilabel>( <emph typestyle="it">b</emph>)</lilabel><p><text>securing the amount in dispute in the arbitration;</text></p></li><li><lilabel>( <emph typestyle="it">c</emph>)</lilabel><p><text>the detention, preservation or inspection of any property or thing which is the subject-matter of the dispute in arbitration, or as to which any question may arise therein and authorising for any of the aforesaid purposes any person to enter upon any land or building in the possession of any party, or authorising any samples to be taken or any observation to be made, or experiment to be tried, which may be necessary or expedient for the purpose of obtaining full information or evidence;</text></p></li><li><lilabel>( <emph typestyle="it">d</emph>)</lilabel><p><text>interim injunction or the appointment of a receiver;</text></p></li><li><lilabel>( <emph typestyle="it">e</emph>)</lilabel><p><text>such other interim measure of protection as may appear to the court to be just and convenient,</text></p></li></l></p></li></l><p><text>and the Court shall have the same power for making orders as it has for the purpose of, and in relation to, any proceedings before it.</text></p></pgrp></leg:bodytext></leg:levelbody></leg:level-vrnt></leg:level></legfragment></bodytext><bodytext searchtype="COMMENTARY"><pgrp><p><text><emph typestyle="bf">UNCITRAL Model Law</emph></text></p><p><text>For the text of the related UNCITRAL Model Law, Analytical Commentary on Draft Model Law and UNCITRAL Report on Adoption of Model Laws, see <emph typestyle="it">Appendix 1</emph>.</text></p></pgrp><pgrp><p><text><emph typestyle="bf">COMMENTS</emph></text></p></pgrp><pgrp><p><text><emph typestyle="bf">1. Interim order by court</emph></text></p><p><text>A party to an Arbitration may apply to Court for Interim Orders. Such an application may be made before, during, or after the proceedings, but before enforcement of the Award. Such a prayer may be made for the appointment of a Guardian of a Minor child or for a person of unsound mind for an interim order for protection, interim custody, sale of goods, securing amount in dispute, detention, preservation or inspection of any property. An order may be made for inspection of the disputed goods or the property or for anything to obtain requisite evidence. Interim injunction may be issued or a receiver may be appointed. Any other relevant orders may be made for protection and preservation of the interests of the parties concerned. Further and other orders may be made as the Court may think it fit and proper.</text></p></pgrp><pgrp><p><text><emph typestyle="bf">2. Interim measure by court</emph></text></p><p><text><ci:cite searchtype="LEG-REF"><ci:sesslaw><ci:sesslawinfo><ci:jurisinfo><ci:in/></ci:jurisinfo><ci:hier><ci:hierlev label="section" num="9"/></ci:hier></ci:sesslawinfo><ci:sesslawref><ci:standardname normpubcode="IN1996AACA01"/></ci:sesslawref></ci:sesslaw><ci:content>Section 9</ci:content></ci:cite> of the Arbitration & Conciliation Act, 1996 vests power upon a Court to pass orders with regard to interim measures for the purpose of safeguarding the interest of the parties to the arbitration proceedings so that the award when made is not frustrated. Clause 6 of the agreement imposed a clear restriction on sale, transfer, charge or to encumber any of their shares or any interest in any such shares from the date of agreement without prior written consent of the appellant. Unless the lis was protected during <emph typestyle="it">lis pendens</emph> it would not only cause great prejudice but also irreparable loss to the appellant. It is the inherent duty of the Court to protect the lis so as to prevent any overt act by any of the parties. The dispute <emph typestyle="it">inter se</emph> the parties having been referred to international arbitration respondent No. 1 and all others deriving right, title and interest in respect of shares, its agents and subsidiaries were restrained from alienating any of the shares till passing of the award in the international arbitration. <emph typestyle="it"> Grid Corporation of Orissa Ltd. v. AES Corporation, </emph><ci:cite searchtype="CASE-REF"><ci:case><ci:caseinfo><ci:casename><ci:party1 name="Grid Corporation of Orissa Ltd."/><ci:procphrase txt="v."/><ci:party2 name="AES Corporation,"/></ci:casename></ci:caseinfo><ci:caseref><ci:reporter value="INCOMCAS"/><ci:volume num="134"/><ci:edition><ci:date year="2006"/></ci:edition><ci:page num="305"/></ci:caseref></ci:case><ci:content>(2006) 134 Comp Case 305 (Ori)</ci:content></ci:cite>.</text></p><p><text>If there is an arbitration agreement and a party intends to settle his disputes through arbitration then he may apply to Court for interim orders for the preservation and protection of the subject-matter of the dispute. Such application for interim order can be made before commencement of arbitration proceeding and also when the arbitration proceeding is going on before the Arbitrator. A party may apply to the Arbitrator also for an interim order. The right to make application to the Court for interim order can also be exercised even after the award is given but before its execution.</text></p><p><text>Interim order prayed for may be (a) for the appointment of a guardian of a minor or a person of unsound mind for the purpose of arbitral proceedings, (b) for the protection, preservation, interim custody or sale of goods being the subject-matter of the dispute, (c) directing to secure the amounts in dispute. This may be by directing to furnish bank guarantee or deposit the amount in a bank in a separate account withdrawable only on the order of the Arbitrator, (d) directing detention, preservation or inspection of the subject-matter of the dispute and, if required, to authorise any person to enter upon or into any land or building in possession of any of the parties or authorise samples to be taken, any experiment to be tried, observations to be obtained which may be necessary or expedient for obtaining full information or evidence to decide the dispute, (e) interim injunction may be issued in the form which is required in the facts and circumstances of the case and if required a Receiver may be appointed over the disputed subject-matter; (f) the Arbitrator will have the power to make any other order for the protection of the disputed property as the Court may think just and convenient.</text></p><p><text>In effect, the Court shall have the same power to make orders under <ci:cite searchtype="LEG-REF"><ci:sesslaw><ci:sesslawinfo><ci:jurisinfo><ci:in/></ci:jurisinfo><ci:hier><ci:hierlev label="section" num="9"/></ci:hier></ci:sesslawinfo><ci:sesslawref><ci:standardname normpubcode="IN1996AACA01"/></ci:sesslawref></ci:sesslaw><ci:content>section 9</ci:content></ci:cite> as it has in any other proceedings before the court. In other words, the Court has all the powers under the Code of Civil Procedure and can make orders as the circumstances may require when an application under <ci:cite searchtype="LEG-REF"><ci:sesslaw><ci:sesslawinfo><ci:jurisinfo><ci:in/></ci:jurisinfo><ci:hier><ci:hierlev label="section" num="9"/></ci:hier></ci:sesslawinfo><ci:sesslawref><ci:standardname normpubcode="IN1996AACA01"/></ci:sesslawref></ci:sesslaw><ci:content>Section 9</ci:content></ci:cite>
我的输出XML代码段是:
<level leveltype="comm1" subdoc="false" ln.type="seg" ln.segname="TEXT-1" ln.nsprefix="lnv:">
<bodytext searchtype="LEGISLATION" ln.nsprefix="lnvxe:">
<legfragment ln.nsprefix="lnvxe:">
<leg:level subdoc="false" ln.type="seg" ln.segname="LEG-TEXT-1" ln.nsprefix="lnv:">
<leg:level-vrnt leveltype="section" subdoc="false" ln.nsprefix="lnvxe:">
<leg:heading inline="true" subdoc="false" ln.nsprefix="lnvxe:">
<desig searchtype="SEC-NUM" ln.nsprefix="lnvxe:">
<desiglabel ln.nsprefix="lnvxe:">S.</desiglabel>
<designum ln.nsprefix="lnvxe:">9.</designum>
</desig>
<title searchtype="FORM-TITLE" ln.nsprefix="lnvxe:">
<refpt id="dlacs009" type="ext" ln.nsprefix="NONE" />
Interim measures, etc. by court.
</title>
</leg:heading>
<leg:levelbody ln.nsprefix="lnvxe:">
<leg:bodytext ln.nsprefix="lnvxe:">
<pgrp subdoc="false" ln.nsprefix="lnvxe:">
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
—A party may, before, or during arbitral proceedings or at any time after the making of the arbitral award but before it is enforced in accordance with
<ci:cite searchtype="LEG-REF" srcstatus="normal" impcit="main" pub="none" pub-status="none" loadable="1" historycite="0" validate="1" xlink.show="replace" xlink.actuate="user" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:sesslaw status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:sesslawinfo status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:jurisinfo status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:in status="valid" generated="0" attreq="0" ln.nsprefix="lnci:" />
</ci:jurisinfo>
<ci:hier status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:hierlev label="section" num="36" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:" />
</ci:hier>
</ci:sesslawinfo>
<ci:sesslawref official="0" regional="0" publicdomain="0" xlink.show="replace" xlink.actuate="user" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:standardname normpubcode="IN1996AACA01" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:" />
</ci:sesslawref>
</ci:sesslaw>
<ci:content popname="0" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">section 36</ci:content>
</ci:cite>
, apply to a court—
</text>
</p>
<l ln.nsprefix="lnvxe:" type="def">
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">i</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">for the appointment of a guardian for a minor or a person of unsound mind for the purposes of arbitral proceedings; or</text>
</p>
</li>
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">ii</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">for an interim measure of protection in respect of any of the following matters, namely :—</text>
<l ln.nsprefix="lnvxe:" type="def">
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">a</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">the preservation, interim custody or sale of any goods which are the subject-matter of the arbitration agreement;</text>
</p>
</li>
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">b</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">securing the amount in dispute in the arbitration;</text>
</p>
</li>
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">c</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">the detention, preservation or inspection of any property or thing which is the subject-matter of the dispute in arbitration, or as to which any question may arise therein and authorising for any of the aforesaid purposes any person to enter upon any land or building in the possession of any party, or authorising any samples to be taken or any observation to be made, or experiment to be tried, which may be necessary or expedient for the purpose of obtaining full information or evidence;</text>
</p>
</li>
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">d</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">interim injunction or the appointment of a receiver;</text>
</p>
</li>
<li ln.nsprefix="lnvxe:">
<lilabel ln.nsprefix="lnvxe:">
(
<emph typestyle="it" ln.nsprefix="NONE">e</emph>
)
</lilabel>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">such other interim measure of protection as may appear to the court to be just and convenient,</text>
</p>
</li>
</l>
</p>
</li>
</l>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">and the Court shall have the same power for making orders as it has for the purpose of, and in relation to, any proceedings before it.</text>
</p>
</pgrp>
</leg:bodytext>
</leg:levelbody>
</leg:level-vrnt>
</leg:level>
</legfragment>
</bodytext>
<bodytext searchtype="COMMENTARY" ln.nsprefix="lnvxe:">
<pgrp subdoc="false" ln.nsprefix="lnvxe:">
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
<emph typestyle="bf" ln.nsprefix="NONE">UNCITRAL Model Law</emph>
</text>
</p>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
For the text of the related UNCITRAL Model Law, Analytical Commentary on Draft Model Law and UNCITRAL Report on Adoption of Model Laws, see
<emph typestyle="it" ln.nsprefix="NONE">Appendix 1</emph>
.
</text>
</p>
</pgrp>
<pgrp subdoc="false" ln.nsprefix="lnvxe:">
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
<emph typestyle="bf" ln.nsprefix="NONE">COMMENTS</emph>
</text>
</p>
</pgrp>
<pgrp subdoc="false" ln.nsprefix="lnvxe:">
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
<emph typestyle="bf" ln.nsprefix="NONE">1. Interim order by court</emph>
</text>
</p>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">A party to an Arbitration may apply to Court for Interim Orders. Such an application may be made before, during, or after the proceedings, but before enforcement of the Award. Such a prayer may be made for the appointment of a Guardian of a Minor child or for a person of unsound mind for an interim order for protection, interim custody, sale of goods, securing amount in dispute, detention, preservation or inspection of any property. An order may be made for inspection of the disputed goods or the property or for anything to obtain requisite evidence. Interim injunction may be issued or a receiver may be appointed. Any other relevant orders may be made for protection and preservation of the interests of the parties concerned. Further and other orders may be made as the Court may think it fit and proper.</text>
</p>
</pgrp>
<pgrp subdoc="false" ln.nsprefix="lnvxe:">
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
<emph typestyle="bf" ln.nsprefix="NONE">2. Interim measure by court</emph>
</text>
</p>
<p ln.nsprefix="NONE">
<text ln.nsprefix="lnvxe:">
<ci:cite searchtype="LEG-REF" srcstatus="normal" impcit="main" pub="none" pub-status="none" loadable="1" historycite="0" validate="1" xlink.show="replace" xlink.actuate="user" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:sesslaw status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:sesslawinfo status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:jurisinfo status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:in status="valid" generated="0" attreq="0" ln.nsprefix="lnci:" />
</ci:jurisinfo>
<ci:hier status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:hierlev label="section" num="9" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:" />
</ci:hier>
</ci:sesslawinfo>
<ci:sesslawref official="0" regional="0" publicdomain="0" xlink.show="replace" xlink.actuate="user" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">
<ci:standardname normpubcode="IN1996AACA01" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:" />
</ci:sesslawref>
</ci:sesslaw>
<ci:content popname="0" status="valid" generated="0" attreq="0" ln.nsprefix="lnci:">Section 9</ci:content>
</ci:cite>
我的代码是:
SAXBuilder builder = new SAXBuilder();
builder.setExpandEntities(false);
File xmlFile = new File("dlac_p01_c02_s09.xml");
try {
Document document = (Document) builder.build(xmlFile);
Element rootNode = document.getRootElement();
listChildren(rootNode, 0);
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.setFormat(Format.getPrettyFormat());
xmlOutput.output(document, new FileOutputStream(
"dlac_p01_c02_s09_output.xml"));
} catch (IOException io) {
System.out.println(io.getMessage());
} catch (JDOMException jdomex) {
System.out.println(jdomex.getMessage());
}
}
答案 0 :(得分:0)
摆脱界限:xmlOutput.setFormat(Format.getPrettyFormat());
该行告诉JDOM将输出重新格式化为漂亮。您需要默认的“原始”格式,因此您不需要该行。
编辑:嗯,你没有给我们完整的输入....你的'原始'XML示例不完整。必须有一个DTD或XMLSchema,并且有很多缺少的命名空间声明。因此,您的问题描述中必须包含的数据超过您的数据......再次编辑:使用JDOM 2.0.2并阅读setSpecifiedAttributesOnly(boolean):
http://www.jdom.org/docs/apidocs/org/jdom2/output/Format.html#setSpecifiedAttributesOnly(boolean)
另见https://github.com/hunterhacker/jdom/issues/5和https://github.com/hunterhacker/jdom/issues/66
罗尔夫