Hey everyone,
I've been working on parsing rss feeds with libxml-ruby, and
everything seemed to be working great until I ran across files without
namespaces defined.  For example, if I try to parse this semi-valid
xml file:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" >
<channel>
  <media:thumbnail url="http://nowhere.com/test.jpg"/>
</channel>
</rss>

libxml strips the media namespace out of media:thumbnail.  Is there a
way to make libxml be less strict about namespaces?

Also, if I try to do an xpath search using a nonexistant namespace,
such as doc.root.search("itunes:keywords") I get an error:
Undefined namespace prefix
xmlXPathCompiledEval: evaluation failed

Some googling tells me I need to register the namespace, but I
couldn't figure out how to do that with the Ruby bindings.  I guess
this post basically boils down to two questions:
1) Is it possible to turn off strict namespace checking?
2) How do I register a namespace using the ruby bindings?

Thanks,
- Galen Pahlke
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to