[Qgis-user] xml metadata in PostGIS table

Schweitzer, Peter pschweitzer at usgs.gov
Tue Sep 13 09:28:50 PDT 2016


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



-- 
Peter N. Schweitzer (U.S. Geological Survey, Reston, VA 20192)
(703) 648-6533  email: pschweitzer at usgs.gov
http://geology.usgs.gov/peter/



More information about the Qgis-user mailing list