3
您好我有如下一個xml:Perl的XML :: SAX解析
<employees>
<employee>
<firstname>John</firstname>
<lastname>Doe</lastname>
<age>gg</age>
<department>Operations</department>
<amount Ccy="EUR">100</amount>
<joinDate> 12/12/2011 </joinDate>
</employee>
<employee>
<firstname>John1111</firstname>
<lastname>Doe1111</lastname>
<age>gg</age>
<department>Operations</department>
<amount Ccy="EUR">200</amount>
<joinDate> 12/13/2011 </joinDate>
</employee>
</employees>
我想這解析XML使用SAX ::。所以我重寫了start_element和end_element和characters方法。我必須處理兩個場景,我不知道如何處理。 1)如果joinDate爲null,則將joinDate作爲sysdate。 2)總結金額並獲得一個值作爲totalAmount。如何在perl中使用XML :: SAX模塊來做到這一點。
拋出一些光我需要重寫的方法來做到這一點,一小段代碼將幫助。
感謝, SRIKANTH
感謝flesk。你的帖子對我總是有幫助的。 – user1019072 2012-01-11 20:45:48