My question is when after modifying my XML file I write it to an output XML file using XMLOutputter of JDOM it writes a lot of extra stuff in the output XML file. I want to avoid that.
我的问题是,在修改我的XML文件之后,我使用JDOM的XMLOutputter将它写入输出XML文件,它在输出XML文件中写了很多额外的东西。我想避免这种情况。
My original xml snippet is:
我原来的xml片段是:
S. 9. INTERIM MEASURES, ETC. BY COURT dlac_p01_c02_s09 1100 Commentary C R Datta Law of Arbitration & Conciliation 2007 20071 Edition 2007 9788180382505 Copyright 2007 LexisNexis Butterworths Wadhwa Nagpur Datta S. 9. —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 section 36 , apply to a court—
( i ) for the appointment of a guardian for a minor or a person of unsound mind for the purposes of arbitral proceedings; or
( ii ) for an interim measure of protection in respect of any of the following matters, namely :— ( a ) the preservation, interim custody or sale of any goods which are the subject-matter of the arbitration agreement;
( b ) securing the amount in dispute in the arbitration;
( c ) 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;
( d ) interim injunction or the appointment of a receiver;
( e ) such other interim measure of protection as may appear to the court to be just and convenient,
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.
UNCITRAL Model Law
For the text of the related UNCITRAL Model Law, Analytical Commentary on Draft Model Law and UNCITRAL Report on Adoption of Model Laws, see Appendix 1 .
COMMENTS
1. Interim order by court
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.
2. Interim measure by court
Section 9 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 lis pendens 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 inter se 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. Grid Corporation of Orissa Ltd. v. AES Corporation, (2006) 134 Comp Case 305 (Ori) .
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.
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.
In effect, the Court shall have the same power to make orders under section 9 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 Section 9
My output XML snippet is :
我的输出XML代码段是:
S.
9.
—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
section 36
, apply to a court—
(
i
)
for the appointment of a guardian for a minor or a person of unsound mind for the purposes of arbitral proceedings; or
(
ii
)
for an interim measure of protection in respect of any of the following matters, namely :—
(
a
)
the preservation, interim custody or sale of any goods which are the subject-matter of the arbitration agreement;
(
b
)
securing the amount in dispute in the arbitration;
(
c
)
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;
(
d
)
interim injunction or the appointment of a receiver;
(
e
)
such other interim measure of protection as may appear to the court to be just and convenient,
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.
UNCITRAL Model Law
For the text of the related UNCITRAL Model Law, Analytical Commentary on Draft Model Law and UNCITRAL Report on Adoption of Model Laws, see
Appendix 1
.
COMMENTS
1. Interim order by court
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.
2. Interim measure by court
Section 9
And My code is:
我的代码是:
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
Just get rid of the line: xmlOutput.setFormat(Format.getPrettyFormat());
只需删除该行:xmlOutput.setFormat(Format.getPrettyFormat());
That line tells JDOM to reformat the output to be pretty. You want the default 'raw' format, so you do not need that line.
该行告诉JDOM将输出重新格式化为漂亮。您需要默认的“原始”格式,因此您不需要该行。
EDIT: hmmm, you have not given us the full input.... your 'original' XML example is not complete. There must be a DTD or XMLSchema too, and there are lots of missing namespace declarations. You therefore must have more data than you are giving in your problem description......
编辑:嗯,你没有给我们完整的输入....你的'原始'XML示例不完整。必须有一个DTD或XMLSchema,并且有很多缺少的命名空间声明。因此,您的问题描述中必须包含的数据多于您所提供的数据......
EDIT Again: Use JDOM 2.0.2 and read up on setSpecifiedAttributesOnly(boolean):
再次编辑:使用JDOM 2.0.2并读取setSpecifiedAttributesOnly(boolean):
http://www.jdom.org/docs/apidocs/org/jdom2/output/Format.html#setSpecifiedAttributesOnly(boolean)
Also see https://github.com/hunterhacker/jdom/issues/5 and https://github.com/hunterhacker/jdom/issues/66
另请参阅https://github.com/hunterhacker/jdom/issues/5和https://github.com/hunterhacker/jdom/issues/66
Rolf