ceumicrodata / mETL

mito ETL tool
161 stars 41 forks source link

How to configure an XML source #27

Closed stephanebrault closed 9 years ago

stephanebrault commented 9 years ago

Hello,

I'm trying to use an XML file as a source. As an example I start with the following <?xml version="1.0" ?>

47.5487066254 19.0546094353 Óbudaisziget

Here is my configuration

source: resource: /.../test.xml source: XML itemName: items fields: -name: latitude map: "lat/text" -name: longitude map: "lng/text" -name: name map: "nev/text" target: type: Static silence: false

If I try this I get Traceback (most recent call last): File "/usr/local/bin/metl", line 9, in load_entry_point('mETL==1.0.5', 'console_scripts', 'metl')() File "/usr/local/lib/python2.7/dist-packages/mETL-1.0.5-py2.7.egg/metl/script.py", line 97, in main metl.config.Config( args[0] ), File "/usr/local/lib/python2.7/dist-packages/mETL-1.0.5-py2.7.egg/metl/config.py", line 30, in init self.loadYaml( resource ) File "/usr/local/lib/python2.7/dist-packages/mETL-1.0.5-py2.7.egg/metl/config.py", line 38, in loadYaml rdict = yaml.load( file_pointer ) File "build/bdist.linux-x86_64/egg/yaml/init.py", line 71, in load

File "build/bdist.linux-x86_64/egg/yaml/constructor.py", line 37, in get_single_data File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 36, in get_single_node File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 55, in compose_document File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 133, in compose_mapping_node File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 133, in compose_mapping_node File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 84, in compose_node File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 127, in compose_mapping_node File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 98, in check_event File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 428, in parse_block_mapping_key File "build/bdist.linux-x86_64/egg/yaml/scanner.py", line 116, in check_token File "build/bdist.linux-x86_64/egg/yaml/scanner.py", line 220, in fetch_more_tokens File "build/bdist.linux-x86_64/egg/yaml/scanner.py", line 580, in fetch_value yaml.scanner.ScannerError: mapping values are not allowed here in "config.yml", line 7, column 9

With this configuration

source: resource: /.../test.xml source: XML itemName: items map: latitude: lat/text longitude: lng/text name: nev/text target: type: Static silence: false

I get a blank line. There must be something I'm doing wrong but I can't see what, I've tried lots of different things but it still doesn't work. Is there a tutorial on manipulating XML files or could you give me some hints ?

Regards,

Stéphane

stephanebrault commented 9 years ago

Hello,

I've finally managed to succeed with a XML source and a XML target. My question is therefore no longer relevant.

Regards,

Stéphane