热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在将xml写入输出文件时要避免额外的东西-Wanttoavoidextrastuffwhenwritingxmltooutputfile

MyquestioniswhenaftermodifyingmyXMLfileIwriteittoanoutputXMLfileusingXMLOutputter

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 COURTdlac_p01_c02_s091100CommentaryC R Datta Law of Arbitration & Conciliation2007 20071 Edition 20079788180382505Copyright 2007 LexisNexis Butterworths Wadhwa NagpurDattaS.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());
        }
    }
    

    1 个解决方案

    #1


    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


    推荐阅读
    • Android日历提醒软件开源项目分享及使用教程
      本文介绍了一款名为Android日历提醒软件的开源项目,作者分享了该项目的代码和使用教程,并提供了GitHub项目地址。文章详细介绍了该软件的主界面风格、日程信息的分类查看功能,以及添加日程提醒和查看详情的界面。同时,作者还提醒了读者在使用过程中可能遇到的Android6.0权限问题,并提供了解决方法。 ... [详细]
    • 微软头条实习生分享深度学习自学指南
      本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
    • 在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板
      本文介绍了在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板的方法和步骤,包括将ResourceDictionary添加到页面中以及在ResourceDictionary中实现模板的构建。通过本文的阅读,读者可以了解到在Xamarin XAML语言中构建控件模板的具体操作步骤和语法形式。 ... [详细]
    • CentOS7.8下编译muduo库找不到Boost库报错的解决方法
      本文介绍了在CentOS7.8下编译muduo库时出现找不到Boost库报错的问题,并提供了解决方法。文章详细介绍了从Github上下载muduo和muduo-tutorial源代码的步骤,并指导如何编译muduo库。最后,作者提供了陈硕老师的Github链接和muduo库的简介。 ... [详细]
    • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
      本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
    • 推荐系统遇上深度学习(十七)详解推荐系统中的常用评测指标
      原创:石晓文小小挖掘机2018-06-18笔者是一个痴迷于挖掘数据中的价值的学习人,希望在平日的工作学习中,挖掘数据的价值, ... [详细]
    • Android系统移植与调试之如何修改Android设备状态条上音量加减键在横竖屏切换的时候的显示于隐藏
      本文介绍了如何修改Android设备状态条上音量加减键在横竖屏切换时的显示与隐藏。通过修改系统文件system_bar.xml实现了该功能,并分享了解决思路和经验。 ... [详细]
    • MyBatis多表查询与动态SQL使用
      本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
    • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
    • mac php错误日志配置方法及错误级别修改
      本文介绍了在mac环境下配置php错误日志的方法,包括修改php.ini文件和httpd.conf文件的操作步骤。同时还介绍了如何修改错误级别,以及相应的错误级别参考链接。 ... [详细]
    • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
    • Linux的uucico命令使用方法及工作模式介绍
      本文介绍了Linux的uucico命令的使用方法和工作模式,包括主动模式和附属模式。uucico是用来处理uucp或uux送到队列的文件传输工具,具有操作简单快捷、实用性强的特点。文章还介绍了uucico命令的参数及其说明,包括-c或--quiet、-C或--ifwork、-D或--nodetach、-e或--loop、-f或--force、-i或--stdin、-I--config、-l或--prompt等。通过本文的学习,读者可以更好地掌握Linux的uucico命令的使用方法。 ... [详细]
    • 本文介绍了使用Spark实现低配版高斯朴素贝叶斯模型的原因和原理。随着数据量的增大,单机上运行高斯朴素贝叶斯模型会变得很慢,因此考虑使用Spark来加速运行。然而,Spark的MLlib并没有实现高斯朴素贝叶斯模型,因此需要自己动手实现。文章还介绍了朴素贝叶斯的原理和公式,并对具有多个特征和类别的模型进行了讨论。最后,作者总结了实现低配版高斯朴素贝叶斯模型的步骤。 ... [详细]
    • Gitlab接入公司内部单点登录的安装和配置教程
      本文介绍了如何将公司内部的Gitlab系统接入单点登录服务,并提供了安装和配置的详细教程。通过使用oauth2协议,将原有的各子系统的独立登录统一迁移至单点登录。文章包括Gitlab的安装环境、版本号、编辑配置文件的步骤,并解决了在迁移过程中可能遇到的问题。 ... [详细]
    • [echarts] 同指标对比柱状图相关的知识介绍及应用示例
      本文由编程笔记小编为大家整理,主要介绍了echarts同指标对比柱状图相关的知识,包括对比课程通过率最高的8个课程和最低的8个课程以及全校的平均通过率。文章提供了一个应用示例,展示了如何使用echarts制作同指标对比柱状图,并对代码进行了详细解释和说明。该示例可以帮助读者更好地理解和应用echarts。 ... [详细]
    author-avatar
    Liushan2502897753
    这个家伙很懒,什么也没留下!
    PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有