1

I'm trying to create nodes from an XML feed using Feeds XPath Parser.

Some of the data appears to import, but not all fields are being populated or populated correctly.

Here's a snippet of the feed:

<merchantProductFeed>
<script/>
<SCRIPT/>
<merchant id="2607" name="Business IT Online Office Shop">
<prod id="49194411">
<pId>571895</pId>
<text>
<name>
Avery afterBURNER Label System Software with Applicator 10 Inserts Ref AB1800 [24 Labels]
</name>
<desc>
Avery afterBURNER Label System Software with Applicator 10 Inserts Ref AB1800 [24 Labels].- Includes software, applicator, 24 labels and 10 inserts.- For Professional CD labels and inserts.- No Touch labels - unique design of the label sheets mean you can apply the label to the CD/DVD without touching the printed design or the adhesive.- 20 premium matt and 4 photo quality glossy labels.- The curved design of the applicator means the label is rolled smoothly onto the CD/DVD.- Inserts include a CD jewel case insert cover and tray (including spine) - allowing design and print in one effort.- The software contains over 2000 clip art images, 120 pre-formatted label designs and much more.
</desc>
</text>
<uri>
<awTrack>
http://www.awin1.com/pclick.php?p=49194411&a=953&m=2607
</awTrack>
<awImage>
http://images.productserve.com/preview/2607/49194411.jpg
</awImage>
<mLink>
http://www.businessitonline.com/avery-afterburner-label-system-software-with-applicator-10-inserts-ref-ab1800-24-labels.bprod?inctax=true
</mLink>
<mImage>
http://www.businessitonline.com/eCommImages/571895.jpg
</mImage>
</uri>
<price curr="GBP">
<buynow>15.56</buynow>
<delivery>5.95</delivery>
</price>
<cat>
<awCatId>68</awCatId>
<awCat>Software</awCat>
<mCat>Machines and supplies>Computer Software</mCat>
</cat>
<brand/>
</prod>

There are several more products in the document, structured in the same way.

In the feed importer, I've set the context as //merchantProductFeed/merchant/prod.

I have two fields to populate: 'title' (text) and 'cost' (decimal).

The XPath query I'm using for title is 'text/name' and the query for cost is 'price/buynow'.

When creating the nodes, the title field is populated with the correct data, but includes the and element tags.

The cost field doesn't get populated.

I can't see where my XPath query is going wrong, so I'm unsure if it's a problem with that or something that isn't happening properly elsewhere in the XPath Parser module. So far as I can see, the mappings are set up as they should be.

Can anybody see if my XPath queries are correct for the XML feed above?

  • can you post your code with your question? – Aboodred1 May 8 '13 at 16:46
1

Have you tried turning on debugging in the Xpath Parser? It can give you an idea of what is going into the field before any interference like the formatting of the field itself.

I also use Firepath which is an add-on for Firefox for use with Firebug. I don't use Xpath very often- kind of a quick means to an end- and the two of these tools have been invaluable. Firepath will help you find out if your Xpath is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.