XML export

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

XML export

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
The issue of XML export has been discussed a few times throughout
history.  Right now you've got the HTML output in psql.  A few
people have proposed "real" XML output formats in psql or elsewhere.

I dug out some old code today that implements what SQL/XML has to say
on the matter and fitted the code to work with the current XML support
in the backend.

Below are examples of what it can do.  I'm thinking about hosting this
on PgFoundry, but if the crowd thinks this should be somewhere else,
short of the moon, let me know.


regression=# select table_to_xml('select * from emp');                        table_to_xml
---------------------------------------------------------------
      sharon    25    (15,12)    1000    sam  

...
      linda    19    (0.9,6.1)    100      
(1 row) As a use case of sorts, I've got an XSLT stylesheet that can convert this to HTML tables. regression=# select table_to_xmlschema('select * from emp'); table_to_xmlschema ----------------------------------------------------------------------------------------------------------------- (1 row) I also have a table function which can convert both of these back into an table, so that would be XML import. But that doesn't work quite yet. -- Peter Eisentraut http://developer.postgresql.org/~petere/

Re: XML export

От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
Peter Eisentraut wrote:
> The issue of XML export has been discussed a few times throughout
> history.  Right now you've got the HTML output in psql.  A few
> people have proposed "real" XML output formats in psql or elsewhere.
> 
> I dug out some old code today that implements what SQL/XML has to say
> on the matter and fitted the code to work with the current XML support
> in the backend.
> 
> Below are examples of what it can do.  I'm thinking about hosting this
> on PgFoundry, but if the crowd thinks this should be somewhere else,
> short of the moon, let me know.
> 

Integrated, native XML support can only help PostgreSQL. IMO, I want
this in core.

Sincerely,

Joshua D. Drake



-- 
     === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997            http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


Re: XML export

От:
Theo Schlossnagle <jesus@omniti.com>
Дата:

On Feb 10, 2007, at 2:35 PM, Joshua D. Drake wrote:

> Peter Eisentraut wrote:
>> The issue of XML export has been discussed a few times throughout
>> history.  Right now you've got the HTML output in psql.  A few
>> people have proposed "real" XML output formats in psql or elsewhere.
>>
>> I dug out some old code today that implements what SQL/XML has to say
>> on the matter and fitted the code to work with the current XML  
>> support
>> in the backend.
>>
>> Below are examples of what it can do.  I'm thinking about hosting  
>> this
>> on PgFoundry, but if the crowd thinks this should be somewhere else,
>> short of the moon, let me know.
>>
>
> Integrated, native XML support can only help PostgreSQL. IMO, I want
> this in core.

Agreed.  In the server would be more useful to more people I think.   
It would be really convenient to be able to have "no effort" XML  
results sets to queries.

// Theo Schlossnagle
// Principal@OmniTI: http://omniti.com
// Esoteric Curio: http://www.lethargy.org/~jesus/


Re: XML export

От:
Dave Page <dpage@postgresql.org>
Дата:
Joshua D. Drake wrote:
> Peter Eisentraut wrote:
>> The issue of XML export has been discussed a few times throughout
>> history.  Right now you've got the HTML output in psql.  A few
>> people have proposed "real" XML output formats in psql or elsewhere.
>>
>> I dug out some old code today that implements what SQL/XML has to say
>> on the matter and fitted the code to work with the current XML support
>> in the backend.
>>
>> Below are examples of what it can do.  I'm thinking about hosting this
>> on PgFoundry, but if the crowd thinks this should be somewhere else,
>> short of the moon, let me know.
>>
> 
> Integrated, native XML support can only help PostgreSQL. IMO, I want
> this in core.

+1

Regards, Dave.

Re: XML export

От:
Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
Дата:
Peter Eisentraut wrote:
> The issue of XML export has been discussed a few times throughout
> history.  Right now you've got the HTML output in psql.  A few
> people have proposed "real" XML output formats in psql or elsewhere.
> 
> I dug out some old code today that implements what SQL/XML has to say
> on the matter and fitted the code to work with the current XML support
> in the backend.
> 
> Below are examples of what it can do.  I'm thinking about hosting this
> on PgFoundry, but if the crowd thinks this should be somewhere else,
> short of the moon, let me know.

I'm not really a XML fan - but nevertheless having something like this
in core sounds useful.

Stefan

Re: XML export

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:


Peter Eisentraut wrote:
>
> Below are examples of what it can do.  I'm thinking about hosting this
> on PgFoundry, but if the crowd thinks this should be somewhere else,
> short of the moon, let me know.
>
>
>
>   

How do you treat columns whose names are not legal XML names?

I'm glad to see you treat NULL as an attribute - that's definitely the 
right way I think.

Have you thought about possibly using a standard encoding (e.g. base64) 
for bytea? Not sure what the standard says on encoding.

cheers

andrew

Re: XML export

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Andrew Dunstan wrote:
> How do you treat columns whose names are not legal XML names?

There are escape mechanisms in place.  You can verify yourself how they 
work using

select xmlelement(name "something unusual");

> I'm glad to see you treat NULL as an attribute - that's definitely
> the right way I think.

The standard provides for the option of representing them the way I 
showed or omitting them.

> Have you thought about possibly using a standard encoding (e.g.
> base64) for bytea? Not sure what the standard says on encoding.

It says to use base64 or hex.  You can also verify that yourself using

select xmlelement(name foo, bytea 'something');

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: XML export

От:
David Fetter <david@fetter.org>
Дата:
On Sat, Feb 10, 2007 at 11:35:08AM -0800, Joshua D. Drake wrote:
> Peter Eisentraut wrote:
> > The issue of XML export has been discussed a few times throughout
> > history.  Right now you've got the HTML output in psql.  A few
> > people have proposed "real" XML output formats in psql or elsewhere.
> > 
> > I dug out some old code today that implements what SQL/XML has to say
> > on the matter and fitted the code to work with the current XML support
> > in the backend.
> > 
> > Below are examples of what it can do.  I'm thinking about hosting this
> > on PgFoundry, but if the crowd thinks this should be somewhere else,
> > short of the moon, let me know.
> > 
> 
> Integrated, native XML support can only help PostgreSQL. IMO, I want
> this in core.

+1 :)

Cheers,
D
-- 
David Fetter  http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!

Re: XML export

От:
"Pavel Stehule" <pavel.stehule@hotmail.com>
Дата:
Hello

If you integrate xml_export to core, you don't need string argument, which 
isn't too handy, but you can use COPY stmt aparat. I don't speak about 
enhancing stmt COPY.

Regards
Pavel Stehule

p.s.
it's can be great if xmloutput will be independent on datestyle
root=# set datestyle TO German ;
SET
root=# select xmlelement(name bbb, current_date);     xmlelement
-----------------------
11.02.2007

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci. 
http://messenger.msn.cz/


Re: XML export

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Pavel Stehule wrote:
> If you integrate xml_export to core, you don't need string argument,
> which isn't too handy, but you can use COPY stmt aparat. I don't
> speak about enhancing stmt COPY.

Then what do you speak about?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: XML export

От:
"Pavel Stehule" <pavel.stehule@hotmail.com>
Дата:
>Pavel Stehule wrote:
> > If you integrate xml_export to core, you don't need string argument,
> > which isn't too handy, but you can use COPY stmt aparat. I don't
> > speak about enhancing stmt COPY.
>
>Then what do you speak about?
>

I thought about some special function. But why not? COPY is perfect for this 
task.

Regards
Pavel Stehule

_________________________________________________________________
Najdete si svou lasku a nove pratele na Match.com. http://www.msn.cz/


Re: XML export

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Pavel Stehule wrote:
> I thought about some special function. But why not? COPY is perfect
> for this task.

I don't understand what you are asking for.  Please show an example.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: XML export

От:
Tino Wildenhain <tino@wildenhain.de>
Дата:
Peter Eisentraut schrieb:
> The issue of XML export has been discussed a few times throughout
> history.  Right now you've got the HTML output in psql.  A few
> people have proposed "real" XML output formats in psql or elsewhere.
> 
> I dug out some old code today that implements what SQL/XML has to say
> on the matter and fitted the code to work with the current XML support
> in the backend.
> 
> Below are examples of what it can do.  I'm thinking about hosting this
> on PgFoundry, but if the crowd thinks this should be somewhere else,
> short of the moon, let me know.
> 
> 
> regression=# select table_to_xml('select * from emp');
>                          table_to_xml
> ---------------------------------------------------------------
>  
> 
>    
>      sharon
>      25
>      (15,12)
>      1000
>      sam
>    
> 
> ...
> 
>    
>      linda
>      19
>      (0.9,6.1)
>      100
>      
>    
> 
>  
> > (1 row) > > As a use case of sorts, I've got an XSLT stylesheet that can convert > this to HTML tables. > > regression=# select table_to_xmlschema('select * from emp'); > table_to_xmlschema > ----------------------------------------------------------------------------------------------------------------- > xmlns:xsd='http://www.w3.org/2001/XMLSchema' > xmlns:sqlxml='http://standards.iso.org/iso/9075/2003/sqlxml'> > > namespace='http://standards.iso.org/iso/9075/2003/sqlxml' > schemaLocation='http://standards.iso.org/iso/9075/2003/sqlxml.xsd'/> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > (1 row) > > > I also have a table function which can convert both of these back into > an table, so that would be XML import. But that doesn't work quite yet. > How would you express null in the values above? Regards Tino

Re: XML export

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Tino Wildenhain wrote:
> >    
> >      linda
> >      19
> >      (0.9,6.1)
> >      100
> >              ^^^^^^^^^^^^^^^^^^^^^^^^^
> >    

> How would you express null in the values above?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

FAQ