Обсуждение: SQL State XX000 : XML namespace issue

Поиск
Список
Период
Сортировка

SQL State XX000 : XML namespace issue

От
Panneerselvam Posangu
Дата:
Hi,

When we run a SQL statement in Postgres 9.2 we get an error.

Error : Could not register XML namespace with name "" and URI ""
 SQL State XX000

In the SQL state we use xpath function. 
Any reason why this is happening..

Thanks,
Panneer

Re: SQL State XX000 : XML namespace issue

От
David Johnston
Дата:
Panneerselvam Posangu wrote
> Hi,
> When we run a SQL statement in Postgres 9.2 we get an error.
> Error : Could not register XML namespace with name "" and URI "" SQL State
> XX000
> In the SQL state we use xpath function. Any reason why this is happening..
> Thanks,Panneer

No.  Try providing more detail.  Especially the actual statement you are
running.  And, better, try to supply a minimal and self-contained query that
exhibits the same behavior.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/SQL-State-XX000-XML-namespace-issue-tp5786103p5786222.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: SQL State XX000 : XML namespace issue

От
Panneerselvam Posangu
Дата:
to be specific, this is the SQL.

SELECT to_number((SELECT array_to_string((SELECT xpath('/attributes/duration/text()',(SELECT XMLPARSE (CONTENT '<attributes><duration>2</duration><maxlicenses>2</maxlicenses><paymentrequired>true</paymentrequired><autopurchase>true</autopurchase><graceperiod>0</graceperiod></attributes>')),ARRAY[ARRAY['', '']])

        ),'','')),'999999999') > 30


Thank you



From: panneerpps@hotmail.com
To: polobo@yahoo.com
Subject: RE: [GENERAL] SQL State XX000 : XML namespace issue
Date: Fri, 10 Jan 2014 16:24:21 +0530

Hi,

This is the query that we use.

SELECT to_number((SELECT array_to_string((SELECT xpath('/attributes/duration/text()',(SELECT XMLPARSE (CONTENT p.ATTRIBUTES)),ARRAY[ARRAY['', '']])

        ),'','')),'999999999') > 30 from jcp_promotions_b  p


ATTRIBUTES is of type XML


Thank you

Panneer


> Date: Thu, 9 Jan 2014 21:44:11 -0800
> From: polobo@yahoo.com
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] SQL State XX000 : XML namespace issue
>
> Panneerselvam Posangu wrote
> > Hi,
> > When we run a SQL statement in Postgres 9.2 we get an error.
> > Error : Could not register XML namespace with name "" and URI "" SQL State
> > XX000
> > In the SQL state we use xpath function. Any reason why this is happening..
> > Thanks,Panneer
>
> No. Try providing more detail. Especially the actual statement you are
> running. And, better, try to supply a minimal and self-contained query that
> exhibits the same behavior.
>
> David J.
>
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/SQL-State-XX000-XML-namespace-issue-tp5786103p5786222.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

Re: SQL State XX000 : XML namespace issue

От
David Johnston
Дата:
Panneerselvam Posangu wrote
> to be specific, this is the SQL.
> SELECT to_number((SELECT
> array_to_string((SELECT xpath('/attributes/duration/text()',(SELECT
> XMLPARSE
> (CONTENT
> '
> <attributes>
> <duration>
> 2
> </duration>
> <maxlicenses>
> 2
> </maxlicenses>
> <paymentrequired>
> true
> </paymentrequired>
> <autopurchase>
> true
> </autopurchase>
> <graceperiod>
> 0
> </graceperiod>
> </attributes>
> ')),ARRAY[ARRAY['',
> '']])
>
>
> ),'','')),'999999999') > 30
> Thank you
> From:

> panneerpps@

> To:

> polobo@

> Subject: RE: [GENERAL] SQL State XX000 : XML namespace issue
> Date: Fri, 10 Jan 2014 16:24:21 +0530
>
>
>
>
> Hi,
> This is the query that we use.
> SELECT to_number((SELECT
> array_to_string((SELECT xpath('/attributes/duration/text()',(SELECT
> XMLPARSE
> (CONTENT p.ATTRIBUTES)),ARRAY[ARRAY['', '']])
>
>
> ),'','')),'999999999') > 30 from jcp_promotions_b  p
> ATTRIBUTES is of type XML
> Thank you
> Panneer
>
>> Date: Thu, 9 Jan 2014 21:44:11 -0800
>> From:

> polobo@

>> To:

> pgsql-general@

>> Subject: Re: [GENERAL] SQL State XX000 : XML namespace issue
>>
>> Panneerselvam Posangu wrote
>> > Hi,
>> > When we run a SQL statement in Postgres 9.2 we get an error.
>> > Error : Could not register XML namespace with name "" and URI "" SQL
>> State
>> > XX000
>> > In the SQL state we use xpath function. Any reason why this is
>> happening..
>> > Thanks,Panneer
>>
>> No.  Try providing more detail.  Especially the actual statement you are
>> running.  And, better, try to supply a minimal and self-contained query
>> that
>> exhibits the same behavior.
>>
>> David J.
>>
>>

Two things of note.

1) you are parsing CONTENT when the documentation says that xpath processing
only works on DOCUMENT.
2) the reason for your error.  The XML you provided does not specify a
default namespace.  Also per documentation the default namespace in the XML
document must be assigned to a non-empty alias in the namespace array and
that alias needs to be used in the xpath expression.

section 9.14.3 in the 9.3 docs

David J.






--
View this message in context:
http://postgresql.1045698.n5.nabble.com/SQL-State-XX000-XML-namespace-issue-tp5786103p5786272.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.