1 / 10

Organization

Organization. No tutorial next week Next sheet hand in on the 05.06.07 Tuesday. <?xml version="1.0"?> <movies xmlns:xmllib="http://www.xmlmovielibrary.com"> <xmllib:title>Star Wars:Episode I-The Phantom Menace</xmllib:title> <xmllib:year>1999</xmllib:year>

bob
Download Presentation

Organization

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. Organization • No tutorial next week • Next sheet hand in on the 05.06.07 Tuesday

  2. <?xml version="1.0"?> <movies xmlns:xmllib="http://www.xmlmovielibrary.com"> <xmllib:title>Star Wars:Episode I-The Phantom Menace</xmllib:title> <xmllib:year>1999</xmllib:year> <purchase xmlns:xmllib="http://www.othermovielibrary.com"> <xmllib:title>Star Wars:Episode II-Attack of the Clones </xmllib:title> <xmllib:year>2002</xmllib:year> </purchase> <xmllib:title>Star Wars:Episode III-Revenge of the Sith</xmllib:title> <xmllib:year>2005</xmllib:year> </movies> • The W3C Namespaces in XML Recommendation enforces some namespace constraints: • Prefixes beginning with the three-letter sequence x, m, and l, in any case combination, are reserved for use by XML and XML-related specifications. Although not a fatal error, it is inadvisable to bind such prefixes. The prefix xml is by definition bound to the namespace name http://www.w3.org/XML/1998/namespace. • A prefix cannot be used unless it is declared and bound to a namespace. (Using variable in Java without declaring it)

  3. <?xml version="1.0"?> <bk:book xmlns:bk="tar"> <bk:title/> </bk:book> <?xml version="1.0"?> <bk:book xmlns:bk="tar"> <title/> </bk:book> <?xml version="1.0"?> <book xmlns="tar"> <title xmlns=“”/> </book>

  4. <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:abc="http://abc.com/" targetNamespace="http://abc.com/" elementFormDefault="unqualified" attributeFormDefault="unqualified"> <element name="books" type="abc:t1"/> <element name="comments" type="string"/> <complexType name="t1"> <sequence> <element name="book" type="abc:t2"/> <element ref="abc:comments" minOccurs="0"/> </sequence> </complexType> <complexType name="t2"> <sequence> <element name="title" type="string"/> </sequence> </complexType> </schema>

  5. <?xml version="1.0" encoding="UTF-8"?> <bk:books xmlns:bk="http://www.abc.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <book> <title>XML for dummies</title> </book> <bk:comments>Books one the topc XML</bk:comments> </bk:books> Qualified:definine elements and attributes in the target namespace Unqualified: elements and attributes in any namespace <?xml version="1.0" encoding="UTF-8"?> <bk:books xmlns:bk="http://www.abc.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <bk:book> <bk:title>XML for dummies</bk:title> </bk:book> <bk:comments>Books one the topc XML</bk:comments> </bk:books>

  6. <xsd:key name="itemNumKey"> <xsd:selector xpath=".//item"/> <xsd:field xpath="number"/> </xsd:key> <xsd:keyref name="itemNumKeyRef" refer="itemNumKey"> <xsd:selector xpath="products/*"/> <xsd:field xpath="@number"/> </xsd:keyref> </xsd:element> …..

  7. Unique vs. Key • Unique = guarantees uniqueness, nullable • Key = guarantees uniqueness and existence • always be present (minOccurs must be greater than zero) • be non-nullable (i.e., nullable="false") • be unique • Key implies unique, but unique does not imply key

More Related