1 / 15

DOM & XML

Document Object Model & eXtensible Markup Language. DOM & XML. Reference : http://www.w3schools.com/Xml/xml_syntax.asp. Document Object Model (DOM). DOM concept: NODE <element></element> An empty node: <element />. XML DOM. node relations : Parent Child Sibling. parent.

Download Presentation

DOM & XML

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. Document Object Model & eXtensible Markup Language DOM & XML Reference : http://www.w3schools.com/Xml/xml_syntax.asp

  2. Document Object Model (DOM) DOM concept: NODE <element></element> An empty node: <element />

  3. XML DOM node relations : Parent Child Sibling parent element node A element node B element node C element node D sibling child

  4. root node element node attribute node #text node XML DOM The NODE object Node types: • Element • Attribute • Text

  5. XML DOM Example <class> <name>2X2</name> <pupil sno="1"> <name>Alan Ang</name> </pupil> <pupil> <name>Brenda Blu</name> </pupil> </class> Element nodes Text node Attribute node

  6. XML DOM Example <class> <name>2X2</name> <pupilsno="1"> <name>Alan Ang</name> </pupil> <pupil> <name>Brenda Blu</name> </pupil> </class> Element nodes Text node Attribute node

  7. XML DOM Example <class> <name>2X2</name> <pupil sno="1"> <name>Alan Ang</name> </pupil> <pupil> <name>Brenda Blu</name> </pupil> </class> Element nodes Text node Attribute node

  8. XML DOM <class> <name>2X2</name> <pupil sno="1"> <name>Alan Ang</name> </pupil> <pupil> <name>Brenda Blu</name> </pupil> </class> Example Element nodes Text node Attribute node

  9. #text “Alan Ang” attributesno= “1” element “pupil” element “name” Node diagram <pupil sno=“1”> <name>Alan Ang</name> </pupil>

  10. XML DOM Assignment 1 (2pts) Write the XML source code for the follow node diagram. Element node Attribute node Text node

  11. XML DOM Assignment 2 (2 pts) Draw the node diagram to illustrate the relationship between all the nodes. Distinguish between element/attribute/text nodes. <class> <name>2X2</name> <pupil sno=“1”> <name>Alan Ang</name> </pupil> <pupil> <name>Betty Blu</name> </pupil> </class>

  12. XML Parts of an XML document • Prolog • Root Element • XML declaration • DTD declaration • Stylesheet declaration • Elements (Nested Elements)

  13. XML Parts of an XML document • Prolog <?xml version="1" ?> <?xml-stylesheet href ="xd.xsl" ?> <!DOCTYPE classes SYSTEM cls.dtd>

  14. XML Parts of an XML document • Elements • Nested child elements • Element Attribute • Data <books> <book id="1" > <author>King James</author> <title>Holy Holly</title> </book> </root>

  15. http://www.youtube.com/v/pKKTjSeiCMw?fs=1&amp;hl=en_US

More Related