Illustration of Different Node Trees for XML (W3C(XT)/IE5)
Chris Lovett
clovett at microsoft.com
Fri Apr 9 21:12:16 BST 1999
(1) IE5 gives you the option on text nodes between elements. These are
called "ignorableWhiteSpace" and we have a switch on the IXMLDOMDocument for
this.
(2) IE5 gives you all PI's. I don't see why the <?xml delcaration is not a
valid PI for representation in your DOM. What if you want to change the
encoding and save the document back out ?
(3) Again, namespace attribute are attributes. What if you want to promote
a namespace declaration to a higher level in the tree ?
(4) Well this all points out the fact that the DOM group refused to consider
namespaces in level 1. IE5 gives you the namespace info as separate
properties called "namespaceURI" and "prefix" rather than inventing a new
node name format. This way someone can add a namespace to a document
without breaking an app that is already written to the nodeName as a simple
GI. This give a better migration story.
-----Original Message-----
From: G. Ken Holman [mailto:gkholman at CraneSoftwrights.com]
Sent: Friday, April 09, 1999 11:10 AM
To: XML-Dev Mailing list
Subject: Illustration of Different Node Trees for XML (W3C(XT)/IE5)
I was asked to produce an IE5 version of my SHOWTREE free resource and I
found
the results were interesting. These reveal that alternate strategies are
required with different products when accessing components of an XML
document
because the node structure interpreted by engines differ.
Versions of SHOWTREE for both W3C(XT) and IE5 are available through the
Resource Library link on our home page in my trailer below.
The stylesheets produce a text file from XT and an HTML file from IE5 ...
one
can use the IE5 engine either directly viewing a file using an embedded
stylesheet processing instruction, or use the DOS command line if you want
to
examine a file without changing it to include the PI (the command line
invocation is another free resource in the library).
I noted the following right away:
(1) XT instantiates text nodes for new lines between elements where IE5
doesn't
(2) XT regards the XML declaration as not being part of the content while
IE5
does
(3) IE5 exposes the namespace declaration attributes as attributes while XT
doesn't
(4) XT composes node names using the namespace URI while IE5 doesn't
I haven't looked closely for other differences given some personal time
constraints.
I hope this is considered useful.
........... Ken
T:\FTEMP>type short.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="showtree.msxsl"?>
<?pi1 value of pi1?>
<!--comment number 1-->
<greeting
pub-id="+//ISBN 1-894049::CSL::Samples::SHOWTREE//Document SHOWTREE
Test//EN"
attr2="Value of second attribute">
<purpose>To convey a greeting</purpose>
<test1>A test<test2>of depth<test3>to three levels</test3></test2></test1>
<!--comment number 2-->
<prelude id="start"
xmlns:info="<http://www.cranesoftwrights.com/resources/>http://www.CraneSoft
wrights.com/resources/">
<?pi2 value of pi2?>
<info:detail>Information about Greeting</info:detail>
</prelude>
<value>Hello world!</value>
</greeting>
T:\FTEMP>call xsl short.xml showtree.xsl short.w3c
T:\FTEMP>call msxsl short.xml showtree.msxsl short.ms
T:\FTEMP>type short.w3c
SHOWTREE Stylesheet -
<http://www.cranesoftwrights.com/>http://www.CraneSoftwrights.com/resources/
Root:
1 Proc. Inst. 'xml-stylesheet' (): {type="text/xsl" href="showtree.msxsl"}
2 Proc. Inst. 'pi1' (): {value of pi1}
3 Comment (): {comment number 1}
4 Element 'greeting' ():
4.1 Attribute 'pub-id' (greeting): {+//ISBN
1-894049::CSL::Samples::SHOWTREE//Document SHOWTREE Test//EN}
4.2 Attribute 'attr2' (greeting): {Value of second attribute}
4.3 Text (greeting): {
}
4.4 Element 'purpose' (greeting):
4.4.1 Text (greeting,purpose): {To convey a greeting}
4.5 Text (greeting): {
}
4.6 Element 'test1' (greeting):
4.6.1 Text (greeting,test1): {A test}
4.6.2 Element 'test2' (greeting,test1):
4.6.2.1 Text (greeting,test1,test2): {of depth}
4.6.2.2 Element 'test3' (greeting,test1,test2):
4.6.2.2.1 Text (greeting,test1,test2,test3): {to three levels}
4.7 Text (greeting): {
}
4.8 Comment (greeting): {comment number 2}
4.9 Text (greeting): {
}
4.10 Element 'prelude' (greeting):
4.10.1 Attribute 'id' (greeting,prelude): {start}
4.10.2 Text (greeting,prelude): {
}
4.10.3 Proc. Inst. 'pi2' (greeting,prelude): {value of pi2}
4.10.4 Text (greeting,prelude): {
}
4.10.5 Element
'<http://www.cranesoftwrights.com/resources/#info:detail>http://www.CraneSof
twrights.com/resources/#info:detail' (greeting,prelude):
4.10.5.1 Text
(greeting,prelude,<http://www.cranesoftwrights.com/resources/#info:detail>h
ttp://www.CraneSoftwrights.com/resources/#info:detail): {Information about
Greeting}
4.10.6 Text (greeting,prelude): {
}
4.11 Text (greeting): {
}
4.12 Element 'value' (greeting):
4.12.1 Text (greeting,value): {Hello world!}
4.13 Text (greeting): {
}
T:\FTEMP>rem copy/paste from IE5 canvas to short.ms.txt
T:\FTEMP>type short.ms.txt
SHOWTREE Stylesheet
<file://T:\FTEMP\short.xml>file:///T:/FTEMP/short.xml
<http://www.cranesoftwrights.com/resources>http://www.CraneSoftwrights.com/
resources
Root:
1 Proc. Inst. 'xml' (): {version="1.0"}
2 Proc. Inst. 'xml-stylesheet' (): {type="text/xsl" href="showtree.msxsl"}
3 Proc. Inst. 'pi1' (): {value of pi1}
4 Comment (): {comment number 1}
5 Element 'greeting' ():
5.1 Attribute 'pub-id' (greeting): {+//ISBN
1-894049::CSL::Samples::SHOWTREE//Document SHOWTREE Test//EN}
5.2 Attribute 'attr2' (greeting): {Value of second attribute}
5.3 Element 'purpose' (greeting):
5.3.1 Text (greeting,purpose): {To convey a greeting}
5.4 Element 'test1' (greeting):
5.4.1 Text (greeting,test1): {A test}
5.4.2 Element 'test2' (greeting,test1):
5.4.2.1 Text (greeting,test1,test2): {of depth}
5.4.2.2 Element 'test3' (greeting,test1,test2):
5.4.2.2.1 Text (greeting,test1,test2,test3): {to three levels}
5.5 Comment (greeting): {comment number 2}
5.6 Element 'prelude' (greeting):
5.6.1 Attribute 'id' (greeting,prelude): {start}
5.6.2 Attribute 'xmlns:info' (greeting,prelude):
{<http://www.cranesoftwrights.com/resources/%7D>http://www.CraneSoftwrights
.com/resources/}
5.6.3 Proc. Inst. 'pi2' (greeting,prelude): {value of pi2}
5.6.4 Element 'info:detail' (greeting,prelude):
5.6.4.1 Text (greeting,prelude,info:detail): {Information about Greeting}
5.7 Element 'value' (greeting):
5.7.1 Text (greeting,value): {Hello world!}
T:\FTEMP>type short.ms
SHOWTREE Stylesheet
<file://T:\FTEMP\short.xml>file:///T:/FTEMP/short.xml
<http://www.CraneSoftwrights.com/resources/>http://www.CraneSoftwrights.com
/resources/
Root:
1 Proc. Inst. 'xml' (): {version="1.0"}
2 Proc. Inst. 'xml-stylesheet' (): {type="text/xsl" href="showtree.msxsl"}
3 Proc. Inst. 'pi1' (): {value of pi1}
4 Comment (): {comment number 1}
5 Element 'greeting' ():
5.1 Attribute 'pub-id' (greeting): {+//ISBN
1-894049::CSL::Samples::SHOWTREE//Document SHOWTREE Test//EN}
5.2 Attribute 'attr2' (greeting): {Value of second attribute}
5.3 Element 'purpose' (greeting):
5.3.1 Text (greeting,purpose): {To convey a greeting}
5.4 Element 'test1' (greeting):
5.4.1 Text (greeting,test1): {A test}
5.4.2 Element 'test2' (greeting,test1):
5.4.2.1 Text (greeting,test1,test2): {of depth}
5.4.2.2 Element 'test3' (greeting,test1,test2):
5.4.2.2.1 Text (greeting,test1,test2,test3): {to three levels}
5.5 Comment (greeting): {comment number 2}
5.6 Element 'prelude' (greeting):
5.6.1 Attribute 'id' (greeting,prelude): {start}
5.6.2 Attribute 'xmlns:info' (greeting,prelude):
{<http://www.cranesoftwrights.com/resources/>http://www.CraneSoftwrights.co
m/resources/}
5.6.3 Proc. Inst. 'pi2' (greeting,prelude): {value of pi2}
5.6.4 Element 'info:detail' (greeting,prelude):
5.6.4.1 Text (greeting,prelude,info:detail): {Information about Greeting}
5.7 Element 'value' (greeting):
5.7.1 Text (greeting,value): {Hello world!}
T:\FTEMP>
--
G. Ken Holman mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services outline, XSL/DSSSL shareware,
stylesheet resource library, conference training schedule,
commercial stylesheet training materials, on-line XSL CBT.
Next instructor-led XSL Training: WWW8:1999-05-11
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN
981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list