For storing XML version in our table.

Started by zubair alamover 9 years ago3 messagesgeneral
Jump to latest
#1zubair alam
zzia88@gmail.com

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

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: zubair alam (#1)
Re: For storing XML version in our table.

On Wed, Jul 20, 2016 at 3:09 AM, zubair alam <zzia88@gmail.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.​

#3Charles Clavadetscher
clavadetscher@swisspug.org
In reply to: zubair alam (#1)
Re: For storing XML version in our table.

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of zubair alam
Sent: Mittwoch, 20. Juli 2016 09:09
To: pgsql-general@postgresql.org
Subject: [GENERAL] For storing XML version in our table.

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

You can start reading here for the current version (9.5 at the time of this writing):

https://www.postgresql.org/docs/current/static/datatype-xml.html
https://www.postgresql.org/docs/current/static/functions-xml.html

Regards
Charles

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general