<tfoot id='I9ems'></tfoot>

    1. <legend id='I9ems'><style id='I9ems'><dir id='I9ems'><q id='I9ems'></q></dir></style></legend>
    2. <small id='I9ems'></small><noframes id='I9ems'>

        <bdo id='I9ems'></bdo><ul id='I9ems'></ul>

        <i id='I9ems'><tr id='I9ems'><dt id='I9ems'><q id='I9ems'><span id='I9ems'><b id='I9ems'><form id='I9ems'><ins id='I9ems'></ins><ul id='I9ems'></ul><sub id='I9ems'></sub></form><legend id='I9ems'></legend><bdo id='I9ems'><pre id='I9ems'><center id='I9ems'></center></pre></bdo></b><th id='I9ems'></th></span></q></dt></tr></i><div id='I9ems'><tfoot id='I9ems'></tfoot><dl id='I9ems'><fieldset id='I9ems'></fieldset></dl></div>

        带有 PHP DOMDocument 的 xml 空标签

        时间:2023-11-30
      1. <legend id='9u5iW'><style id='9u5iW'><dir id='9u5iW'><q id='9u5iW'></q></dir></style></legend>
        • <bdo id='9u5iW'></bdo><ul id='9u5iW'></ul>
          <i id='9u5iW'><tr id='9u5iW'><dt id='9u5iW'><q id='9u5iW'><span id='9u5iW'><b id='9u5iW'><form id='9u5iW'><ins id='9u5iW'></ins><ul id='9u5iW'></ul><sub id='9u5iW'></sub></form><legend id='9u5iW'></legend><bdo id='9u5iW'><pre id='9u5iW'><center id='9u5iW'></center></pre></bdo></b><th id='9u5iW'></th></span></q></dt></tr></i><div id='9u5iW'><tfoot id='9u5iW'></tfoot><dl id='9u5iW'><fieldset id='9u5iW'></fieldset></dl></div>
            <tbody id='9u5iW'></tbody>

          <small id='9u5iW'></small><noframes id='9u5iW'>

          <tfoot id='9u5iW'></tfoot>

                  本文介绍了带有 PHP DOMDocument 的 xml 空标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  $xmlFile="<test>WPUBON</test>
                      <test1>SAPRTA</test1>
                      <test2></test2>
                      <test3></test3> ";
                  

                  我有一个如上所述的字符串,我正在使用 PHP DOMDocuments

                  I have a String as above and i'm parsing this using PHP DOMDocuments

                  $xml = new DOMDocument("1.0", "UTF-8");
                  $xml->loadXML($xmlFile);
                  $xml->save("out/".$xmlFileName.".xml");
                  

                  空标签的输出是 </test2> ,由于处理这个的应用程序,我需要是 <test2></test2>需要这样的xml.

                  The output of empty tags comes as </test2> which i need to be <test2></test2> due to the application which process this xml needed as that.

                  请告诉我一个方法来做到这一点!

                  Please let me know a way to do this !

                  推荐答案

                  查看DOMDocument::save().它支持选项 LIBXML_NOEMPTYTAG.试试这个:

                  Check the manual page of DOMDocument::save(). It supports the option LIBXML_NOEMPTYTAG. Try this:

                  $xml->save("out/".$xmlFileName.".xml", LIBXML_NOEMPTYTAG );
                  

                  这篇关于带有 PHP DOMDocument 的 xml 空标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:“XML Parsing Error: junk after document element" 下一篇:通过 PHP 在 XML 文件中添加新节点

                  相关文章

                    <bdo id='3Xjzi'></bdo><ul id='3Xjzi'></ul>

                  <i id='3Xjzi'><tr id='3Xjzi'><dt id='3Xjzi'><q id='3Xjzi'><span id='3Xjzi'><b id='3Xjzi'><form id='3Xjzi'><ins id='3Xjzi'></ins><ul id='3Xjzi'></ul><sub id='3Xjzi'></sub></form><legend id='3Xjzi'></legend><bdo id='3Xjzi'><pre id='3Xjzi'><center id='3Xjzi'></center></pre></bdo></b><th id='3Xjzi'></th></span></q></dt></tr></i><div id='3Xjzi'><tfoot id='3Xjzi'></tfoot><dl id='3Xjzi'><fieldset id='3Xjzi'></fieldset></dl></div>

                  <small id='3Xjzi'></small><noframes id='3Xjzi'>

                  <legend id='3Xjzi'><style id='3Xjzi'><dir id='3Xjzi'><q id='3Xjzi'></q></dir></style></legend>
                  1. <tfoot id='3Xjzi'></tfoot>