Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Verification Well-formed XML document  conforms to basic XML syntax  contains only built-in character entities Validated XML document  conforms.

Similar presentations


Presentation on theme: "XML Verification Well-formed XML document  conforms to basic XML syntax  contains only built-in character entities Validated XML document  conforms."— Presentation transcript:

1 XML Verification Well-formed XML document  conforms to basic XML syntax  contains only built-in character entities Validated XML document  conforms to the grammar of a specific data type  uses any predeclared entities  specified by Document Type Declaration

2 XML: Type Declaration (DTD) A DTD specifies the grammar for a simple data structure  ordering  repeatability  labelling  vocabulary / schema / ontology DTD defined in an external entity  overridden by local definitions

3 DTD: elements (text) Element declarations just text Here is some text. No italics allowed.

4 DTD: elements (sequences) just a sequence of elements... Les lac@ecs.soton.ac.uk +44 23 8067 5145

5 DTD: elements (alternatives) just a choice of elements... Les

6 DTD: elements (repetition) element repetition can be controlled ?optional +required and repeatable *optional and repeatable element can be grouped with ( ) <!ELEMENT customer ( ((surname, initials) | custid), purchases*, visits+ )>

7 DTD: elements (mixed) mixed content (text interspersed with elements) <!ELEMENT para (#PCDATA | italic | bold | link | image)* -- optional repeatable choice group with #PCDATA as first item -- >

8 DTD: elements (misc) no content any content

9 DTD: attribute declarations Attribute declarations <!ATTLIST para security…security attribute info… author…author attribute info… id …id attribute info… > Each attribute has a type and default <!ATTLIST para security (private|public) public author CDATA #IMPLIED id ID #REQUIRED >

10 DTD: attribute types Attribute types  CDATA, NMTOKEN(S), ENTITY(-IES), ID, IDREF(S), enumeration Default values  string  token  #IMPLIED  #REQUIRED  #FIXED (must precede default)

11 DTD: declaring entities Entities can be strings Entities can be external files Entities can be binary data formats <!ENTITY disc PUBLIC "-//CC//Standard Disclaimer//EN" "/lib/stddisc.xml">

12 DTD: using entities Entities must be declared in a DTD <!DOCTYPE Book [ ]> Entities can be used in text or attributes &chap1; &chap2; &chap3;

13 DTD: entities for DTDs Parameter entities provide macro expansion within a DTD  use '%' instead of '&'  prefix name by '%' in declaration <!ELEMENT stuff ( %common; | email )

14 Namespaces Namespaces allow different designers to create different elements and attribute names for different purposes. e.g. M&S catalogue element for screen layout element for describing furniture

15 Namespaces (2) Namespace is identified with a URL Namespace is referred to by a prefix Any name from that namespace is referred to by a qualified name  prefix:name  e.g.  or

16 Namespaces (3) Namespace is defined  at the document root  by the xmlns: attribute prefix … 120 34


Download ppt "XML Verification Well-formed XML document  conforms to basic XML syntax  contains only built-in character entities Validated XML document  conforms."

Similar presentations


Ads by Google