Allow to initialize NS with prefix=nil (aka default namespace)
Signed-off-by: Stephan Maka <[EMAIL PROTECTED]>
---
ext/libxml/ruby_xml_ns.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ext/libxml/ruby_xml_ns.c b/ext/libxml/ruby_xml_ns.c
index 8c3c16c..517fccf 100644
--- a/ext/libxml/ruby_xml_ns.c
+++ b/ext/libxml/ruby_xml_ns.c
@@ -26,9 +26,11 @@ VALUE
ruby_xml_ns_initialize(VALUE self, VALUE node, VALUE href, VALUE prefix) {
xmlNodePtr xnode;
xmlNsPtr xns;
+ xmlChar *prefixS;
Data_Get_Struct(node, xmlNode, xnode);
- xns = xmlNewNs(xnode, (xmlChar*)StringValuePtr(href),
(xmlChar*)StringValuePtr(prefix));
+ prefixS = NIL_P(prefix) ? NULL : StringValuePtr(prefix);
+ xns = xmlNewNs(xnode, (xmlChar*)StringValuePtr(href), prefixS);
DATA_PTR(self) = xns;
return self;
--
1.5.6.3
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel