Search

This extension is now under the control of the Symphonists and it's Github URL has changed to https://github.com/symphonists/xmlimporter

A new extension, "XML Importer" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

XML Importer lets you import any XML document into a Symphony Section, just navigate to Blueprints > XML Importers and you're on your way.

Notes

The 1.1.0 release of the extension requires you manually modify your importers slightly, remove the following lines:

public function __construct(&$parent) {
    parent::__construct($parent);
}

Changelog

Version 1.1.0, 21 November 2011

  • Fix issues with XPath and namespaces
  • Add $entry_id to prepareImportValue function
  • Added README information about the prepareImportValue function
  • Use the unique Duplicator (where available) to improve the UX
  • Tiny performance enhancements

Version 1.0.0, 3 March 2011

  • Updated to be compatible with Symphony 2.2
  • Improved validation by adding an XPath validator.
  • Improved handling of automatic namespace fetching.

Version 0.1.0, 10 January 2010

  • Initial beta release for Symphony 2.0.7.

Woop! I’ll do a load of testing on this.

Woop! I’ll do a load of testing on this.

Me too!

Issue #1 logged, sorry!

Ooops, Issue #2 too.

Rowan, shall I delete my original Github repo? It might delete your fork too, but you can create a new repo under your account to reflect ownership?

Hey Guys. Great extension, thank you for your work. I have had success with this importing tweets, but I am having an issues related to namespacing when trying to import links from my delicious feed. I added all of the namespaces from the feed, but it is throwing an error when I try to runt the import. I have attached a t screenshot of the error screen.

Attachments:
error.png

I’ve made some changes but my Git is all screwed. Rowan, could you make these manually?

  • Added a README (attached)
  • renamed the Helpers class to class.xmlimporterhelpers.php and the class XMLImporterHelpers (and modified the path where required in other classes)
  • changed 100 in fetchNavigation to Blueprints navigation group
  • modified class.importer.php getExpressionValue() to concatenate values with a comma (to allow for building tag lists) pastie
Attachments:
README.markdown

joeydi, did you specify the namespace dc? Can you paste the contents of the generated xml-importer.{handle}.php from your /workspace/xml-importers please — onto Pastie is probably best.

I’ve just successfully imported from Delicious:

Delicious import

Nick - I did specify that namespace. After looking at your screenshot, I added ‘/text()’ to all of my xpath expressions and the import worked fine.

I hadn’t realized that just specifying the node would return the full node, i.e. “value”, and not just the value, but that’s just my xpath ignorance.

Contents of xml-importer.deliciouslinks.php: http://pastie.org/773523

Yep that’s correct about the text() — this is more a feature than a bug, since you might want to save the raw XML into a textarea (if it were HTML, for example). text() is an XPath/XSLT function that returns the text node of an element. I have submitted a README to Rowan which makes this more specific.

I’m currently building a lifestream and storing the result of all feeds into a single “Lifestream” section. Each entry has a Description field. For things like Delicious and Twitter I’m storing the plain text value of the link title, or Tweet message, into the textarea. However for Last.FM I want to store more information such as artist name, album artwork, track title etc. I’m storing these as an XML block in the Description textarea, so its structure is maintained and can be manipulated with XSLT.

Being able to choose either the XML or the plain text value gives you more flexibility in my opinion.

I see your point regarding the ability to store the full XML nodes. Why do you think it is throwing that error though, if the namespace was declared? In this case I just need the text() values, but seems like it still might be a bug.

Strange too that I get that error even though I’m not importing the &quot;<dc:creator>&quot; node.

No idea I’m afraid. I edited your importer a little to match my section/fields and it ran. Maybe you could remove the fields one at a time, resave and re-run. It will eliminate the possibility that one of these is causing the error.

Or try a different feed to see if it’s your feed that’s the culprit: http://feeds.delicious.com/v2/rss/nickdunn?count=20

I don’t know what the problem could be, if you could check your install.php?info page and tell me what version of PHP, libxml and libxsl are listed, that might help.

@joeydi Symphony version?

I’m running:

  • Symphony 2.0.7
  • PHP 5.2.6
  • libXML 2.6.16
  • libxslt 1.1.12

Just to clarify XML Importer is working fine, except if I try to import whole nodes (e.g. ID not ID/text() ) and only only the Delicious feed, which has a ton of namespaces.

To make things a little easier I’ve added a checkbox to the edit form which, when checked grabs the XML document and searches for any namespaces that it contains, if it finds any, it adds them to the list.

@joeydi, I’ve not had a chance to look into your problem yet - the next thing I do is integrate Nicks changes before I forget. Then I’ll have time for some more testing.

Thanks for this great extension, Rowan!

At first, I was getting partial imports. The import fails with a “Symphony Fatal Database Error” when a Select Box Link is not supplied a numerical value.

Column 'relation_id' cannot be null
An error occurred while attempting to execute the following query
INSERT INTO `sym_entries_data_26` (`entry_id`, `relation_id`) VALUES ('28', NULL)

By supplying a numerical value for the Select Box Link field, even if it’s not the right one, the import works. Is there any way to provide a default value for Select Box Link fields?

Hmm. Sorry, on further investigation, this is actually a Symphony 2.0.7 / Select Box Link 1.14 bug that appears to be causing the Symphony Fatal Database Error. Saving entries with a Select Box Link value of NULL will throw the error.

This has been fixed with the SBL 1.15 release.

Create an account or sign in to comment.

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