XML Schema/Relational Schema in DB29

Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XML Schema/Relational Schema in DB29

 
0
  #41
Jan 8th, 2008
What are the advantages of using XSDs validation over DTDs?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XML Schema/Relational Schema in DB29

 
0
  #42
Jan 17th, 2008
SQL/XML scores over XQuery in below areas:

i) If your query need to return data from relational columns and from XML columns at the same time.
ii) If your query require full-text search conditions.
iii) If you want results returned as sets and missing XML elements represented with nulls.
iv) If you want to use parameter markers, because XQuery does not supports external parameters.
v) SQL/XML is good for applications that need to integrate relational and XML data. It provides the easiest means to join XML data and relational data.
vi) SQL/XML is good for grouping and aggregating of XML. The XQuery language does not provide an explicit group-by construct. Although grouping and aggregation can be expressed in XQuery using self-joins, it is quite awkward.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XML Schema/Relational Schema in DB29

 
0
  #43
Jan 21st, 2008
What are XML schema definition (XSDs) language built-in datatypes?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XML Schema/Relational Schema in DB29

 
0
  #44
Jan 24th, 2008
XSDs built-in datatypes are those which are defined below, and can be either primitive or derived.
Conceptually there is no difference between the built-in and derived datatypes.

Built-in primitive datatypes:
i) duration, dateTime, time, date, gYearMonth, gYear, gMonthDay, gDay, gMonth, boolean, base64Binary, hexBinary, float, double, anyURL, QName, NOTATION, string, decimal.

Built-in derived datatypes:
ii) normalizedString, integer, token, nonPositiveInteger, long, nonNegativeInteger, language, Name, NMTOKEN, negativeInteger, int, unsignedLong, positiveInteger, NCName, NMTOKENS, short, unsignedInt, ID, IDREF, ENTITY, IDREFS, ENTITIES, byte, unsignedShort, unsignedByte.

Each built-in datatype can be uniquely addressed via a URL reference constructed as below:

i) the base URL is the URL of the XML Schema namespace
ii) the fragment identifier is the name of the datatype or facet definition element

For example, to address the "int" datatype, the URL is:

http://www.w3.org/2001/XMLSchema#int

For example, to address the "maxInclusive" facet, the URL is:

http://www.w3.org/2001/XMLSchema#maxInclusive

Each facet usage in a built-in datatype definition can be uniquely addressed via a URL constructed as follows:

The fragment identifier is the name of the datatype, followed by a period (".") followed by the name of the facet
For example, to address the usage of the “maxInclusive” facet in the definition of “int”, the URL is:

http://www.w3.org/2001/XMLSchema#int.maxInclusive


You can read more at:
http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XML Schema/Relational Schema in DB29

 
0
  #45
Jan 30th, 2008
I want to validate my XML data by creating a new XML schema. Can I get a working example to create a new XML schema?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XML Schema/Relational Schema in DB29

 
0
  #46
Feb 6th, 2008
In this example XML Schema is written to validate the below XML document:
  1. <electronicStockPrice>
  2. <name>electron tube light</name>
  3. <ask>102.54</ask>
  4. <bid>102.54</bid>
  5. <barcode>102.54</ barcode>
  6. </electronicStockPrice>
First we need to write a XML Schema Definition (XSD) file: electronicStockPrice.xsd

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xs:schema targetNamespace="http://wwww.mycompany.com/products" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  3.  
  4. <xsd:simpleType name='BarcodeType'>
  5. <restriction base='string'>
  6. <pattern value='\d{3}-[A-Z]{2}'/>
  7. </restriction>
  8. </xsd:simpleType>
  9. <xsd:simpleType name="PriceType">
  10. <xsd:restriction base="xsd:decimal">
  11. <xsd:minInclusive value="0"/>
  12. <xsd:maxInclusive value="100000"/>
  13. <xsd:totalDigits value="9"/>
  14. <xsd:fractionDigits value="3"/>
  15. </xsd:restriction>
  16. </xsd:simpleType>
  17. <xsd:complexType name="StockPriceType">
  18. <xsd:sequence>
  19. <xsd:element name="name" type="xsd:string">
  20. <xsd:element name="ask" type="PriceType">
  21. <xsd:element name="bid" type="PriceType">
  22. <xsd:element name="barcode" type="BarcodeType">
  23. </xsd:sequence>
  24. </xsd:complexType>
  25. <xsd:element name="electronicStockPrice" type="StockPriceType">
  26. </xs:schema>

The next step is to register and complete registration of the XML schema as follows, providing the absolute path to the sqllib/samples/xml directory on your system and a URL com.mycompany.products :

REGISTER XMLSCHEMA http://wwww.mycompany.com/products FROM 'file:///<c:/sqllib/samples/xml> electronicStockPrice.xsd' AS com.mycompany.products COMPLETE
Last edited by peter_budo; Feb 6th, 2008 at 5:38 am. Reason: Please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XML Schema/Relational Schema in DB29

 
0
  #47
Feb 14th, 2008
I have a problem while validating “end_date” element of XML data. How do I validate “end_date” element of XML data? Did anyone face this problem before?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: XML Schema/Relational Schema in DB29

 
0
  #48
Mar 10th, 2008
This is a type of check constraint ("END_DATE > START_DATE") that cannot be validated using only resources of the XML schema. In order to solve this problem, the best alternative is to use the Schematron rule based language. The link between XML schema and the Schematron is done using the annotation/appinfo element.

In below example we can see the definition of END_DATE element with the integrity of Schematron notation, the check constraint is ("END_DATE > START_DATE").

XML, XSLT and XPATH Syntax (Toggle Plain Text)
  1. <xsd:element name="END_DATE" type="DATE" nillable="true">
  2. <xsd:annotation>
  3. <xsd:appinfo>
  4. <sch:pattern name="Check constraint end_date > start_date">
  5. <sch:rule context="END_DATE">
  6. <sch:assert test="( ./@xsi:nil='true' or (number(translate(./text(),'-','')) > number(translate(../START_DATE/text(),'-',''))))">
  7. END_DATE must be greater than START_DATE.
  8. </sch:assert>
  9. </sch:rule>
  10. </sch:pattern>
  11. </xsd:appinfo>
  12. </xsd:annotation>
  13. </xsd:element>

The business rule is revealed with the use of an XPATH expression in the selected context END_DATE.
To validate the Schematron rule it is necessary to use an XSLT processor (for example, the saxon).

The list below shows the necessary steps in validating the Schematron rules using the saxon.

i) saxon new_project.sch XSD2SCHTRN.XSL > proj_sch.xsd
ii) saxon proj_sch.xsd schematron-basic.xsl > validator.xsl
iii) saxon project.xml validator.xsl > result2.txt

You can find more information at:
http://www.ibm.com/developerworks/db.../0209lima.html
Last edited by peter_budo; Mar 10th, 2008 at 9:48 am. Reason: Keep It Organized - missing [code] tags
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 21
Reputation: v.godhe is an unknown quantity at this point 
Solved Threads: 0
v.godhe v.godhe is offline Offline
Newbie Poster

Re: XML Schema/Relational Schema in DB29

 
0
  #49
Mar 17th, 2008
I am working on project that uses Java. I want to know mapping between DB2 data types and XML data types. Can you give me the list of data type mapping?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 6
Reputation: ash05 is an unknown quantity at this point 
Solved Threads: 1
ash05 ash05 is offline Offline
Newbie Poster

Re: XML Schema/Relational Schema in DB29

 
0
  #50
Jul 11th, 2008
SQL-Structured Query Language
If you store such data in relational tables, you will have complicated relational schemas, which means you require many tables. Managing these tables can have overhead. The SQL query to access such data requires joining many tables.

SEO,Website development,Website designing

Office Space Delhi, Business Centre Delhi, Business Office Centre Delhi
Last edited by ash05; Jul 11th, 2008 at 3:19 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the XML, XSLT and XPATH Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC