1 / 12

XML/Schema Validation

XML/Schema Validation. COSC643 Internet Supply Chain Management Dr. Sungchul Hong. Using ALTOVA XMLSPY. www.altova.com Go to ‘Downloads’ Download XMLSPY (MissionKitXMLDevEnt2008.exe) Install ‘XMLSPY’ Get the key Finish the installation. XML Schema Validation.

nirav
Download Presentation

XML/Schema Validation

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. XML/Schema Validation COSC643 Internet Supply Chain Management Dr. Sungchul Hong

  2. Using ALTOVA XMLSPY • www.altova.com • Go to ‘Downloads’ • Download XMLSPY (MissionKitXMLDevEnt2008.exe) • Install ‘XMLSPY’ • Get the key • Finish the installation

  3. XML Schema Validation • Start XMLSPY (30 day trial)

  4. Command Icons Load xml document Validation

  5. <?xml version="1.0" encoding="UTF-8"?> <personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='personal.xsd'> <person id="Big.Boss" > <name><family>Boss</family> <given>Big</given></name> <email>chief@foo.com</email> <link subordinates="one.workertwo.workerthree.workerfour.workerfive.worker"/> </person> <person id="one.worker"> <name><family>Worker</family> <given>One</given></name> <email>one@foo.com</email> <link manager="Big.Boss"/> </person> <person id="two.worker"> <name><family>Worker</family> <given>Two</given></name> <email>two@foo.com</email> <link manager="Big.Boss"/> </person>

  6. <person id="three.worker"> <name><family>Worker</family> <given>Three</given></name> <email>three@foo.com</email> <link manager="Big.Boss"/> </person> <person id="four.worker"> <name><family>Worker</family> <given>Four</given></name> <email>four@foo.com</email> <link manager="Big.Boss"/> </person> <person id="five.worker"> <name><family>Worker</family> <given>Five</given></name> <email>five@foo.com</email> <link manager="Big.Boss"/> </person> </personnel>

  7. <?xml version="1.0" encoding="UTF-8"?> <xs:schemaxmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:element name="personnel"> <xs:complexType> <xs:sequence> <xs:element ref="person" minOccurs='1' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> <xs:unique name="unique1"> <xs:selectorxpath="person"/> <xs:fieldxpath="name/given"/> <xs:fieldxpath="name/family"/> </xs:unique> <xs:key name='empid'> <xs:selectorxpath="person"/> <xs:fieldxpath="@id"/> </xs:key> <xs:keyref name="keyref1" refer='empid'> <xs:selectorxpath="person"/> <xs:fieldxpath="link/@manager"/> </xs:keyref> </xs:element>

  8. <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:elementref="email" minOccurs='0' maxOccurs='unbounded'/> <xs:element ref="url" minOccurs='0' maxOccurs='unbounded'/> <xs:elementref="link" minOccurs='0' maxOccurs='1'/> </xs:sequence> <xs:attribute name="id" type="xs:ID" use='required'/> <xs:attribute name="note" type="xs:string"/> <xs:attribute name="contr" default="false"> <xs:simpleType> <xs:restriction base = "xs:string"> <xs:enumeration value="true"/> <xs:enumeration value="false"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="salary" type="xs:integer"/> </xs:complexType> </xs:element>

  9. <xs:element name="name"> <xs:complexType> <xs:all> <xs:element ref="family"/> <xs:element ref="given"/> </xs:all> </xs:complexType> </xs:element> <xs:element name="family" type='xs:string'/> <xs:element name="given" type='xs:string'/> <xs:element name="email" type='xs:string'/>

  10. <xs:element name="url"> <xs:complexType> <xs:attribute name="href" type="xs:string" default="http://"/> </xs:complexType> </xs:element> <xs:element name="link"> <xs:complexType> <xs:attribute name="manager" type="xs:IDREF"/> <xs:attribute name="subordinates" type="xs:IDREFS"/> </xs:complexType> </xs:element> <xs:notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/> </xs:schema>

  11. Valid Document

  12. Invalid Document

More Related