{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

XML_Schema_Notes (1)

XML_Schema_Notes (1) - XML Schema XML Schema Validation...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
XML Schema
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
XML Schema Validation
Background image of page 2
Validating Your Documents To validate your XML Schema documents and instance files you can use the Multi-Schema Validator which we have been using to validate our Relax NG documents and instance files. This, however, is not a very strict validation. A better means of validating your XML Schema documents and instance files is to use Altova’s XMLSPY which does a very strict validation. To obtain a 30 day trial copy of XMLSPY, go to: http://www.altova.com/download_spy_home.html DOWN LOAD
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
XML Schema Making the Link
Background image of page 4
The First Step After creating the XML Schema document, you must the begin the instance document as you normally would with the XML processing instruction and appropriate root element: <?xml version=“1.0”?> <root_element> <!-– statements go here --> </root_element>
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Second Step After including the XML PI (processing instruction) and root element, you must then specify the XML Schema namespace using the xmlns attribute along with a prefix ( xsi in our case) so you can borrow elements and attributes from that namespace: <?xml version=“1.0”?> <root_element xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” > <!-– statements go here --> </root_element>
Background image of page 6
The Third Step Next you will include the noNamespaceSchemaLocation attribute from the XML Schema namespace along with the prefix that you previously declared ( xsi ) and include the name of the XML Schema document you created: <?xml version=“1.0”?> <root_element xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“filename.xsd” > <!-– statements go here --> </root_element>
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
XML Schema Getting Started
Background image of page 8
The First Step When creating a XML Schema document, you must begin the document with the XML processing instruction and specify the version of XML that the document is based on: <?xml version=“1.0”?> <!-– statements go here -->
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Second Step After including the XML PI (processing instruction), you must then initiate the XML schema document using the <schema> element. The remainder of the document will be encased inside this element. <?xml version=“1.0”?> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <!-– statements go here --> </schema>
Background image of page 10
The Third Step Including the <schema> element as we have done is fine but in the case of adding additional namespaces to the document, we need to expand the notation and specify the use of the XML Schema namespace so there is no confusion within the document: <?xml version=“1.0”?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-– statements go here --> </xsd:schema>
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
XML Schema Defining the Root Element
Background image of page 12
Defining the Root Element Within the <schema> element, the Root Element of the Schema (Grammar) is defined. <?xml version=“1.0”?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element/> <!-– or --> <xsd:element></xsd:element> </xsd:schema> Elements in XML Schema are defined using <element> elements.
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Defining a Root Element To define an element such as catalog or club-database , you must include the name attribute within the <element> element.
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}