What’s the XML you are trying to import?

Just from that snippet it looks like a whole webpage that’s not valid XML.

The ndash error is interesting and I’m not really sure how to get around that, the XML Importer might need to convert named entities to numbered entities on import.

buzz will know more :)

Something I could add for sure. But in the meantime, you might need to search and replace.

Would you be willing to post your xml? Are you pulling from a static file or dynamic source?

If it’s a dynamic source, you should try using Yahoo’s Query Language (YQL)? I’ve used that when pulling pull malformed XML or HTML, and it cleans up enough as valid XML source. Here’s an example, of how to use it.

That might be a temporary help.

@bzerangue I was looking for this. Thanks for sharing!

Ok, I’ve cut the xml down quite a bit as it was a 5mb document with thousands of lines of code…

I know it is properly formed xml as I have already run it through xalan from multiple sources into one file.

Also, there are no ‘ndash’s in the document, so it seems to me that the xml isn’t what is causing the errors.

I’m not supposed to show people the xml, but as no one has any way of knowing what it is or where it came from, I suppose I can ;)

Any thoughts?

edit: Code removed.

Is it possible that your link to the XML is wrong and that the importer is trying to parse a 404 error page?

There seem to be invalid characters in the XML. Line 131 for example reads:

<value attributeid="asset.Description">??? H.S cds 28/02/06</value>

(I opened the XML assuming UTF-8 encoding, of course.)

[EDIT]: Sorry, the forum converted those “invalid character” symbols to question marks.

I need a slap. I had a wrong url in the importer. Muppet.

edit: Thanks for everyones help!

When using the XML Importer, has anyone been able to import into a Reference Link field? Wouldn’t that be similar to importing into a Select Box Link field. Both would be ID driven right? I hope this feasible. Anyone have any thoughts?

I love Craig Zheng’s (czheng) Reference Link Field, especially the autocomplete input functionality. That is so, so helpful.

I’m fairly sure the Reference Link is just a glorified SBL with an AJAX autocomplete on top. So it should work exactly the same in principle.

OK. That’s weird. It worked this time. Thank you Nick for your help. By the way, Rowan and Nick, the XML Importer extension is amazing!!!

I’m fairly sure the Reference Link is just a glorified SBL with an AJAX autocomplete on top.

Yeah. Not really all that ‘glorified’ either ;) Glad it worked out Brian.

Thank Rowan, it’s his brain-child. I just nagged him until he felt (de)motivated enough to finish it.

Is it possible, to use the XML importer to import entries and direct one of the fileds and have it populate a upload field?

Here’s what I’m trying to do, I have a large list of weekly bulletin archives dating back to 2001. I’d like to take the bulletin archive XML and import into Symphony. In one of those fields I have a file field. I’d like to import the value of that field into an Upload field. I’ve moved all of the PDFs in the destination workspace/uploads folder.

I tried importing it, but I kept getting this error…

filemtime() [function.filemtime]: stat failed for /home/public/workspace/workspace/uploads/files/2001/MAY13BUL.pdf
    /home/public/symphony/lib/toolkit/fields/field.upload.php line 454

    449             'image/png',
    450         );
    452         $meta = array();
    454         $meta['creation'] = DateTimeObj::get('c', filemtime($file));
    456         if(General::in_iarray($type, $imageMimeTypes) && $array = @getimagesize($file)){
    457             $meta['width']    = $array[0];
    458             $meta['height']   = $array[1];

Found my problem.

When importing my entry, the path for my file that was imported into my file field was /workspace/uploads/files/2001/MAY13BUL.pdf.

AND I was receiving the following error (as listed in my previous comment)...

filemtime() [function.filemtime]: stat failed for /home/public/workspace/workspace/uploads/files/2001/MAY13BUL.pdf

It looks as if the uploads field was assuming that the file would be in the workspace folder... since it was adding an additional workspace folder in the path.

So I adjusted my XML and removed /workspace from the path, so my path looked like this, /uploads/files/2001/MAY13BUL.pdf.

I re-ran the XML Importer, and then it worked.

Just a quickie Brian, When you’re populating the upload field with the importer, is the directory path for the field (set up in your section) the same as where the files currently are? So that the field is simply writing over the same path??

I’d like to do something similar myself, but can’t get my head around how to do it

@designermonkey - To answer your question,

When you’re populating the upload field with the importer, is the directory path for the field (set up in your section) the same as where the files currently are? So that the field is simply writing over the same path??

Actually no. My original source was not coming from Symphony, so I copied all of my orders-of-worship folder (which holds my bulletin archives) and dumped that folder in my workspace/uploads folder (where my upload field is mapped to in my section). Also, since this was coming from another source, I used some XSLT on my original XML to tidy up the XML a little bit, and then I produced a static xml file which I saved to my site’s static-xml folder that I added to my site’s workspace folder. Here’s what the XML source file looks like that I was going to import

    <entry id="127"> 
      <name handle="order-of-worship-2001-05-13">Order of Worship 2001-05-13</name> 
      <title handle="order-of-worship">Order of Worship</title> 
      <date year="2001" month="05" day="13">2001-05-13</date> 
    <entry id="128"> 
      <name handle="order-of-worship-2001-04-12">Order of Worship 2001-04-12</name> 
      <title handle="order-of-worship">Order of Worship</title> 
      <date year="2001" month="04" day="12">2001-04-12</date> 
    <entry id="129"> 
      <name handle="order-of-worship-2001-04-15">Order of Worship 2001-04-15</name> 
      <title handle="order-of-worship">Order of Worship</title> 
      <date year="2001" month="04" day="15">2001-04-15</date> 

I have a Files section that I mapped that to in the XML importer setup.

Files section is comprised of the following fields…

  • Name (text field)
  • File (upload field)
  • Date (date field)
  • Description (textarea) ** this field is not chosen for the import

Here’s a screenshot of my XML importer setup…

alt text

Here’s a screenshot of my XML importer field mapping…

field mapping

Does this help any? Please let me know if I’m clear at all or just confusing. It’s been a long day, and my brain and body is wanting to sleep.

Thanks for that. So the process will move the files on the server as they are uploaded? Where is the upload fields target directory set to in the Section editor?

A lot of questions I know, I just like the idea and havent got the time to play with the idea myself as of yet.

Thanks in advance

Actually, since the files were moved from another source, they technically were not uploaded. I just copied the files into the “uploads” folder, and put them in their own folder (inside the uploads folder.

So… my upload field in my Files section points to workspace/uploads/files.

(in my example above) I copied my files in another folder called orders-of-worship which was a folder I created inside of workspace/uploads folder.

So when I run the XML importer (citing my example above)… for my Upload field called File Name, it imports in the following path… /uploads/orders-of-worship/2001/apr15bul.pdf.

So after my initial import, I won’t use the importer in this instance, because I will manage all future uploads from Symphony. In this example, I’m only using XML Importer to import data from another system, so I can manage it solely in Symphony. So all future entries will be done in Symphony and will not rely on the outside source. Does that make sense?

So… in other words, every new entry in Symphony will point to /uploads/files, instead of the other path. Now the good thing is that all of this information is stored in the database, so it will maintain all of your paths.

That’s cool. Cheers for the detail, it makes sense when explained, can’t seem to think straight at the moment.

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