2

I want to import XML data from a remote server. The Feeds module has to interact with an API that outputs the data in a XML format where the actual content is in JSON format. Here's an example of the XML file:

<serverResponse>
  <status statusCode="0">OK</status>
    <messages>
      <user/>
      <tech/>
      <alert header="_*Alert*_"/>
    </messages>
  <content>
    {"appointmentSet":[{"appts":[]}],"bookingAllowed":false,"maxBookAheadPeriod":25}
  </content>
</serverResponse>

What I try to achieve is to let the Feeds module grab the <content> data and put it in a node text field. Then I want to use the drupal_json_decode function to decode the JSON data in readable text.

In my XML Xpath parser settings I've used //content for the Context value. But I've no idea what to do with the processor mapping. Can someone please help me? Does the Node processor mapping require a unique identifier for the GUID or is this not mandatory?

1 Answer 1

0

Does the Node processor mapping require a unique identifier for the GUID or is this not mandatory?

You do not need to have a unique identifier to import data, but you might get duplicate data if you do not use a unique identifier. From your question I assume you are interacting with the API in the feeds fetcher. Can you get "duplicate" results when using the API? Or, is each import ALWAYS creating new nodes?

Xpath

Use //content/text() to return the json text {"appointmentSet":[{"appts":[]}],"bookingAllowed":false,"maxBookAheadPeriod":25}

Your Answer

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

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