Data Importer: plain XML?

I've done a basic XML export using Providence's XSLX mapping engine.
I would now like to import that XML back into CA (to prove a round-trip export/import) using the import-mapping as described in Wiki DataImporter documentation "Source Syntax for XML input formats".

But when I try to run the "bin/caUtils import-data" on the XML it just says:
"Could not open source"

What would be the correct format/syntax to import a non-specific (BaseXML?) XML file?
Are there any example files (XML + mapping XLSX) online I could use as reference?
The Wiki documentation examples mostly refer to spreadsheet documents as data source.

Thank you very much in advance!


  • edited August 2020

    Found "lib/Import/DataReaders/SimpleXMLReader.php":
    $this->opa_formats = array('simplexml');

    Will try that.

  • Using SimpleXML seems to read my XML, but I always get:

    "Found 0 rows in input source"

    The XML is:

    <?xml version="1.0" encoding="UTF-8"?>
            <extid prefix="CH">000001</extid>
        <IDTitel>My Title</IDTitel>

    I've tried XPath mapping with and without "/Filmwerk", like: "/Filmwerk/IDTitel" vs "/IDTitel" (since /Filmwerk is already the basePath): Always the same result :disappointed:

    (Mapping XLSX attached).

    Grateful for any advice!
    Thank you in advance :smile:

  • edited November 2020

    I've found the issue:
    The above XML actually works, but it doesn't if the main node contains additional schema/namespace information:

    <Filmwerk xmlns="" xmlns:xsi="" xsi:schemaLocation="" uid="E38AF2EC1A13494B9DF6FD6E75960307">

    If I remove the 1st attribute (xmlns) from the main node, it works :confused:
    Is there any way to fix this in the SimpleXML importer, so XMLs with xmlns defined work?

  • SimpleXML just parses straight non-namespaced XML. For formats that use namespaces you'll have to create a data importer reader class. You can also potentially add any necessary format-specific login in this class. The PBCore reader (app/lib/Import/DataReaders/PBCoreInstDataReader.php) could be used as a starting point.

  • Thanks!
    Roger that.

  • If there are specific XML standards you are looking to import we can potentially roll classes for it into the standard software distribution. Is the DIF format the only one you require? Or are there others?

  • @seth: Thanks for the offer, but since I need to match external identifiers, not stored in "idno" but another custom field - we had to give up the regular CA importer and had to implement our own import using the Web API.

Sign In or Register to comment.