Fall 2006 - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Fall 2006

Description:

Firefox produces an error document. Not the error object of IE ... XSLT in Firefox. First load XML and XSL into DOM objects. Create XSLTProcessor ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 18
Provided by: mba4
Category:
Tags: fall | firefox

less

Transcript and Presenter's Notes

Title: Fall 2006


1
Florida Atlantic UniversityDepartment of
Computer Science Engineering
COP 4814 Web Services Dr. Roy Levow Part 4 - XML
Fall 2006
2
XML, XPath, XSLT
  • XML support generally limited to IE and Firefox
  • XML in IE
  • Microsoft.XmlDom in IE4.0
  • MSXML ActiveX in IE 5.0
  • But only on Windows not on MAC
  • Text uses createDocument() for cross-IE
    compatability
  • XML DOM object created from string

3
XML DOM Navigation
  • DOM object properties
  • childNodes, firstChild, lastChild,
  • parentNode, nextSibling, previousSibling,
  • nodeName, nodeType, nodeValue
  • text, attributes
  • xml
  • ownerDocument root node
  • Navigate tree with these functions

4
IE XML DOM Navigation Examples
  • Examples IE DOM
  • DOM creation
  • Get Elements by Tag Name
  • Create Node
  • Insert Node
  • Remove Child
  • Replace Child

5
IE XML DOM Error Handling
  • Creates and propagates exception object
    parseError
  • parseError object provides details
  • errorCode, reason
  • filePos, line, linePos
  • srcText
  • url

6
XML DOM in Firefox
  • Uses createDocument() method to generate DOM
    object
  • Empty
  • From string
  • From url
  • load() method loads from a url
  • String version of XML subtree is produced by
    XMLSerializer object

7
XML DOM in Firefox - 2
  • Error handling
  • Firefox produces an error document
  • Not the error object of IE
  • It can be parsed to get the same information

8
Firefox XML DOM - 3
  • Examples Firefox DOM
  • DOM Dreation
  • DOM Parser
  • Get text
  • Serialize
  • Error handling

9
Cross-Browser XML
  • Requires library to create standard calls for
    operations
  • Text provides zXml library
  • zXmlDom.createDocument()
  • Examples Cross-Browser DOM
  • Processing Book List

10
XML Namespaces
  • XML uses namespace concept to resolve naming
    conflicts between documents from different
    sources
  • Tag name has form nstagName
  • Declared as xmlsnns-prefixnsURI
  • URI has same syntax as URL but need not be real
    address
  • Should be unique
  • Declarations in root tag of document

11
XPath
  • XPath expressions
  • Context node is partial path from which selection
    begins
  • book/author this parent-child sequence
  • Selection pattern specifies which nodes to
    include
  • book_at_isbn0010001001
  • Expressions have own syntax and can be quite
    complex

12
XPath in IE and Firefox
  • IE uses two functions
  • selectSingleNode()
  • selectNodes()
  • Examples IE XPath
  • Firefox uses two objects
  • XPathEvaluator
  • XPathResult
  • Examples Firefox XPath

13
Cross-Browser XPath
  • Use zXml library
  • Same functions as IE
  • Examples Cross-Browser XPath

14
XSL Transformations
  • Transformation is done with
  • xslstylesheet with XML specific elements
  • xsltemplate to select XMLnodes to process
  • xslvariable to select attributes from nodes
  • Examples XSLT

15
XSLT in IE
  • Browser becomes an issue when DOM is used in
    conjunction with XSLT
  • Must create ActiveX XSLTemplate object
  • Create processor object from template object
  • transform() method does transformation
  • Result is output property of processor
  • Examples XSLT in IE

16
Cross-Browser XSLT
  • Requires library
  • Text provides this in zXml
  • Syntax similar to Firefox
  • Example Best Picks Revisited

17
XSLT in Firefox
  • First load XML and XSL into DOM objects
  • Create XSLTProcessor
  • Import XSL stylesheet
  • Transform XmlDOM document or fragment
  • Examples XSL in Firefox
Write a Comment
User Comments (0)
About PowerShow.com