0
我有一個XML文檔後如何刪除XML文件中創建空行,例如刪除特定atrribute
<document>
<attribute id = 1 />
<attribute id = 2 />
<attribute id = 3 />
<attribute id = 4 />
<attribute id = 5 />
<attribute id = 6 />
</document>
我使用DOM解析器解析在我C++代碼的XML文件。 我刪除特定的屬性,比如:id = 3
使用API的從Xerces的庫中,我刪除屬性, 但我得到在我刪除了 屬性的地方一個空行。
刪除如下進行。我將從給定文件中刪除所需的屬性,並將其餘內容複製到臨時文件中,但是會創建一個空白行。
<document>
<attribute id = 1 />
<attribute id = 2 />
<attribute id = 4 />
<attribute id = 5 />
<attribute id = 6 />
</document>
我需要的輸出如下,空行不應該出現在文件中 刪除
<document>
<attribute id = 1 />
<attribute id = 2 />
<attribute id = 4 />
<attribute id = 5 />
<attribute id = 6 />
</document>
它可能就是你打印出來的方式。空白行可能不存在於實際文檔中。你如何解析/打印XML?另外,我認爲你對XML屬性和XML元素的概念有點模糊。 ''實際上是一個XML元素。 –
adarshr
2012-04-10 14:34:44