schema languages

Post on 12-May-2015

689 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Schema languages

TRANSCRIPT

<?xml version=„1.0‟ encoding=“UTF-8”?>

<!-- Human Resource data-->

<HumanResource>

<!-- Information for a person-->

<Person id=„1‟ slary=“500”>

<FirstName>John</FirstName>

<MidName></MidName>

<LastName>Doe</LastName>

<Position>Manager</Position>

</Person>

</HumanResource>

Document Type

<?xml version=”1.0”?>

<name>

<first>

John

</first>

<middle>

Johansen

</middle>

<last>

Doe

</last>

</name>

<!ELEMENT name (first, middle, last)>

<!ELEMENT first (#PCDATA)>

<!ELEMENT middle (#PCDATA)>

<!ELEMENT last (#PCDATA)>

<?xml version=”1.0”?>

<!DOCTYPE name [

<!ELEMENT name (first, middle, last)>

<!ELEMENT first (#PCDATA)>

<!ELEMENT middle (#PCDATA)>

<!ELEMENT last (#PCDATA)>

]>

<name>

<first>John</first>

<middle>Johansen</middle>

<last>Doe</last>

</name>

<?xml version=”1.0”?>

<!DOCTYPE name SYSTEM “name.dtd”[

]>

<name>

<first>John</first>

<middle>Johansen</middle>

<last>Doe</last>

</name>

<!ELEMENT name (first, middle, last)>

<!ELEMENT contact (name, (address|GPS), phone, knows, description)>

<!ELEMENT description (#PCDATA | em | strong | br)*>

<!ELEMENT br EMPTY>

<!ELEMENT description ANY>

Indicator Description

[none] when no cardinality indicator is used, it indicates that the element must

appear once and only once. This is the default behavior for elements used

in content models.

? Indicates that the element may appear either once or not at all

+ Indicates that the element may appear one or more times

* Indicates that the element may appear zero or more times

<!ELEMENT name (first+, middle?, last)>

<!ATTLIST contacts source CDATA #IMPLIED>

Type Description

CDATA Indicates that the attribute value is character data. Notice that this is slightly different from

the PCDATA keyword in ELEMENT declarations.

ID Indicates that the attribute value uniquely identifies the containing element

IDREF Indicates that the attribute value is a reference, by ID, to a uniquely identifiable element

IDREFS Indicates that the attribute value is a whitespace-separated list of IDREF values

ENTITY Indicates that the attribute value is a reference to an external unparsed entity

ENTITIES Indicates that the attribute value is a whitespace-separated list of ENTITY values

NMTOKEN Indicates that the attribute value is a name token.

NMTOKENS Indicates that the attribute value is a whitespace-separated list of NMTOKEN values

Enumerated List Apart from using the default types, you can also declare an enumerated list of possible

values for the attribute.

&#169;

&#x00A9;

<!ENTITY empty-gps “<latitude></latitude><longitude></longitude>”>

<!ENTITY jeff-description SYSTEM “jeff.txt”>

<!ENTITY % DefaultPhoneKind “Home”>

<!ENTITY % NameDeclarations SYSTEM “name4.dtd”>

top related