Tutorial.10

Tutorial.10 - TUTORIAL 10 XP WORKING WITH THE DOCUMENT...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
New Perspectives on XML, 2 nd Edition Tutorial 10 1 XP WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2 nd Edition Tutorial 10 2 XP THE W3C DOM To modify an XML or XSLT document, you need to be able to access the document and its contents. This is done through a Document Object Model or DOM , which is a systematic framework for working with the content and structure of a document.
Background image of page 2
New Perspectives on XML, 2 nd Edition Tutorial 10 3 XP DOM LEVELS
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2 nd Edition Tutorial 10 4 XP CREATING A CROSS-BROWSER SOLUTION Because there are some fundamental differences between Internet Explorer and the Mozilla-based browsers in implementing the Document Object Model, any program code that you write has to first determine which browser is in use. Object-detection var IE = window.ActiveXObject ? true:false; var MOZ = document.implementation.createDocument ? true:false;
Background image of page 4
New Perspectives on XML, 2 nd Edition Tutorial 10 5 XP CREATING A CROSS-BROWSER SOLUTION if (IE) { Internet Explorer code } else if (MOZ) { Mozilla code }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2 nd Edition Tutorial 10 6 XP CREATING A DOCUMENT OBJECT IN INTERNET EXPLORER A document object is an object that can store the contents and structure of a document. docObj = new ActiveXObject( PID ); Where docObj is the variable name of the document object and PID is the program ID that indicates the type of document object to be created.
Background image of page 6
New Perspectives on XML, 2 nd Edition Tutorial 10 7 XP CREATING A DOCUMENT OBJECT IN MOZILLA docObj = document.implementation.createDocument( uri , ro ot , doctype ); Where uri is the URI of the document’s namespace, root is the qualified name of the document’s root element, and doctype is the type of document to create
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2 nd Edition Tutorial 10 8 XP LOADING A FILE INTO A DOCUMENT OBJECT An asynchronous load does not require the application loading the file to wait for it to finish loading before proceeding through the lines in the program code A synchronous load causes the application to stop until the file is completely loaded. docObj .async=false; Where docObj is the document object into which you want to load the file
Background image of page 8
New Perspectives on XML, 2 nd Edition Tutorial 10 9 XP LOADING A STYLE SHEET OBJECT Because XSLT style sheets are also XML documents, you need to create a document object using ActiveX Rental-threaded model Free-threaded model var FreeThreadPID = ["Msxml2.FreeThreadedDOMDocument.5.0", "Msxml2.FreeThreadedDOMDocument.4.0", "Msxml2.FreeThreadedDOMDocument.3.0"];
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/26/2010 for the course CS 178 taught by Professor Mandyam during the Spring '10 term at Ohlone.

Page1 / 48

Tutorial.10 - TUTORIAL 10 XP WORKING WITH THE DOCUMENT...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online