1 / 8

Recursive relationship

Recursive relationship. Data model. <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="monarchs"> <xsd:complexType> <xsd:sequence>

Download Presentation

Recursive relationship

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Recursive relationship

  2. Data model

  3. <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="monarchs"> <xsd:complexType> <xsd:sequence> <xsd:element name="monarch" type="monarchType" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="monarchType"> <xsd:sequence> <xsd:element name="monarchID" type="xsd:ID"/> <xsd:element name="monarchName" type="xsd:string"/> <xsd:element name="monarchNumber" type="xsd:string"/> <xsd:element name="monarchType" type="xsd:string"/> <xsd:element name="monarchBegin" type="xsd:date"/> <xsd:element name="predecessor" type="xsd:IDREF" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema>

  4. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="president.xsl"?> <monarchs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="monarch.xsd"> <monarch> <monarchID>m1</monarchID> <monarchName>William</monarchName> <monarchNumber>IV</monarchNumber> <monarchType>King</monarchType> <monarchBegin>1830-06-26</monarchBegin> </monarch> <monarch> <monarchID>m2</monarchID> <monarchName>Victoria</monarchName> <monarchNumber>I</monarchNumber> <monarchType>Queen</monarchType> <monarchBegin>1837-06-20</monarchBegin> <predecessor>m1</predecessor> </monarch> </monarchs>

  5. <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"> <xsd:element name="employees"> <xsd:complexType> <xsd:sequence> <xsd:element name="employee" type="empType" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="empType"> <xsd:sequence> <xsd:element name="empID" type="xsd:ID"/> <xsd:element name="empFirstName" type="xsd:string"/> <xsd:element name="empSalary" type="xsd:integer"/> <xsd:element name="subordinates" type="subType" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="subType"> <xsd:sequence> <xsd:element name="subordinate" type="xsd:IDREF"/> </xsd:sequence> </xsd:complexType> </xsd:schema>

  6. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="employee.xsl"?> <employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="employee.xsd"> <employee> <empID>e1</empID> <empFirstName>Alice</empFirstName> <empSalary>75000</empSalary> <subordinates> <subordinate>e2</subordinate> </subordinates> </employee> <employee> <empID>e2</empID> <empFirstName>Ned</empFirstName> <empSalary>45000</empSalary> <subordinates> <subordinate>e3</subordinate> </subordinates> <subordinates> <subordinate>e4</subordinate> </subordinates> </employee> <employee> <empID>e3</empID> <empFirstName>Andrew</empFirstName> <empSalary>25000</empSalary> </employee> <employee> <empID>e4</empID> <empFirstName>Clare</empFirstName> <empSalary>25000</empSalary> </employee> </employees>

  7. <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"> <xsd:element name="products"> <xsd:complexType> <xsd:sequence> <xsd:element name="product" type="prodType" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="prodType"> <xsd:sequence> <xsd:element name="prodID" type="xsd:ID"/> <xsd:element name="prodName" type="xsd:string"/> <xsd:element name="prodCost" type="xsd:decimal" minOccurs="0"/> <xsd:element name="prodPrice" type="xsd:decimal"/> <xsd:element name="components" type="componentsType" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="componentsType"> <xsd:sequence> <xsd:element name="component" type="xsd:IDREF"/> <xsd:element name="componentqty" type="xsd:integer"/> </xsd:sequence> </xsd:complexType> </xsd:schema>

  8. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="product.xsl"?> <products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="product.xsd"> <product> <prodID>p1000</prodID> <prodName>Animal photography kit</prodName> <prodPrice>725</prodPrice> <components> <component>p101</component> <componentqty>1</componentqty> </components> </product> <product> <prodID>p101</prodID> <prodName>Camera case</prodName> <prodCost>150</prodCost> <prodPrice>300</prodPrice> </product> </products>

More Related