所以我想在VB6中使用SAX解析(用於古老的COM組件)來編輯xml(輸出是一個xml)。我更喜歡使用DOM解析,但是xml的大小(超過20MB的可能)迫使我使用SAX。我相對較新的VB6,我沒有經驗的SAX解析。我在網上查了一下,但即使是我發現的最好的資源(http://www.developerfusion.com/article/84405/sax-and-vb-6/)也讓我對如何將grandchilren標籤與現有屬性進行組合爲重命名的標籤創建一個更長的屬性。使用Sax解析在VB6中編輯和寫入XML
我有基本的框架設置(如鏈接網站所示)。我想我可能會將大部分繁重工作限制在兩個或三個子程序(_startDocument中的前四行,使用_startElement獲取描述標記,並將描述放入具有endElement的函數標記中)。然而我缺乏VB6/SAX的知識在這裏真的讓我受到傷害。任何幫助將不勝感激。
這裏是XML看起來像現在;
<errordetails>
<error desc=」Count: 2」/>
<error desc=」System: System X」/>
<error desc=」Reason: Reason X」/>
<functions>
<function name=」x1」 Description=」y1」>
<violations count="2">
<violation><source>admin</source><description>the first reason</description></violation>
<violation><source>admin</source><description>the second reason</description></violation>
</violations>
</function>
<function name=」x2」 Description=」y2」>
<violations count="1">
<violation><source>admin</source><description>another reason</description></violation>
</violations>
</function>
</functions>
</errordetails>
這是我想要的xml看起來像;
<errordetails>
<error desc=」Count: 2」/>
<error desc=」System: System X」/>
<error desc=」Reason: Reason X」/>
<error desc=」FunctionName: x1, FunctionDescription: y1, FunctionReason: the first reason, FunctionReason: the second reason」/>
<error desc=」FunctionName: x2, FunctionDescription: y2, FunctionReason: another reason"/>
</errordetails>
謝謝。你給了我信心,這完全在我的能力範圍內。 – 2011-06-03 15:37:49