1 / 16

XML Verification

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. XML: Type Declaration (DTD).

yori
Download Presentation

XML Verification

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. 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 <!ELEMENT para contents of para> • just text <!ELEMENT para (#PCDATA)> <para>Here is some text. No italics allowed.</para>

  4. DTD: elements (sequences) • just a sequence of elements <!ELEMENT person (name, email, phone)> ... <person> <name>Les</name> <email>lac@ecs.soton.ac.uk</email> <phone>+44 23 8067 5145</phone> </person>

  5. DTD: elements (alternatives) • just a choice of elements <!ELEMENT person (name | email | staffno)> ... <person> <name>Les</name> </person>

  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 <!ELEMENT image EMPTY > • any content <!ELEMENT buffer ANY >

  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 <!ENTITY ms “Microsoft Corporation"> • Entities can be external files • Entities can be binary data formats <!ENTITY pic1 SYSTEM "me.gif" NDATA gif> <!NOTATION gif SYSTEM "gifviewer.exe"> <!ENTITY chap1 SYSTEM "../src/ch1.xml"> <!ENTITY disc PUBLIC "-//CC//Standard Disclaimer//EN" "/lib/stddisc.xml">

  12. DTD: using entities • Entities must be declared in a DTD <!DOCTYPE Book [ <!ENTITY chap1 SYSTEM "ch1.xml"> ]> • Entities can be used in text or attributes <book>&chap1; &chap2; &chap3;</book> <para title="This &amp; That"/> <image src="pic1" align=left/>

  13. DTD: entities for DTDs • Parameter entities provide macro expansion within a DTD • use '%' instead of '&' • prefix name by '%' in declaration <!ENTITY % common "name | address | phone"> <!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 <table> element for screen layout <table> 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.<html:table> • or<para MoD:classification=restricted>

  16. Namespaces (3) • Namespace is defined • at the document root • by the xmlns: attribute prefix <catalog xmlns:html="http://www.w3c.org/TR/REC-html40"> <html:table>… <table material=pine><price>120</price></table> <chair material=pine><price>34</price></chair> </html:table> </catalog>

More Related