1
清理xml文件我已經獲得了意想不到的結果:tagsoup孤立了一些關閉父標記過早的屬性。它也會降低父標籤的名稱。tagsoup休息好xml
tagsoup前:
<Objects>
<Object>
<ObjectID>240</ObjectID>
[...]
<Status>Not Ready</Status>
<Title>Some description which includes word/word, 22,000</Title>
<Url>http://example.com/withquerystring?id=240&other=1&url=http%3A%2F%2Fredirected.example.com%2F40</Url>
[...]
<Owner>
<Name>JOHN MARSHALL, MR</Name>
</Owner>
</Object>
<Object>
<ObjectID>122</ObjectID>
[...]
tagsoup後:
<Objects>
<object>
<ObjectID>240</ObjectID>
[...]
<Status>Not Ready</Status>
</object>
<Title>Some description which includes word/word, 22,000</Title>
<Url>http://example.com/withquerystring?id=240&other=1&url=http%3A%2F%2Fredirected.example.com%2F40</Url>
[...]
<Owner>
<Name>JOHN MARSHALL, MR</Name>
</Owner>
<object>
<ObjectID>122</ObjectID>
[...]
我在使用這個庫的Java項目是:
import org.ccil.cowan.tagsoup.Parser;
import org.ccil.cowan.tagsoup.XMLWriter;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
我使用的Java 6。
任何線索爲tha T'
有效的XML文件的所需的輸出將是相同的文件(也許只是改變的細節,而不是結構),不是嗎?