0

I am trying to import a Wordpress feed with images (e.g. http://blog.objet.com/feed/) into Drupal 7. I've installed the Feeds XPath Parser module and read the documentation but I am still having the following issues:

  1. The document is XML, but firefox shows it as XHTML. Whic parser to use? XML Parser or HTML Parser?

  2. What is the selector (context) of the root element? I've tried 'xhtml', '/xhtml', 'xhtml:meta', '/xhtml:meta', 'item', '/item' (with both XML and XHTML parsers) but no elements are getting imported (the feed was imported correctly before I've installed the 'Feeds XPath Parser' module).

Updates:

  1. I was also trying to add "//item" as a selector, this time I got one item, with one image, while no other items being imported.

2 Answers 2

1

You have to fully understand the XPath queries logic to use the parser. It's very powerful once you get it, but it needs a bit of practice.

Here is a good starting page : http://www.w3schools.com/xpath/

Note that you have two parts in the UI for the queries :

  • One to set the context, which is the element all further queries will be run from
  • One for each field

The context element depends on your document and the logic of the data inside. Usually, you set the context each 'entity' or node is saved in, and then query fields or attributes for the different fields.

For example, if you have a 'Thing' entity like this :

<Thing>
<id>1</id>
<name>Name One</name>
</Thing>
<Thing>
<id>2</id>
<name>Name Two</name>
</Thing>

... you would set the context to /Thing and then each field query to name and id. You also have a syntax to query attributes.

Also, be aware Feeds is only compatible with XPath 1.0 syntax.

0

Your link is xml, but firefox renders it as html for the user's convenient. Open the link in chrome and you will see the xml. Look at the xml and you will identify the rest of the nodenames.

Your context is //item

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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