Thread: xml_valid function

xml_valid function

From
"George Pavlov"
Date:
Not sure what the correct forum for pgxml/xml2 questions is. I was
wondering what is the definition of "valid" that the xml_valid(text)
function that is part of that module uses? It seems different from the
W3C definition of "valid" XML (is there an implicit DTD?) Maybe it is
more akin to "well-formed"?

George

Re: xml_valid function

From
John Gray
Date:
On Wed, 25 Jan 2006 17:11:04 -0800, George Pavlov wrote:

> Not sure what the correct forum for pgxml/xml2 questions is. I was
> wondering what is the definition of "valid" that the xml_valid(text)
> function that is part of that module uses? It seems different from the
> W3C definition of "valid" XML (is there an implicit DTD?) Maybe it is
> more akin to "well-formed"?
>

It is indeed well-formed. That just seemed a long name for the function!

Regards

John


Re: xml_valid function

From
"Roger Hand"
Date:
John Gray wrote on
Friday, January 27, 2006 12:24 PM
> On Wed, 25 Jan 2006 17:11:04 -0800, George Pavlov wrote:
>
>> Not sure what the correct forum for pgxml/xml2 questions is. I was
>> wondering what is the definition of "valid" that the xml_valid(text)
>> function that is part of that module uses? It seems different from the
>> W3C definition of "valid" XML (is there an implicit DTD?) Maybe it is
>> more akin to "well-formed"?
>>
>
> It is indeed well-formed. That just seemed a long name for the function!
>
> John

Valid means it's been checked against, and conforms to, a DTD. If it hasn't been then it can't
be said to be valid.

-Roger

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Re: xml_valid function

From
John Gray
Date:
On Fri, 2006-01-27 at 12:32 -0800, Roger Hand wrote:
> John Gray wrote on
> Friday, January 27, 2006 12:24 PM
> > On Wed, 25 Jan 2006 17:11:04 -0800, George Pavlov wrote:
> >
> >> Not sure what the correct forum for pgxml/xml2 questions is. I was
> >> wondering what is the definition of "valid" that the xml_valid(text)
> >> function that is part of that module uses? It seems different from the
> >> W3C definition of "valid" XML (is there an implicit DTD?) Maybe it is
> >> more akin to "well-formed"?
> >>
> >
> > It is indeed well-formed. That just seemed a long name for the function!
> >
> > John
>
> Valid means it's been checked against, and conforms to, a DTD. If it hasn't been then it can't
> be said to be valid.
>

I know that - my point was just that when I was naming the functions, I
(perhaps foolishly, in hindsight) decided that xml_wellformed seemed a
longish name for a basic function. The README does in fact state that it
checks well-formedness and not validity. It's easily changed in the SQL
file if you'd rather have a different name for your installation.

As for changing it in the distribution, I can see some
backward-compatibility issues (I suspect it may be in production use
under that name) - but if there were to be a version which validated a
document against a DTD it would be a two parameter version which would
therefore have a different signature for PG.

Regards

John



Re: xml_valid function

From
Scott Marlowe
Date:
On Fri, 2006-01-27 at 15:21, John Gray wrote:

> I know that - my point was just that when I was naming the functions, I
> (perhaps foolishly, in hindsight) decided that xml_wellformed seemed a
> longish name for a basic function. The README does in fact state that it
> checks well-formedness and not validity. It's easily changed in the SQL
> file if you'd rather have a different name for your installation.
>
> As for changing it in the distribution, I can see some
> backward-compatibility issues (I suspect it may be in production use
> under that name) - but if there were to be a version which validated a
> document against a DTD it would be a two parameter version which would
> therefore have a different signature for PG.

A lot of validators make it clear that you can validate xml with or
without a DTD.  So, it makes sense to have an overloaded xml_valid()
function that accepts a single argument (plain xml) and a two parter
that takes xml and a dtd as the two arguments.