<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Peter,<br>
    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.<br>
    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. <br>
    Thanks anyway for your help, its a better start, than the rest of
    the web was offering!! <br>
    Regards,<br>
    <br>
    Richard.<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 13/09/2016 17:28, Schweitzer, Peter
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAN-ku9RCtYnsrU3A+CX3SmzPPv6W+_Z_k4RLfQWGqAmBTwh_gg@mail.gmail.com"
      type="cite">
      <pre wrap="">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
<a class="moz-txt-link-rfc2396E" href="mailto:richard.mcdonnell@opw.ie"><richard.mcdonnell@opw.ie></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">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: <a class="moz-txt-link-freetext" href="http://www.opw.ie/en/disclaimer/">http://www.opw.ie/en/disclaimer/</a>

_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
      </blockquote>
      <pre wrap="">


</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <b><u>Richard McDonnell</u></b><br>
      <b><small><small><small>GIS Specialist PgD GIS AssocSCSI</small></small></small></b><br>
      <b><small>OPW FRM Data Management</small></b><br>
      <b><small>52 Stephens Green, Dublin 2.</small></b><br>
      <small><small>TEL: 01 6476543</small></small></div>
  </body>
</html>