SlideShare a Scribd company logo
1 of 25
Download to read offline
The Road to the XML Type
  Current and Future Developments


Nikolay Samokhvalov   Peter Eisentraut



            PGCon 2007
Current Developments
                          Future Developments
                                   Conclusion


Outline



  1   Current Developments

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


Outline



  1   Current Developments

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


New Features



  Target for PostgreSQL 8.3:
      XML Data Type
      XML Publishing
      XML Export
      SQL:2003 conformance
      XPath




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


Outline


  1   Current Developments
        XML Data Type
        XML Publishing
        XML Export

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                            Future Developments     XML Publishing
                                     Conclusion     XML Export


XML Data Type

  CREATE TABLE test (
      ...,
      data xml,
      ...
  );

  Features:
      Input checking
      Support functions
  Issues:
      Internal storage format (plain text)
      Encoding handling

            Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                         Future Developments     XML Publishing
                                  Conclusion     XML Export


Using the XML Type
  Bizarre SQL way:

  INSERT INTO test VALUES (
      ...,
      XMLPARSE (DOCUMENT ’<foo>...</foo>’),
      ...
  );

  SELECT XMLSERIALIZE (DOCUMENT data AS varchar)
      FROM test;

  Simple PostgreSQL way:

  INSERT INTO test VALUES (... , ’<foo>...</foo>’, ...);

  SELECT data FROM test;

         Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                         Future Developments     XML Publishing
                                  Conclusion     XML Export


XML Type Oddities



     No comparison operators
     To retrieve, use:
         Cast to text, or
         XPath, or
         Other key column
     To index, use:
         Cast to text, or
         XPath




         Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


Outline


  1   Current Developments
        XML Data Type
        XML Publishing
        XML Export

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                         Future Developments     XML Publishing
                                  Conclusion     XML Export


Producing XML Content

  The old way?

  SELECT ’<record id="’ || id || ’"><value>’
         || ad_hoc_escape_func(value)
         || ’</value></record>’
      FROM tab;

  The new way:

  SELECT XMLELEMENT(NAME record,
                    XMLATTRIBUTES(id),
                    XMLELEMENT(NAME value, value))
      FROM tab;



         Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                         Future Developments     XML Publishing
                                  Conclusion     XML Export


XMLELEMENT Example
                                                  Result:
 SQL:
                                                  <?xml version=’1.0’
 XMLROOT (                                              standalone=’yes’ ?>
   XMLELEMENT (                                   <gazonk name=’val’
      NAME ’gazonk’,                                      num=’2’>
      XMLATTRIBUTES (                               <qux>foo</qux>
        ’val’ AS ’name’,                          </gazonk>
        1 + 1 AS ’num’
      ),
      XMLELEMENT (
        NAME ’qux’,
        ’foo’
      )
   ),
   VERSION ’1.0’,
   STANDALONE YES
 )
         Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


XMLFOREST Example
 SELECT xmlforest (
   "FirstName" as "FName", "LastName" as "LName",
   ’string’ as "str", "Title", "Region" )
 FROM "Demo"."demo"."Employees";

 might result in
 <FName>Nancy</FName>
 <LName>Davolio</LName>
 <str>string</str>
 <Title>Sales Representative</Title>
 <Region>WA</Region>

 . . .

 <FName>Anne</FName>
 <LName>Dodsworth</LName>
 <str>string</str>
 <Title>Sales Representative</Title>
          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                           Future Developments     XML Publishing
                                    Conclusion     XML Export


XMLAGG Example

 SELECT xmlelement (’Emp’, xmlattributes (’Sales Representative’
   xmlagg (xmlelement (’Name’, "FirstName", ’ ’, "LastName")))
   FROM "Demo"."demo"."Employees"
   WHERE "Title" = ’Sales Representative’;

 might result in

 <Emp Title="Sales Representative">
   <Name>Nancy Davolio</Name>
   <Name>Janet Leverling</Name>
   <Name>Margaret Peacock</Name>
   <Name>Michael Suyama</Name>
   <Name>Robert King</Name>
   <Name>Anne Dodsworth</Name>
 </Emp>

 (1 row)
           Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


Outline


  1   Current Developments
        XML Data Type
        XML Publishing
        XML Export

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                           Future Developments     XML Publishing
                                    Conclusion     XML Export


XML Export



      Map table/schema/database contents to XML document
      Map table/schema/database schema to XML Schema
  Useful for:
      Downstream processing (e.g., SOAP, web services)
      Postprocessing using XSLT
      Backup???
      Display formats (alternative to psql’s HTML mode)




           Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


XML Export Functions
  Data export:
  table_to_xml(tbl regclass, nulls boolean,
               tableforest boolean, targetns text)
  query_to_xml(query text, nulls boolean,
               tableforest boolean, targetns text)
  cursor_to_xml(cursor refcursor, count int, nulls boolean,
                tableforest boolean, targetns text)

  Schema export:
  table_to_xmlschema(tbl regclass, nulls boolean,
                     tableforest boolean, targetns text)
  query_to_xmlschema(query text, nulls boolean,
                     tableforest boolean, targetns text)
  cursor_to_xmlschema(cursor refcursor, nulls boolean,
                      tableforest boolean, targetns text)


          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


XML Schema Mapping Example
  CREATE TABLE test (a int PRIMARY KEY, b varchar(200));

  is mapped to
  <xsd:complexType name="RowType.catalog.schema.test">
    <xsd:sequence>
      <xsd:element name="a" type="INTEGER"></xsd:element>
      <xsd:element name="b" type="VARCHAR_200_200" minOccurs="0">
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="TableType.catalog.schema.test">
    <xsd:sequence>
      <xsd:element name="row"
          type="RowType.catalog.schema.test"
          minOccurs="0"
          maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>
          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                         Future Developments     XML Publishing
                                  Conclusion     XML Export


XML Export Format Example


  <catalogname>
    <schemaname>
      <tablename>
        <row>
          <colname1>value</colname1>
          <colname2 xsi:nil=’true’/>
          ...
        </row>
        ...
      </tablename>
      ...
    </schemaname>
    ...
  </catalogname>



         Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                          Future Developments     XML Publishing
                                   Conclusion     XML Export


Outline


  1   Current Developments
        XML Data Type
        XML Publishing
        XML Export

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                        Future Developments     XML Publishing
                                 Conclusion     XML Export


XPath




  tbd




        Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments     XML Data Type
                        Future Developments     XML Publishing
                                 Conclusion     XML Export


External Dependencies




     Uses libxml (LGPL) for XML publishing and XPath
     Enable with configure --with-libxml
     Not necessary for XML export




        Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments
                          Future Developments
                                   Conclusion


Outline



  1   Current Developments

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments
                         Future Developments
                                  Conclusion


Further Work/Ideas

     XQuery support (SQL:2006)
     Ctree indexes
     Inline ORDER BY for XMLAGG (example:
     ... XMLAGG(XMLELEMENT(...) ORDER BY col1) ...)
     Improved namespaces support
     JDBC support
     DTD, XML Schema, Relax-NG validation
     XSLT
     XML Canonical
     Pretty printing
     Shredding

         Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments
                          Future Developments
                                   Conclusion


Outline



  1   Current Developments

  2   Future Developments

  3   Conclusion




          Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type
Current Developments
                        Future Developments
                                 Conclusion


More Information




     http://developer.postgresql.org/index.php/
     XML_Support
     PostgreSQL documentation




        Nikolay Samokhvalov, Peter Eisentraut   The Road to the XML Type

More Related Content

Viewers also liked

Structure Of Atom[1] Monika Khurana
Structure Of Atom[1] Monika KhuranaStructure Of Atom[1] Monika Khurana
Structure Of Atom[1] Monika Khuranakulachihansraj
 
Chapter 2 the structure of the atom
Chapter 2 the structure of the atomChapter 2 the structure of the atom
Chapter 2 the structure of the atomLing Leon
 
Properties of matter ppt
Properties of matter pptProperties of matter ppt
Properties of matter pptdsacre
 
Structure of atom ppt
Structure of atom pptStructure of atom ppt
Structure of atom pptlekshmisg91
 
States Of Matter Power Point
States Of Matter Power PointStates Of Matter Power Point
States Of Matter Power Pointwolffer87
 
What is matter? slide show
What is matter? slide showWhat is matter? slide show
What is matter? slide showmater1ag
 

Viewers also liked (6)

Structure Of Atom[1] Monika Khurana
Structure Of Atom[1] Monika KhuranaStructure Of Atom[1] Monika Khurana
Structure Of Atom[1] Monika Khurana
 
Chapter 2 the structure of the atom
Chapter 2 the structure of the atomChapter 2 the structure of the atom
Chapter 2 the structure of the atom
 
Properties of matter ppt
Properties of matter pptProperties of matter ppt
Properties of matter ppt
 
Structure of atom ppt
Structure of atom pptStructure of atom ppt
Structure of atom ppt
 
States Of Matter Power Point
States Of Matter Power PointStates Of Matter Power Point
States Of Matter Power Point
 
What is matter? slide show
What is matter? slide showWhat is matter? slide show
What is matter? slide show
 

Similar to The Road to the XML Type: Current and Future Developments

20070524 Pgcon2007 Roadtoxmltype
20070524 Pgcon2007 Roadtoxmltype20070524 Pgcon2007 Roadtoxmltype
20070524 Pgcon2007 RoadtoxmltypeNikolay Samokhvalov
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and DevelopmentPeter Eisentraut
 
Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007
Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007
Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007Nikolay Samokhvalov
 
XML Schema Patterns for Databinding
XML Schema Patterns for DatabindingXML Schema Patterns for Databinding
XML Schema Patterns for DatabindingPaul Downey
 
Oracle XML Handling
Oracle XML HandlingOracle XML Handling
Oracle XML Handlingazharpro
 
ibm_research_aug_8_03
ibm_research_aug_8_03ibm_research_aug_8_03
ibm_research_aug_8_03Attila Barta
 
XSLT 3.0 - new features
XSLT 3.0 - new featuresXSLT 3.0 - new features
XSLT 3.0 - new featuresJakub Malý
 
Creating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | Prometheus
Creating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | PrometheusCreating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | Prometheus
Creating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | PrometheusInfluxData
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamudAsfak Mahamud
 
Converting with custom transformer part 2
Converting with custom transformer part 2Converting with custom transformer part 2
Converting with custom transformer part 2Anirban Sen Chowdhary
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVTatu Saloranta
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLTMalintha Adikari
 
XML - State of the Art
XML - State of the ArtXML - State of the Art
XML - State of the ArtJakub Malý
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1Marco Gralike
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 

Similar to The Road to the XML Type: Current and Future Developments (20)

20070524 Pgcon2007 Roadtoxmltype
20070524 Pgcon2007 Roadtoxmltype20070524 Pgcon2007 Roadtoxmltype
20070524 Pgcon2007 Roadtoxmltype
 
PostgreSQL and XML
PostgreSQL and XMLPostgreSQL and XML
PostgreSQL and XML
 
XML Support: Specifications and Development
XML Support: Specifications and DevelopmentXML Support: Specifications and Development
XML Support: Specifications and Development
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 
DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007
Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007
Postgresql N Samokhvalov P Eisentraut Xml Type Pgcon Ottawa 2007
 
PGCon-2007 The Road to XML Type
PGCon-2007 The Road to XML TypePGCon-2007 The Road to XML Type
PGCon-2007 The Road to XML Type
 
XML Schema Patterns for Databinding
XML Schema Patterns for DatabindingXML Schema Patterns for Databinding
XML Schema Patterns for Databinding
 
Oracle XML Handling
Oracle XML HandlingOracle XML Handling
Oracle XML Handling
 
ibm_research_aug_8_03
ibm_research_aug_8_03ibm_research_aug_8_03
ibm_research_aug_8_03
 
XSLT 3.0 - new features
XSLT 3.0 - new featuresXSLT 3.0 - new features
XSLT 3.0 - new features
 
Creating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | Prometheus
Creating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | PrometheusCreating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | Prometheus
Creating the PromQL Transpiler for Flux by Julius Volz, Co-Founder | Prometheus
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
 
Converting with custom transformer part 2
Converting with custom transformer part 2Converting with custom transformer part 2
Converting with custom transformer part 2
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
 
XML - State of the Art
XML - State of the ArtXML - State of the Art
XML - State of the Art
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 

More from Peter Eisentraut

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQLPeter Eisentraut
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/ProxyPeter Eisentraut
 
Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloudPeter Eisentraut
 
Most Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL FeaturesMost Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL FeaturesPeter Eisentraut
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPeter Eisentraut
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPeter Eisentraut
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePeter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsPeter Eisentraut
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQLPeter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsPeter Eisentraut
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLPeter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Peter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...Peter Eisentraut
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)Peter Eisentraut
 
The Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices ElsewhereThe Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices ElsewherePeter Eisentraut
 

More from Peter Eisentraut (20)

Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
 
Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloud
 
Most Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL FeaturesMost Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL Features
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie Datenbankalternative
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XML
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
 
Spaß mit PostgreSQL
Spaß mit PostgreSQLSpaß mit PostgreSQL
Spaß mit PostgreSQL
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)
 
SQL/MED and PostgreSQL
SQL/MED and PostgreSQLSQL/MED and PostgreSQL
SQL/MED and PostgreSQL
 
The Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices ElsewhereThe Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices Elsewhere
 

Recently uploaded

The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoUXDXConf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKUXDXConf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreelreely ones
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 

Recently uploaded (20)

The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 

The Road to the XML Type: Current and Future Developments

  • 1. The Road to the XML Type Current and Future Developments Nikolay Samokhvalov Peter Eisentraut PGCon 2007
  • 2. Current Developments Future Developments Conclusion Outline 1 Current Developments 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 3. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Outline 1 Current Developments 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 4. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export New Features Target for PostgreSQL 8.3: XML Data Type XML Publishing XML Export SQL:2003 conformance XPath Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 5. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Outline 1 Current Developments XML Data Type XML Publishing XML Export 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 6. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XML Data Type CREATE TABLE test ( ..., data xml, ... ); Features: Input checking Support functions Issues: Internal storage format (plain text) Encoding handling Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 7. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Using the XML Type Bizarre SQL way: INSERT INTO test VALUES ( ..., XMLPARSE (DOCUMENT ’<foo>...</foo>’), ... ); SELECT XMLSERIALIZE (DOCUMENT data AS varchar) FROM test; Simple PostgreSQL way: INSERT INTO test VALUES (... , ’<foo>...</foo>’, ...); SELECT data FROM test; Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 8. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XML Type Oddities No comparison operators To retrieve, use: Cast to text, or XPath, or Other key column To index, use: Cast to text, or XPath Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 9. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Outline 1 Current Developments XML Data Type XML Publishing XML Export 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 10. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Producing XML Content The old way? SELECT ’<record id="’ || id || ’"><value>’ || ad_hoc_escape_func(value) || ’</value></record>’ FROM tab; The new way: SELECT XMLELEMENT(NAME record, XMLATTRIBUTES(id), XMLELEMENT(NAME value, value)) FROM tab; Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 11. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XMLELEMENT Example Result: SQL: <?xml version=’1.0’ XMLROOT ( standalone=’yes’ ?> XMLELEMENT ( <gazonk name=’val’ NAME ’gazonk’, num=’2’> XMLATTRIBUTES ( <qux>foo</qux> ’val’ AS ’name’, </gazonk> 1 + 1 AS ’num’ ), XMLELEMENT ( NAME ’qux’, ’foo’ ) ), VERSION ’1.0’, STANDALONE YES ) Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 12. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XMLFOREST Example SELECT xmlforest ( "FirstName" as "FName", "LastName" as "LName", ’string’ as "str", "Title", "Region" ) FROM "Demo"."demo"."Employees"; might result in <FName>Nancy</FName> <LName>Davolio</LName> <str>string</str> <Title>Sales Representative</Title> <Region>WA</Region> . . . <FName>Anne</FName> <LName>Dodsworth</LName> <str>string</str> <Title>Sales Representative</Title> Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 13. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XMLAGG Example SELECT xmlelement (’Emp’, xmlattributes (’Sales Representative’ xmlagg (xmlelement (’Name’, "FirstName", ’ ’, "LastName"))) FROM "Demo"."demo"."Employees" WHERE "Title" = ’Sales Representative’; might result in <Emp Title="Sales Representative"> <Name>Nancy Davolio</Name> <Name>Janet Leverling</Name> <Name>Margaret Peacock</Name> <Name>Michael Suyama</Name> <Name>Robert King</Name> <Name>Anne Dodsworth</Name> </Emp> (1 row) Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 14. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Outline 1 Current Developments XML Data Type XML Publishing XML Export 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 15. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XML Export Map table/schema/database contents to XML document Map table/schema/database schema to XML Schema Useful for: Downstream processing (e.g., SOAP, web services) Postprocessing using XSLT Backup??? Display formats (alternative to psql’s HTML mode) Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 16. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XML Export Functions Data export: table_to_xml(tbl regclass, nulls boolean, tableforest boolean, targetns text) query_to_xml(query text, nulls boolean, tableforest boolean, targetns text) cursor_to_xml(cursor refcursor, count int, nulls boolean, tableforest boolean, targetns text) Schema export: table_to_xmlschema(tbl regclass, nulls boolean, tableforest boolean, targetns text) query_to_xmlschema(query text, nulls boolean, tableforest boolean, targetns text) cursor_to_xmlschema(cursor refcursor, nulls boolean, tableforest boolean, targetns text) Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 17. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XML Schema Mapping Example CREATE TABLE test (a int PRIMARY KEY, b varchar(200)); is mapped to <xsd:complexType name="RowType.catalog.schema.test"> <xsd:sequence> <xsd:element name="a" type="INTEGER"></xsd:element> <xsd:element name="b" type="VARCHAR_200_200" minOccurs="0"> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TableType.catalog.schema.test"> <xsd:sequence> <xsd:element name="row" type="RowType.catalog.schema.test" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 18. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XML Export Format Example <catalogname> <schemaname> <tablename> <row> <colname1>value</colname1> <colname2 xsi:nil=’true’/> ... </row> ... </tablename> ... </schemaname> ... </catalogname> Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 19. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export Outline 1 Current Developments XML Data Type XML Publishing XML Export 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 20. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export XPath tbd Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 21. Current Developments XML Data Type Future Developments XML Publishing Conclusion XML Export External Dependencies Uses libxml (LGPL) for XML publishing and XPath Enable with configure --with-libxml Not necessary for XML export Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 22. Current Developments Future Developments Conclusion Outline 1 Current Developments 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 23. Current Developments Future Developments Conclusion Further Work/Ideas XQuery support (SQL:2006) Ctree indexes Inline ORDER BY for XMLAGG (example: ... XMLAGG(XMLELEMENT(...) ORDER BY col1) ...) Improved namespaces support JDBC support DTD, XML Schema, Relax-NG validation XSLT XML Canonical Pretty printing Shredding Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 24. Current Developments Future Developments Conclusion Outline 1 Current Developments 2 Future Developments 3 Conclusion Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type
  • 25. Current Developments Future Developments Conclusion More Information http://developer.postgresql.org/index.php/ XML_Support PostgreSQL documentation Nikolay Samokhvalov, Peter Eisentraut The Road to the XML Type