I need to import an XML object into my database collection.
I will use a http get request to receive the xml object from the third party site. I have been able to successfully receive the xml string but now difficulty parsing and adding it to the database. In an effort to debug and simplify, I have just created a test page with a text box containing the xml string, and a button to insert into the database.
I have also tried to use functions to convert the xml to json (e.g. Convert XML to JSON with JavaScript) but it seems not all the js functions are supported in wix.
Below is the sample XML and the XML schema.
Any suggestions?
Sample XML
<?xml version="1.0" encoding="utf-8"?> Sample Job
This is the job summary <![CDATA[This is the job description and can contain
HTML]]> Thrilling Partnership Convenient Sydney CBD location Remarkable Career Opportunity 65000 80000 Including company car and phone IT Architect Sydney Full Time applications@yourcompany.com http://apply.jobadder.com/999/10000/xco62rdcabeezp6as7vnn5yfcm
XML Schema
<?xml version="1.0" encoding="utf-8"?>
Hi Louis,
Welcome to the Wix Code forum.
WixCode understands all of Javascript, except for anything that accesses the DOM. The conversion function that you are using expects a DOM as input. So, WixCode won’t understand it.
Check to see if you can get the query returned as JSON. Many web services offer this as an option, and would make your life much easier.
The other option is to write your own conversion function that accepts XML as a string. This is not a trivial task.
Good luck,
Yisrael
Hi Yisrael, Thanks for your quick response!
Unfortunately the web service won’t offer a JSON feed at the moment, so we’ll probably have to implement a work around in the meantime until they do.
Cheers
Louis
So, is Wix planning to make an XML import ? Many product and other feeds work on that basic data exchange standard.
Feel free to post a Feature Request .