Skip to main content

XML import with typedefinition

Hello everyone,
i'm trying to import an XML File with the correct data types (Date,Number...).The Import works but the datecolumn does not get recognized.Only when i set the type in idea to date and set a dateformat manually.
Is there any way to automate this?I also have the XSD File but IDEA does not import XSD Files only XRDF as far as i know.In the sample XRDF Files are no format attributes only fieldnames and context.Does anyone know what the <XML_FIELD_CONTEXT> is for?
I really don't understand why i can export an XSD File but not import it.
Regards
Fabian
 

Brian Element Tue, 02/05/2019 - 08:04

Hi Fabian,

I was hoping that someone else might answer your question as I don't have much experience importing XML files.  Yes you could automate this, you could create a small script that does the import and then fixes the fields, I do this quite often as Excel has the same problems as some date fields come in as character and I have to go change them after the import, this is a very common problem when performing imports, usually you need to do some data clean-up once you get the information into the software and this is not just a problem for IDEA but other tools I have used.

For the <XML_FIELD_CONTEXT> it looks like it give the path to the data that is being imported for that field.  In the samples you have an XML file and if you look at the xrdf for that file you can see for the DISCOUNT field the context is the following:  <XML_FIELD_CONTEXT>dataroot/Order_x0020_Details/Discount</XML_FIELD_CONTEXT>

If you go back to the xml you can see that the DISCOUNT field is under the Order_x0020_Details which is under the dataroot.

Brian

Fabi Thu, 02/07/2019 - 02:37

Hi Brian,
i found a way to import Data with the corresponding XSD File. If the Scheme Location is filled in the XML File IDEA will automaticly read the XSD File.
 
XML starts like this:
<?xml version="1.0" encoding="utf-8"?>
<DATA_NODE xmlns:pre="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xsi:schemaLocation="http://www.w3.org/1999/XMLSchema XSDFILENAME.XSD">
...
</DATA_NODE>
 
The XSD looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns="http://www.w3.org/1999/XMLSchema"
targetNamespace="http://www.w3.org/1999/XMLSchema">
<xsd:element name="DATA_NODE">
...
</xsd:element>
</xsd:schema>
 
You can use just the Filename if the File is in the same Directory. If it is elsewhere you could use file:///C:/.. i think but you could find the correct format in Google.
Regards
Fabian

Brian Element Thu, 02/07/2019 - 07:11

In reply to by Fabi

Hi Fabian,

Great the you found a solution and thanks for sharing it with us.

Brian

The website encountered an unexpected error. Try again later.