15. Foundations for XML XML-based Markup Languages eXtensible Markup Language XML Unicode Uniform Resource Identifier(URI)
16. XML Document <?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>
17. XML Document <?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> Tags: start-tags and end-tags Tag: the text starting with a < character and ending with a > character.
18. XML Document <?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> Tags: start-tags and end-tags Element All the information from the beginning of a start-tag to the end of an end-tag and including everything in between.
19. XML Document <?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> Tags: start-tags and end-tags Element Element content Is the text between the start-tag and end-tag of the element. Parsed character data(PCDATA)
25. XML Document <?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> Tags: start-tags and end-tags Element Element content Attributes XML declaration Comment
26. XML Document <?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> Tags: start-tags and end-tags Element Element content Attributes XML declaration Comment Instruction
34. Names can not start with the leter xml, in uppercase, lowercase, or mixed.Well-Formed XML Document Element names must obey XML naming conventions <?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> XML is case sensitive <Person id=‘1’ slary=“500”> <FirstName>John<MidName></FirstName></MidName> <LastName>Doe</LastName> </Person> Every start-tag mus have a matching end-tag, or be a self-closing tag Tags can’t overlap; elements must be properly nested XML documents can have only one root element XML will keep white space in PCDATA
35. Well-Formed XML Document There are some reserved characters that you can’t include in your PCDATA because they are used in XML syntax: <, > and & characters. <comparison> 6 is <7 & 7>6</comparison> <blah>Some <text in an element</blah> 1. Using escaping characters : <comparison> 6 is < 7 & 7 > 6</comparison> <blah>Some < text in an element</blah> 2. Using CDATA sections: <comparison>[CDATA[ 6 is < 7 & 7 > 6]]</comparison> <blah>[CDATA[Some <text in an element]]</blah>
36. Summary 1. Essential XML: is a markup language 2. Extensible: customer tags => You can define new markup languages 3. You known what well-formed XML document is and how to create it You had well in hand XML technology!