[Qgis-user] xml metadata in PostGIS table

Richard McDonnell richard.mcdonnell at opw.ie
Wed Sep 14 01:43:09 PDT 2016


Peter,
Yes this is almost what I am looking for, 80% there....... you appear to 
be copying and pasting the whole xml, as opposed to reading a file 
directly to postgres, which is what I need.
What I relay need to do is create a batch file for windows, which I can 
drop into the folder with the xml's and batch insert. Unfortunately, my 
knowledge of batching is not as good as I would like. The other option, 
even more daunting, is to utilise Python to do the batching.
Thanks anyway for your help, its a better start, than the rest of the 
web was offering!!
Regards,

Richard.



On 13/09/2016 17:28, Schweitzer, Peter wrote:
> Richard,
>
> In PostgreSQL, I store some whole documents as XML, using
>
> create table something (
>    rec_id integer,
>    record xml
>    );
>
> and then insert like this:
>
> insert into something (rec_id,record) values ( 1,XMLPARSE (DOCUMENT
> '<?xml version="1.0 encoding="UTF-8"?><...'));
> By defining the field "record" as xml, I can use XML functions within
> PostgreSQL to look at the contents (though I rarely do this).  But the
> parsing step also catches improper XML and rejects the insert with an
> error message, very helpful.
>
> Is this the sort of information you're after?
>
> Peter
>
> On Tue, Sep 13, 2016 at 11:08 AM, Richard McDonnell
> <richard.mcdonnell at opw.ie> wrote:
>> Hello all,
>> I apologise if this is the incorrect forum for this question, but...
>> Im looking to create a table and I want to insert the xml as an attribute.
>> Anyone who uses the database stored styling in QGIS will have an idea what
>> Im on about.
>> I have thousands of these xml files and I want to insert the contents of
>> each file.
>> I have looked, but cant find it anywhere about the whole document in one
>> field.
>> Any help appreciated.
>> Regards,
>>
>> Richard.
>>
>> OPW - Ag féachaint don am atá le teacht - Ag caomhnú ón am atá thart
>> OPW - Looking to the future - Caring for the past
>>
>> ***********************************************************
>> Email Disclaimer: http://www.opw.ie/en/disclaimer/
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>

-- 
*_Richard McDonnell_*
*GIS Specialist PgD GIS AssocSCSI*
*OPW FRM Data Management*
*52 Stephens Green, Dublin 2.*
TEL: 01 6476543
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160914/f57d0144/attachment.html>


More information about the Qgis-user mailing list