Author:
buzzomatic
Version:
1.1.0
Released:
21 November 2011
Category:
Other, and Workflow

Closed#2: (0.1.0) Selection fails when XML contains namespaces (e.g. Atom)

There is a bug XML elements are namespaced. For example:

<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:georss="http://www.georss.org/georss">

This means that if I use the following for my Included Elements XPath:

/rss//item

Nothing will be found.

Dynamic XML DSs get around this by allowing the author to add any namespaces they required as Name/URI pairs. I think the XML Importer needs the same option. To include these namespaces the Dynamic DS ingeniously creates an XSLT stylesheet on the fly, appends the namespaces as processing instructions, and applies it against the XML that is grabbed.

I think XML Importer should do exactly the same. Perhaps its grabbing of XML should even create a Dynamic DS object in memory so that the code for obtaining an XML file, including namespaces, and returning just the XML required, all remains in Symphony’s core (datasource.dynamic_xml.php).

Might be less maintenance in the long run? And is much cooler :-)

Fixed in master. All I did was save a namespaces array and apply those namespaces to the xpath object that does the querying. Seems to work fine!

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details