Re: For storing XML version in our table.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: zubair alam <zzia88(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: For storing XML version in our table.
Date: 2016-07-21 20:06:41
Message-ID: CAKFQuwbkK_=37SbYBicExd64ccq_C0_rOv4ibuNGzVbsDV1DSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jul 20, 2016 at 3:09 AM, zubair alam <zzia88(at)gmail(dot)com> wrote:

> Hi
> How i can store my xml data with their version in postgres database
> table.
>

Works on 9.5...though it doesn't seem to validate the provided value, just
stores it.

​SELECT E'<?xml version="1.0" encoding="UTF-8"?>\n<ele>Hi</ele>'::xml::text;

SELECT E'<?xml version="2.0" encoding="UTF-8"?>\n<ele>Hi</ele>'::xml::text;

CREATE TABLE xmltbl ( xmldata xml );

INSERT INTO xmltbl VALUES (E'<?xml version="2.0"
encoding="UTF-8"?>\n<ele>Hi</ele>');

SELECT replace(xmldata::text, E'\n', '') FROM xmltbl; -- xml with version
2.0 (invalid, should be 1.1...but I digress)

​David J.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-07-21 20:10:44 Re: gin index operator class functions in sql?
Previous Message Tom Lane 2016-07-21 19:54:51 Re: 9.5: pg_stat_statement and pgbench execution time discrepancies