use 'insert from url'
for example (xml on the desktop)
set Variable ($MyFile ; "file:/" & Get(DesktopPath) & "my_xml_file.xml" )
insert from url (TheField; $MyFile) // read from url
(don't have an engslish system - not sure if the commands are correct...)
THere are also plugins that let You import files
have you tried to import the 'file' into a container field? and why must it me imported? can it simply be in a location that the XSLT can find it?
I agree Markus, plugins for me is simple and it works to import your XML file as text.
Can you recommend a plugin that imports an XML file?
If you get rid of the XML declaration, it should work. I have done so before with success.
Plugin: We have the MBS plugin. Troi file, BaseElemens, etc. have the 'file-functionality' as well (among others)
For me, the 'insert from url' is easier. Built in (FM12), works fine. We got quite some FM11 solutions - there, we use MBS and/or TroiFile
directly copied from a script which does what you are trying to do:
Set Variable [$XMLHeader2; Value:"<?xml version=\"1.0\" encoding=\"utf-8\"?>"]
Set Field [ARTSupportContainerTable::gError; TrFile_Substitute( "-Encoding=UTF8" ; ARTSupportContainerTable::gFileNameOut ; ARTSupportContainerTable::gFileNameOut ; $XMLHeader2 ; "********************" )]
after this, the file is importable line-to-record.
it's actually what jlamprecht suggested.
I removed the XML declaration and and renamed the file to have a TXT extension (just in case) and I get 6,000 records imported, but other than the first few that have comments, the fields are blank.
Not sure if this is normal, but I did notice that the indentation of the nodes is done using tabs. Should this affect anything?
strange. If your original xml does not contain reserved data, compress it and attach it for us to take a look.
XML files will usually have Tabs for each line to set up clean indentation.
If you import as a CSV, they will be in the first field. You will see the tabs in the field. If you import as a TSV, they will be separated into fields.
When I was doing this, I imported as CSV and substituted the tab out. I then parsed what I wanted in the set of records.
Here's a little more information.
This is a schema file that I'm trying to import because I want to lookup elements from the XML file for validation purposes. As I understand, an XSD schema file is written in XML so I can treat it just like an XML file.
However, since I can't import it because I don't have an XSLT file (and the IRS is not responding to my emails... no surprise there!), I want to import it as a text file.
I tried renaming it with a CSV extension and importing it, but all I get is blank records. I am attaching a copy of the renamed XSD file in case someone wants to attempt to import.
My table only two fields:
_id - TEXT
rawxml - TEXT
Any and all help appreciated.
IRS-EXT-ACA-AIR-6.2.csv.zip 18.3 K
Do not rename it with an extension of CSV. Keep the TXT you have. I was suggesting to change the Import Records script to use Import File Type of CSV or TSV.
I did as you suggested and although the data appears to import properly, when you review the data, the RAWXML is empty for every record.
Strangely, when I select CSV as the file type, I can skip through the records in the Import Records dialog screen and it shows me the actual XML data, but it does not import it.
I attached a zipped copy of the file, did it show up in the thread because I don't see any attachments.
I'll be happy to email you a copy of the file if you like.