Search

Has anyone been successful importing xml data into a Select Box Link field? If so, would you mind sharing what you did to get it to work?

Can you be more specific? It works just like an Event does, so the SBL field will expect the ID of the linked entry.

OK. Here’s what I’ve done. I created a section called Publisher. It has 3 fields, Name (text field), Publisher-ID (text-field), and an optional field called Description (textarea). I imported the following xml into the Publisher section…

<publishers>
  <publisher publisher-id="BAKE">
    <title>Baker Book House</title>
  </publisher>
  <publisher publisher-id="BANN">
    <title>Banner of Truth</title>
  </publisher>
  <publisher publisher-id="CHFP">
    <title>Christian Focus Publications</title>
  </publisher>
</publishers>

So, I have it importing the title (to my section’s name field) and the publisher-id (to my section’s publisher-id field).

Then I setup the section Books, which has the following fields, Title (text), ISBN (text), Author (text), Publisher (select box link —> which links to publisher section and keys on the field Publisher ID), Published Date (date), List Price (text). Here’s the XML that I’m importing…

<books>
  <book isbn="085151572X" published="1900-01-01" list-price="2.00" publisher="BANN" author="Murray, John J.">
    <title>Behind a Frowning Providence</title>
  </book>
  <book isbn="0801022444" published="2000-09-01" list-price="11.00" publisher="BAKE" author="Begbie, Jeremy S.">
    <title>Beholding the Glory: Incarnation Through the Arts</title>
  </book>
  <book isbn="9781845502300" published="2007-04-01" list-price="10.00" publisher="CHFP" author="Vasholz, Robert">
    <title>Benedictions : a pocket resource</title>
  </book>
</books>

So, I have it importing the title (to my section’s title field), isbn (to the isbn field), published (published date field), author (to author field), list-price (to the list-price field), and publisher (to the publisher-id field via select box link).

When I import the books, the Publisher field is not populating. Since I’m keying off of the Publisher ID field, shouldn’t that work?

That was it Nick!

I went ahead and created a data source called Publisher List and then created a page in Symphony called Publisher List (file type XML). Then I took my original source document (a static xml file) and the I transformed the file (outside of Symphony, since this specific source document is outside of Symphony). In that XSLT stylesheet, I added an attribute called publisher-id… which I used to the grab the entry id element from my new Publisher List page…

<xsl:template match="/>
<xsl:element name="book">
            <xsl:attribute name="isbn">
                <xsl:value-of select="normalize-space(inventory_tb_in_isbn)"/>
            </xsl:attribute>
            <xsl:attribute name="published">
                <xsl:value-of select="normalize-space(in_pub_date)"/>
            </xsl:attribute>
            <xsl:attribute name="list-price">
                <xsl:value-of select="normalize-space(inventory_tb_in_listprice)"/>
            </xsl:attribute>
            <xsl:attribute name="publisher">
                <xsl:value-of select="$publisher"/>
            </xsl:attribute>
            <xsl:attribute name="publisher-id">
                <xsl:apply-templates select="document('http://domain.com/publisher-list')/data/publishers/entry[publisher-id=$publisher]" mode="publisher"/>
            </xsl:attribute>
            <xsl:if test="inventory_tb_in_ctg2!=''">
                <xsl:attribute name="category">
                    <xsl:value-of select="normalize-space(inventory_tb_in_ctg2)"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="inventory_tb_in_author!=''">
                <xsl:attribute name="author">
                    <xsl:value-of select="normalize-space(concat($lastname,', ',$firstname))"/>
                </xsl:attribute>
            </xsl:if>
            <xsl:element name="title">
                <xsl:value-of select="normalize-space(inventory_tb_in_title)"/>
            </xsl:element>
        </xsl:element>
    </xsl:template>
    <xsl:template match="entry" mode="publisher">
        <xsl:value-of select="@id"/>
    </xsl:template>

By doing that, it populated my NEW source document with the Entry ID that I needed. Then I keyed my import on that new publisher-id field that I created. Then imported my new Books source document that had been created, and voila, the section links showed up.

THANK YOU SIR!!!!

Kapow :-) Yes, unfortunately to import content with relationships you have to do some matching up in the XML before running it through XML Importer. Glad you’ve got it sorted.

Wow. Nick Dunn solved a problem. Shocker!

Hey guys, quick question. I’m trying to get XML Importer working on a Symphony 2.0.7 installation, and the GUI isn’t behaving the way it should. (See attached screenshot.) Does XML Importer have a dependency on Select Box Link or anything else that might be causing this? The rest of my admin GUI is working fine.

Thanks, Jonas

Attachments:
Screen shot 2010-03-27 at 12.21.49 PM.png

Perhaps the JavaScript files are not readable on the server, or there’s a JavaScript error on the page.

Has anyone successfully managed to use XMLImporter to move data from an old Symphony 1 install to a Symphony 2 installation? I can get the basics of bringing my posts across working fine, but getting the comments to link back up to the appropriate post IDs is eluding me.

Ignore me - I’ll post a helper shortly that scans for the ID of a linked field and pushes it back as a return value for SBL fields.

How would I go about pulling in a textarea?

I tried using the following...

path:

body/text()

This returns a blank.

I also tried body/* and that returns a blank to...

Any pointers???

NOTE: This is solved later in the thread at Comment 98.

It should work, I’ve been importing thousands of entries successfully all day - at least after applying some patches from Nils.

Try updating your copy from the unstable branch, and let me know.

I don’t understand how any of you can pull anything in with this, I have never been able to get this extension to work.

Where do I get the version that everyone seems to be using? I have tried the download on here, I have tried the latest tag from Git, none of them work!

I have even logged an issue that has not been answered…

There’s a project that I really want to sink my teeth into, but until I can get this plugin working, I can’t even start it!

BTW, I’m using the official 2.0.7 version of Symphony.

Offical master branch of Symphony 2.0.7? That’s probably the problem, there’s a few hotfixes that are required to get things back in shape.

You could always try the 2.0.8RC1, or the latest from integration branch.

@designermonkey, you want to use whatever is in the “unstable”:http://github.com/rowan-lewis/xmlimporter/tree/unstable branch, since that’s where the most up to date version is. There’s only one tag, and that’s for the same initial version from the first post. You don’t want that.

Sorry to ask this… i’m trying pull in the changes via git.

How do I go about pulling in changes to a submodule?

I originally added your extension as a submodule, git submodule add git://github.com/rowan-lewis/xmlimporter.git extensions/xmlimporter

All I know how to do is update the submodule git submodule update --init. But that updates from the master branch. How do I checkout the unstable branch of the submodule and pull in those changes?

UPDATED: April 9, 2010, 2:11 PM CST

I think I figured out the submodule update part, see this comment on the Git thread.

Cool, I’ll give that a go now then…

How do I get the extensions for 2.0.8 Symphony though? I don’t use Git, other than the download links And they’re not there…

@buzzomatic - Rowan, it doesn’t look like that update helped. It still will not pull in a textarea data. I’m importing from an old Symphony installation. Here’s a snippet of my XML if that helps.

<?xml version="1.0" encoding="UTF-8"?>
<data>
    <events/>
    <articles-by-ministry>
        <section id="6" handle="articles">Articles</section>
        <entry id="796" comments="0" notes="0">
            <categories>
                <item handle=""/>
            </categories>
            <title handle="arts-festival-logo-contest-winner-announced">Arts Festival logo contest
                winner announced</title>
            <body word-count="80" mode="formatted">
                <p>PCPC announces Jason Zachery as the winner of the 2010 PCPC Arts Festival logo
                    contest. You may have seen Jason working at the Information Center as one of
                    PCPC's daytime security guards. He is currently enrolled in the graphic design
                    program at Mountain View College.</p>
                <p>The theme for this year's Arts Festival is "Manger, Magi, and Majesty." Jason
                    will receive an award of $300 and his logo will appear throughout the year until
                    the end of the festival in mid-November.</p>
            </body>
            <publication-date time="00:00" weekday="2">2010-03-02</publication-date>
            <author>
                <item handle="byrd-stephanie">Byrd, Stephanie</item>
            </author>
            <teaser word-count="14" mode="formatted">
                <p>PCPC announces Jason Zachery as the winner of the 2010 Arts Festival logo
                    contest.</p>
            </teaser>
            <tags>
                <item handle="arts-festival">Arts Festival</item>
                <item handle="graphic-design">graphic design</item>
            </tags>
            <publication-name>
                <item handle=""/>
            </publication-name>
            <ministry>
                <item handle="all-church">All Church</item>
            </ministry>
            <genre>
                <item handle="news-article">news article</item>
            </genre>
        </entry>
        <entry id="771" comments="0" notes="0">
            <categories>
                <item handle=""/>
            </categories>
            <title handle="boxes-of-blessing">Boxes of blessing</title>
            <body word-count="446" mode="formatted">
                <p>From start to finish the Christmas boxes were a blessing not only to Voice of
                    Hope families but to the greater West Dallas area. Members of the Voice of Hope
                    family were invited to assemble Christmas boxes alongside PCPC members. It was a
                    wonderful event that allowed us to experience the diverse body of Christ serving
                    alongside each other.</p>
                <p>Once the boxes were delivered to Voice of Hope, community members and church
                    congregations were invited to come and pick them up.</p>
                <p>Seven area churches picked up boxes for each household in their congregations.
                    Pastors expressed their gratitude and appreciation that Voice of Hope and PCPC
                    would care so much about church congregations in West Dallas, especially during
                    these hard economic times. Throughout the day about 50 cars pulled through the
                    Voice of Hope driveway and picked up a box! We even had an unemployed West
                    Dallas resident ride his bike through because he does not own a car. By the end
                    of the day many tears of joy were shed.</p>
                <p>While boxes were being picked up by the community, members of PCPC delivered
                    boxes and Christmas gifts directly to Voice of Hope families and senior
                    citizens. The families were so grateful that someone took the time to deliver
                    these items to their doorstep, and the senior citizens were so touched by the
                    caring hearts of PCPC members. PCPC members not only gave them food but also
                    prayed with these Christian widows and senior citizens.</p>
                <p>&#8220;I was blessed to receive the food box during these difficult economic
                    times,&#8221; Era Haywood, an 87-year old elder, said. Ms. Era said that she
                    opened her box and shared with her neighbors. &#8220;I wanted to spread the same
                    kindness to others.&#8221;</p>
                <p>To see the generous heart of PCPC in action is overwhelming. God&#8217;s Word
                    says, <em>&#8221;If anyone has material possessions and sees his brother in need
                        but has no pity on him, how can the love of God be in him? Dear children,
                        let us not love with words or tongue but with actions and in
                        truth&#8221;</em> (1 John 3:17-18). PCPC members continually show actions
                    and truth, and without their partnership my department would suffer immensely.
                    Every prayer and donation has been a great source of support for my beloved
                    community.</p>
                <p>I continue to hear people express their appreciation for the Christmas boxes.
                    They say, &#8220;Do you know they gave us oil <em>and</em> sugar?&#8221; The
                    people were so grateful and content to receive this token of love.</p>
                <p>PCPC members exemplified Proverbs 22:9, <em>&#8221;A generous man will himself be
                        blessed, for he shares his food with the poor.&#8221; </em>My prayer is that
                    we continue to serve in the name of the Lord.</p>
            </body>
            <publication-date time="00:00" weekday="1">2010-02-01</publication-date>
            <author>
                <item handle="solis-debbie">Solis, Debbie</item>
            </author>
            <teaser word-count="28" mode="formatted">
                <p>Pastors expressed their gratitude and appreciation that Voice of Hope and PCPC
                    would care so much about church congregations in West Dallas, especially during
                    these hard economic times.</p>
            </teaser>
            <tags>
                <item handle="voice-of-hope">Voice of Hope</item>
                <item handle="west-dallas">West Dallas</item>
            </tags>
            <publication-name>
                <item handle="witness">Witness</item>
            </publication-name>
            <ministry>
                <item handle="urban-ministries">Urban Ministries</item>
            </ministry>
            <genre>
                <item handle="witness-article">witness article</item>
            </genre>
        </entry>
    </articles-by-ministry>
</data>

Here’s my setup in the XML Importer…

Name: Articles

URL: (it’s the url pointing to the xml file — snippet of XML above)

Namespace Declarations: (none selected)

Automatically discover namespaces: not checked

Included elements: /data/articles-by-ministry/entry

Section: Articles

alt text

How do I get the extensions for 2.0.8 Symphony though? I don’t use Git, other than the download links And they’re not there…

@designermonkey, are you talking about the default extension submodule placeholders in the extensions directory? For instance when you open the debugdevkit, there’s nothing there. To get those submodules, if you are using Git, you would run git submodule update --init (from your site’s root directory.

But, since you are not using Git, you’ll need to manually download those folders, by going to those extension download pages — you can get them through the Extensions download area of this Symphony site. Or you can download the code from Github, by click on the Download Source button on the individual extension pages on github.

Here are the default extensions on Github…

Hopefully that helps.

Sweet! I figured out how to pull in textareas…

So if they name of your textarea is Body, and you are also pulling from textarea field called body, you would you use the following as your XPath Expression…

body/node()

alt text

Thanks for the help, I got 2.0.8 installed and running.

Now, I can’t get this extension to save the fields I choose and therefore neither can I save the xPath’s I input…

Anyone come accross this? I have mentioned it before from an earlier version of this extension…

Symphony 2.0.8, this extension, downloaded from Github (I think it’s the most recent one)

Right Ok, my bad… I got the unstable branch (muppet).

When I run the importer, I get the following error. Could someone explain what it means?

Import Failed

   1. DOMDocument::loadXML() [domdocument.loadxml]: Entity 'ndash' not defined in Entity, line: 5
   2. DOMDocument::loadXML() [domdocument.loadxml]: Opening and ending tag mismatch: link line 6 and head in Entity, line: 7
   3. DOMDocument::loadXML() [domdocument.loadxml]: Opening and ending tag mismatch: meta line 4 and html in Entity, line: 23
   4. DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag head line 3 in Entity, line: 24
   5. DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag html line 2 in Entity, line: 24
   6. No entries to import.

I don’t understand what it means, and you guys would know better than me ;)

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