tags:

views:

73

answers:

3

Hi there,

I'm using GDOME.pm and in my script I have this line:

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

I can't for the life of me figure out why it's coming out with this error:

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

which basically points to:

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

Is there a tool or something that would provide me more look into which namespaces is actually causing this error?

In the meantime, my solution goes along the lines of my forehead meeting the keyboard, but that doesn't seem to be working except for causing some headache, and random shapes appearing on my forehead.

thanks ~steve

+1  A: 

The documentation says:

$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.

Now, your example uses "" for the namespace. That's not the same as undefined, that's the empty string and it is defined. It's complaining that the empty string is not a valid namespace. Try using undef instead:

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

The XML::GDOME::DOMImplementation::createDocument that is called there is a C routine, so errors encountered in it are reported as if from the line of Perl code that called it. That error will be caused by gdome_di_createDocument setting error code 14.

I don't get the error you report with:

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

You might try passing undef instead of ""; it translates undef to NULL in the call to gdome_di_createDocument.

ysth
A: 

well when i try

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

now i'm getting this warnings. what does they mean?

** 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.

and weird thing is that the namespace_err seems to have been resolved, but it's weird because previously i have other functions which have the createDocument line ("","","") and it works fine.

so is there any special reason or trigger that i may have mislooked which caused the error trigger?

melaos
Perhaps either the XML::GDOME module is different or your gdome2 lib is different. Try it with (NULL, NULL, NULL).
ysth