Create Your First XML Document
XML Directive to create an XML document e.g. Define data data
Test XML file Validating parsers –check XML document syntax –Confirm that XML data matches predefined validation rules Document type definitions (DTDs) Schemas –Scholarly Technology Group at Brown Univ. –Textuality’s Larval –IBM’s XML Parser for Java
Test XML file Non-Validating parsers –Check XML document syntax –Do not confirm that XML data matches predefined validation rules –XML.com RUWF –James Clark’s expat
Hello, world!
Hello, world!
Create a Simple XML Processor Cascading style sheets –The easiest type and the most limited XSL style sheet –Dynamic XML data display Data island plus script –Incorporate XML data into am HTML presentation and performs some processing in addition to display Data Object Model Plus Script or Client-side Program –Create full-blown XML application
A CSS file GREETING { display: block; color: red }
Hello, world!
Create an XML Document Declaration <?xml version=“versionNumber” [encoding=“encodingValue”] [standalone=“yes | no”] ?> versionNumber – the number of the XML specification encodingValue – an optional value. XML processors assuem that XML documents are written in the UTF-8 character set. Standalone – can be set to either no or yes, depending on whether the document depends on other XML files in order to be valid or not respectively. (default is yes)
Declare Root Element Every valid XML document contains one – and only one – root element. –An element that contains all the other elements in a document –The top of the XML data hierarchy, both conceptually and syntactically …
Comment of A XML file Use Must be placed after the XML delcaration Cannot be placed inside XML tags Cannot be nested
Declare Non-root Data Elements containerElement – Name of the data element containing one or more data elements containedElement – optional, name of the data element that is contained by other data element attributeInfo – a string of attribute-value pairs that specify the attributes associated with a given data element
An example
Declare a Repeating Data Element The syntax to declare a repeating data element is the same as the required to declare non-root XML data elements
Describe Data Elements with Attributes The syntax required to declare attributes in XML elementName – the name of the element attributeName – the name of the attribute name attributeValue – the value to associate with that attribute
Describe Data Elements with Attributes
Define a Name Space
Name Space
Predifined XML Entities Problem –Need to include a left angle bracket in an element’s value
Predifined XML Entities Five predefined entities
Include Special Processing Instructions Declare a Processing Instruction spaceDelimitedInstructions – the name of any valid executable, followed by any required parameters
Include Non-standard Text