Search

So I am trying to make a xml import system where it saves my stuff from external RSS feeds using the XML Importer extension. I have run into two problems that is keeping me from implementing this system.

1) Grouped tagging. For example, I create a XML importer of a tumblr feed that has multiple tag or category values. I create a Data source where I only want individual tags/categories to be stored. It easy to separate them in regular XSLT (xsl:for-each), But how do I prevent getting tags grouped together by entry.

<entry>
  <title>...</title>
  <body>blah blah blah</body>
  <category>music</category>
  <category>funny</category>
</entry>

On the Symphony backend where each tag is supposed to be listed individually, I get clumped tags for each entry.

music, funny

I want them separate. My XML Importer xpath is simply category/text().

2) In my pinboard feed, I want to only select the part after the /t:

<taxo:topics>
  <rdf:Bag>
    <rdf:li rdf:resource="http://pinboard.in/u:username/t:business"/> 
    <rdf:li rdf:resource="http://pinboard.in/u:username/t:design"/>
    <rdf:li rdf:resource="http://pinboard.in/u:username/t:inspiration"/> 
    <rdf:li rdf:resource="http://pinboard.in/u:username/t:model"/>
  </rdf:Bag>
</taxo:topics>

Attempt 1:

/taxo:topics/rdf:Bag/rdf:li[@rdf:resource/substring-after(.,'/t')]

Attempt 2:

/taxo:topics/rdf:Bag/rdf:li[@rdf:resource/substring-after('taxo:topics/rdf:Bag/rdf:li[@rdf:resource]','/t')]

Any help?

I don’t really know about the first part.

About the second one, does this do what you mean?

substring-after(/taxo:topics/rdf:Bag/rdf:li/@rdf:resource,'/t')

With the first part, in the readme for this extension it lets you know about helper scripts you can write in PHP. I suggest you write a simple string splitter, that you can pass a string, the delimiter, and which result you want (ie first, second, third etc).

@creativedutchmen Ok so I think I figured the proper xPath expression which is

/taxo:topics/rdf:Bag/rdf:li/@rdf:resource[substring-after(/taxo:topics/rdf:Bag/rdf:li/@rdf:resource,'t')]

But now when I run the importer, I get an error.

DOMDocument::loadXML() [domdocument.loadxml]: Namespace prefix rdf for about on item is not defined in Entity, line: 1
/home/vol5/.../htdocs/extensions/xmlimporter/content/content.importers.php line 152

147 $entry = $current['element'];
148 $xml = new DOMDocument();
149 $xml->preserveWhiteSpace = false;
150 $xml->formatOutput = true;
151                     
152 $xml->loadXML($entry->ownerDocument->saveXML($entry));
153                     
154 $source = htmlentities($xml->saveXML($xml->documentElement), ENT_COMPAT, 'UTF-8');
155                     
156 $fieldset->appendChild(new XMLElement(

@designermoney I don’t know any PHP. :( I tried anyway.

static function csvSplitter($value){
              $delimiter = ",";
        $string = explode($delimiter, $value);  
        return $string;     
    }

I get the following error.

    mysql_real_escape_string() expects parameter 1 to be string, array given
/home/vol5/.../htdocs/symphony/lib/toolkit/class.mysql.php line 150

145         return true;
146     }
147
148     public static function cleanValue($value) {
149         if (function_exists('mysql_real_escape_string')) {
150             return mysql_real_escape_string($value);
151
152         } else {
153             return addslashes($value);
154         }

Sorry for being a total noob here.

@Ecko - would you mind posting a screenshot of your XML Importer screen? Also, it looks as if one of the errors you are getting is namespace related. Did you declare your namespaces from the document your importing? Or you could check the checkbox to automatically discover the namespaces.

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