XML Imports

Please check the topic i linked to and let us know if this is the same that happens to your when you say:

1 Like

It’s hard to be sure, but yes, it seems possible that it is the same thing. Do you expect it to get resolved soon?

Sometimes when I have these experiences it’s when I have three or more pages open in code or split views. I have found a consistent pattern when the keyboard becomes inactive. Usually I noted that one or more previously edited pages were not saved. Sometimes the changes that I was trying to make on the current page I was editing actually was being placed on one of the opened unsaved pages. It’s usually the previous edited page or the last page I had focused in the window.

The remedy that I have found that works is to first save all opened pages. Return to the page that was inactive. Usually it solves the issue. If not, I just close the other pages. This almost always resolves the issue.

It’s not perfect, but until the issue is repaired by Monaco authors, try this work around, or just work on one page opened at a time. :smirk:

1 Like

Hi @Teodor is there any news on this?

Thanks.

Hi @Teodor. Sorry to keep pushing on this, but I’d really appreciate any help you can provide to get this working or if there is any documentation you can point me at that could help would be most welcome.

Thanks.

@Teodor can I assume from the lack of response this week that there is a bug with processing XML files or have you just not got around to looking at the file I sent you last weekend? Can you please provide some sort of feedback - just ignoring this is really frustrating as it’s really hard for us to plan, and all the time we’re unable to deliver.

If there is a better place to request support for Wappler then please also let me know and I am happy to try that, but I don’t see any support plans listed on your website :(.

Hello,
I haven’t really tested your case yet, sorry. I believe there’s something with your specific XML file, which is causing this.
Maybe @patrick can check this.

1 Like

Thanks - I appreciate the feedback.

The xml import is very limited, it is actually for importing the data that was exported with the exporter. It only support array like xml, that is a xml with one root element and under it are the elements that is returns as data.

Your xml contains multiple levels and different kind of elements, that is not supported with the importer.

Thanks @patrick. Can you suggest how to work with this sort of thing? In the past when I’ve suggested support for external libraries so we can run a PHP algorithm, or add support for some external PHP, I keep getting told that everything can be done visually, but it seems there may be some limitations after all.

How can we work with this sort of thing? Ideally I’d be happy to call a PHP function in the flow, but I don’t think that’s possible so we keep striking severe limitations of Wappler.

The code of Server Connect is very easy to extend, you could create your own formatters or modules. Problem is that the custom code is not recognized by Wappler, so you are not able to use them from the UI in Wappler, you have to add it all manually.

There were already some posts here in the forum with custom formatters for PHP.

Here a sample of how a module would become:

<?php

namespace modules;

use \lib\core\Module;
use \lib\core\Path;

// class should extend Module
class xml extends Module
{
  // all public function will be available as actions
  // parameters are always $options and $name
  // $options will contain the options for the action
  // $name is the name of the action
  public function import($options, $name) {
    // parseObject will parse all expressions it finds in options
    $options = $this->app->parseObject($options);

    // for the example I keep it simple, a better xml to json can be found at
    // https://outlandish.com/blog/tutorial/xml-to-json/
    // Path::toSystemPath is a helper method to convert the path selected in Wappler to a system path
    return simplexml_load_file(Path::toSystemPath($options->path), 'SimpleXMLElement', LIBXML_NOWARNING);
  }
}

save the file as xml.php in the dmxConnectLib/modules folder.

Your action file from Wappler contains a json that describes the actions it should run.

calling the above custom module step will look like:

{
  "name": "myImport",
  "module": "xml",
  "action": "import",
  "output": true,
  "options": {
    "path": "/data.xml"
  }
},

name : property name for the output, will also be given to the action method as parameter
module : name of the module (filename and classname should be names so)
action : name of the method to call from the module
output : should the result be added to the output json
options : options passed to the action method

Please be aware that you have to edit it by hand, there is no support for it within Wappler. Also I can’t promise that Wappler would not overwrite your code, so better have a backup of it. And you will need enough PHP knowledge to code your own modules.

3 Likes

Thanks for the information @patrick - I will give this a try. PHP is no problem at all - I would LOVE to see a proper interface where we could add exactly this information into a flow rather than having to hack the json and potentially lose it if we edit it again. Is this something that could be supported do you think? I think this would really open up some use cases.

I also encountered an external API service that passes data in XML format. Support cdjackson.
We should not forget that the CommerceML data exchange format is still the main one in many ERP systems.

Hi Patrick, i have a problem importing a very small xml,

No errors but nothing imported…Help will be very appreciated…

image
This is the xml. Is it ok?
I want to specify that importing csv is not a problem, i did it many times before. Importing xml is a problem for me.

The Import XML expects a specific structure, you can’t load just any XML with it.

What’s wrong with this xml?

There is nothing wrong with the XML, but the standard XML Import that is available in Wappler does only understand the XML structure as generated by the Export step.

To have custom xml import you have to use a custom action: XML Imports

1 Like

Done; Thks.