2008-12-09 50 views
1

我使用GDOME.pm和我的劇本我有這樣一行:如何在XML :: GDOME中調試此錯誤的來源?

my $doc = XML::GDOME->createDocument("","",""); 

我不能爲我的生活弄清楚它爲什麼會說出這樣的錯誤:

NAMESPACE_ERR at /usr/lib/perl5/site_perl/5.6.1/i586-linux/XML/GDOME.pm line 103. 

這主要指:

sub createDocument { 
    my $class = shift; 
    return $di->createDocument(@_); ## it points to this LINE!! 
} 

是否有工具或東西會提供我更多的考慮其命名空間實際上是造成這個錯誤?

與此同時,我的解決方案沿着我的前額與鍵盤的線條相符, 但似乎沒有工作,除了導致一些頭痛和隨機形狀出現在我的額頭上。

感謝 〜史蒂夫

回答

1

文檔說:

$doc = XML::GDOME->createDocument($nsURI, $name, $dtd); 

Creates a new xml document. It will be in the $nsURI namespace, if $nsURI is defined, and its document element will have the name $name.

現在,您的示例使用""的命名空間。這與undefined不同,這是空字符串,它被定義。它抱怨空字符串不是有效的名稱空間。嘗試使用undef代替:

my $doc = XML::GDOME->createDocument(undef,"",""); 
0

的XML :: GDOME :: ::的DOMImplementation createDocument被稱爲有一個C程序,所以它遇到的錯誤報道如果從Perl代碼行調用它。 該錯誤會被gdome_di_createDocument引起設置錯誤代碼14

我不明白你報告錯誤:

perl -we'use XML::GDOME; XML::GDOME->createDocument("","","")' 

您可能會嘗試通過民主基金的「」代替;它會在調用gdome_di_createDocument時將undef轉換爲NULL。

0

很好,當我嘗試

my $doc = XML::GDOME->createDocument(undef,"",""); 

現在我得到這個警告。他們是什麼意思?

** CRITICAL **: file gdome-xml-element.c: line 235 (gdome_xml_el_setAttribute): assertion `value != NULL' failed. 

** CRITICAL **: file gdome-xml-element.c: line 235 (gdome_xml_el_setAttribute): assertion `value != NULL' failed. 

** CRITICAL **: file gdome-xml-element.c: line 235 (gdome_xml_el_setAttribute): assertion `value != NULL' failed. 

和奇怪的是,NAMESPACE_ERR似乎已經解決了,但它的奇怪,因爲以前我有一個有createDocument線等功能(「」,「」,「」),它工作正常。

所以有什麼特別的原因或觸發,我可能誤以爲是哪​​個錯誤觸發了?

+0

也許XML :: GDOME模塊不同,或者你的gdome2庫不同。試試(NULL,NULL,NULL)。 – ysth 2008-12-10 04:28:43