不生成
<?xml version="1.0" encoding="UTF-8"?><event type="sync_data" time="6/20/08 11:34 AM" />而生成
<?xml version="1.0" encoding="UTF-8"?><event type="sync_data" time="6/20/08 11:34 AM">
</event>谢谢。

解决方案 »

  1.   

    <?xml version="1.0" encoding="UTF-8"?> 
    <event type="sync_data" time="6/20/08 11:34 AM" /> 与<?xml version="1.0" encoding="UTF-8"?> 
    <event type="sync_data" time="6/20/08 11:34 AM"> 
    </event> 功能是一样的。你比如说:
    <div  id="class"/> ...

    <div  id="class"> ...</div>功能也是一样的。
      

  2.   

    呵呵,我觉得用setText(" ");应该可以吧,没试,你试试看能行不。这个要求有点小BT。
      

  3.   

    Jdom  xml  正在为此事 苦恼
      

  4.   

    呵呵,告诉兄弟们吧,我没有试,不过应该就是这个了:
    static Format  getPrettyFormat()
              Returns a new Format object that performs whitespace beautification with 2-space indents, uses the UTF-8 encoding, doesn't expand empty elements, includes the declaration and encoding, and uses the default entity escape strategy.
    static Format  getRawFormat()
              Returns a new Format object that performs no whitespace changes, uses the UTF-8 encoding, doesn't expand empty elements, includes the declaration and encoding, and uses the default entity escape strategy.
     Format  setExpandEmptyElements(boolean expandEmptyElements)
              This will set whether empty elements are expanded from <tagName/> to <tagName></tagName>.
      

  5.   

    用getPrettyFormat()->setExpandEmptyElements(true)或者getRawFormat()应该都可以。