2

Noob to Drupal here. I'm looking to import 100 xml files into an empty D7 database. Each xml file contains links to other xml and image files. I have Feeds, Xpath Parser, and Tamper modules installed.

Drupal Content type = Article Fields (machine name):

  • unique_xml_id (Text)
  • body (Long text and summary) -> settings "Number of values" = "Unlimited"
  • field_images (Image) settings "Number of values" = "Unlimited"

Here's the xml. Every xml file has a unique id by combining pid and gid.

<testContent pid="5" gid="000007">
  <textContent title="Title 1" ordinal="0">His car</textContent>
  <textContent title="Title 2" ordinal="1">Our car</textContent>
  <textContent title="Title 3" ordinal="2">
    This is my <textLink linkType="int" pid="5" gid="000014">car</textLink> -> link to xml
  </textContent>
  <visualHeader title="Images">
    <visualContent mid="1057" alt="Radiator" type ="thumb"> -> image url, ex: img/1057.jpg
      <visualLink pid="6" gid="001057"</visualLink> -> link to other xml file with parent img
    </visualContent>
    <visualContent mid="1092" alt="Wipers" type="thumb"> -> image url, ex: img/1092.jpg
      <visualLink pid="6" gid="001092"</visualLink> -> link to other xml file with parent img
    </visualContent>
  </visualHeader>
</testContent>

OBJECTIVES:

  1. Map the concatenation of the xml attributes "pid" and "gid" to field "uniquexmlid" and make this check for uniqueness
  2. Map textContent elements to body field values (array?), example: body[0] = "His car" body[1] = "Our car" body[2] = "This is my car" (car is link to other node that does not exist yet in database)
  3. Map "car" link to url of other node (not yet created from xml file) with path alias inside body[2] field

How do I accomplish these? I'm open to suggestions of other ways of setting up the fields in Drupal.

1 Answer 1

1

Also when you import from html pages you have to set to html xpath parser.

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.