Ca201 word application
This presentation is the property of its rightful owner.
Sponsored Links
1 / 10

CA201 Word Application PowerPoint PPT Presentation


  • 61 Views
  • Uploaded on
  • Presentation posted in: General

CA201 Word Application. XML Week # 10 By Tariq Ibn Aziz Dammam Community college. Objectives. In this chapter you will learn to: XML Document Create XML Schema. XML Document in Word. Let's have a look at this XML document called “ Simple.xml ” XML document has a root element persons.

Download Presentation

CA201 Word Application

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Ca201 word application

CA201Word Application

XML

Week # 10

By

Tariq Ibn Aziz

Dammam Community college


Objectives

Objectives

  • In this chapter you will learn to:

    • XML Document

    • Create XML Schema

Tariq Aziz, Dammam Community College


Xml document in word

XML Document in Word

  • Let's have a look at this XML document called “Simple.xml”

  • XML document has a root element persons.

  • The “persons” element contains 1 child element “person”.

  • “person” appears twice and contain name, address, city, and country elements.

Tariq Aziz, Dammam Community College


Xml document in notepad

XML Document in Notepad

<?xml version="1.0" encoding="ISO-8859-1"?>

<persons

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="simple.xsd">

<person>

<name>Ola Nordmann</name>

<address>Langgt 23</address>

<city>4000 Stavanger</city>

<country>Norway</country>

</person>

</persons>

Tariq Aziz, Dammam Community College


Xml document

XML Document

  • The line above:

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    tells the XML parser that this document should be validated against a schema.

  • The line:

    xsi:noNamespaceSchemaLocation="simple.xsd"

    specifies WHERE the schema resides (here it is in the same folder as "simple.xml").

Tariq Aziz, Dammam Community College


Create xml schema

Create XML Schema

  • Open a file in Notepad and name it “Simple.xsd”

  • To create the schema we could simply follow the structure in the XML document and define each element as we find it.

  • We will start with the standard XML declaration followed by the xs:schema element that defines a schema

    <?xml version="1.0" encoding="ISO-8859-1" ?>

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    ...

    ...

    </xs:schema>

Tariq Aziz, Dammam Community College


Create xml schema 2

Create XML Schema[2]

<?xml version="1.0" encoding="ISO-8859-1" ?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

...

...

</xs:schema>

  • In the schema above we use the standard namespace (xs),

  • The URI associated with this namespace is the Schema language definition, which has the standard value of http://www.w3.org/2001/XMLSchema.

Tariq Aziz, Dammam Community College


Complex type

Complex Type

  • Next, we have to define the “persons" element.

  • This element contains other elements, therefore we consider it as a complex type.

  • The child elements of the “person" element is surrounded by a xs:sequence element that defines an ordered sequence of sub elements

    <xs:element name="persons">

    <xs:complexType>

    <xs:sequence>

    ... ...

    </xs:sequence>

    ...

    </xs:complexType>

    </xs:element>

Tariq Aziz, Dammam Community College


Sml schema

SML Schema

<?xml version="1.0" ?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="persons">

<xs:complexType>

<xs:sequence>

<xs:element name="person">

<xs:complexType>

<xs:sequence>

<xs:element name="title" type="xs:string" />

<xs:element name="note" type="xs:string" />

<xs:element name="quantity" type="xs:positiveInteger" />

<xs:element name="price" type="xs:decimal" />

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

Tariq Aziz, Dammam Community College


Chapter key points

Chapter Key Points

Tariq Aziz, Dammam Community College


  • Login