Question

I'm using Postgres 9.3 on Windows 8.1, trying the basic xml parsing functions. In the SQL Editor I write:

XMLPARSE (CONTENT 'abc<foo>bar</foo><bar>foo</bar>');

Postgres returns me the following error:

ERROR:  syntax error at or near "XMLPARSE"
LINE 1: XMLPARSE (CONTENT 'abc<foo>bar</foo><bar>foo</bar>');
        ^
********** Error **********

ERROR: syntax error at or near "XMLPARSE"
SQL state: 42601
Character: 1

Did I write something wrong? In the docs for 9.3 it says:Use of this data type requires the installation to have been built with configure --with-libxml. As I'm on windows 8.1 I have been looking in the stack builder and couldn't find the library libxml, how do I install it?

Was it helpful?

Solution

It's nothing to do with your version or platform. XMLPARSE isn't a top level command, it's a function.

regress=> XMLPARSE (CONTENT 'abc<foo>bar</foo><bar>foo</bar>');
ERROR:  syntax error at or near "XMLPARSE"
LINE 1: XMLPARSE (CONTENT 'abc<foo>bar</foo><bar>foo</bar>');
        ^

vs

regress=> SELECT XMLPARSE (CONTENT 'abc<foo>bar</foo><bar>foo</bar>');
            xmlparse             
---------------------------------
 abc<foo>bar</foo><bar>foo</bar>
(1 row)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top