1 / 36

Create Your First XML Document

Create Your First XML Document. XML. Directive to create an XML document <?xml version=“ version ”?> e.g. <?xml version=“1.0”?> Define data <TAG> data </TAG>. Test XML file. Validating parsers check XML document syntax Confirm that XML data matches predefined validation rules

moe
Download Presentation

Create Your First XML Document

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. Create Your First XML Document

  2. XML • Directive to create an XML document <?xml version=“version”?> e.g. <?xml version=“1.0”?> • Define data <TAG> data </TAG>

  3. 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. www.stg.brown.edu/service/xmlvalid • Textuality’s Larval www.textuality.com/Lark/. • IBM’s XML Parser for Java www.alphaworks.ibm.com/tech/xml4j

  4. Test XML file • Non-Validating parsers • Check XML document syntax • Do not confirm that XML data matches predefined validation rules • XML.com RUWF www.xml.com/pub/tools/ruwf/check.html • James Clark’s expat www.jclark.com/xml/expat.html

  5. <?xml version="1.0" ?> • <GREETING> Hello, world! </GREETING>

  6. <?xml version="1.0"?> • <GREETING>Hello, world!</GREETIN>

  7. 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

  8. A CSS file GREETING { display: block; color: red }

  9. <?xml version="1.0"?> • <?xml-stylesheet type="text/css" href="task5.css" ?> • <GREETING>Hello, world!</GREETING>

  10. 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)

  11. 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 <rootElelmentName> … </rootElelmentName>

  12. Comment of A XML file • Use <!– Comment –> • Must be placed after the XML delcaration • Cannot be placed inside XML tags • Cannot be nested

  13. 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

  14. An example

  15. 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

  16. 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

  17. Describe Data Elements with Attributes

  18. Define a Name Space

  19. Name Space

  20. Predifined XML Entities • Problem • Need to include a left angle bracket in an element’s value

  21. Predifined XML Entities • Five predefined entities

  22. Include Special Processing Instructions • Declare a Processing Instruction • spaceDelimitedInstructions – the name of any valid executable, followed by any required parameters

  23. Include Non-standard Text

More Related