Forums Register Login

DOM leaf nodes

+Pie Number of slices to send: Send
Which of the following nodes are leaf nodes:
attr
prcessing instruction
cdata
notation
I think attr is leaf node. But the whizlab says attr is not. Because Text and entityref are att's child nodes.
Who is right.
Thx
+Pie Number of slices to send: Send
That is correct. attr Node has children.
This if a quote from the DOM Model Spec....


Document -- Element (maximum of one), ProcessingInstruction, Comment, DocumentType (maximum of one)
DocumentFragment -- Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
DocumentType -- no children
EntityReference -- Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
Element -- Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
Attr -- Text, EntityReference
ProcessingInstruction -- no children
Comment -- no children
Text -- no children
CDATASection -- no children
Entity -- Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
Notation -- no children


Based on this we see that the other three Node types don't have children.
regds.
- m
[ February 22, 2004: Message edited by: Madhav Lakkapragada ]
+Pie Number of slices to send: Send
Thank you very much.
+Pie Number of slices to send: Send
No problem, keep those questions coming....
- m
+Pie Number of slices to send: Send
Yes, I got another one.
I have a xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE doc [
<!ELEMENT doc (#PCDATA |s|T|X)* >
<!ELEMENT s (#PCDATA)>
<!ATTLIST s attr1 ID #REQUIRED >
<!ELEMENT T (#PCDATA)>
<!ATTLIST T attr2 ID #REQUIRED >
<!ELEMENT X (#PCDATA)>
<!ATTLIST X attr3 IDREF #REQUIRED >
]>
<doc>
<s attr1="A">aaa</s>
<T attr2="B">aaa</T>
<X attr3="A">aaa</X>
</doc>
There are two IDs and one IDREF. IDREF can reference both IDS. Can distinguish these two IDs? Say attr3 only references attr1, not attr2. I guess not.
Thx
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1005 times.
Similar Threads
Treasure hunt
DOM tree leaf nodes
WA #2 ..... word association
How to set Icons in the JTree
Enable/Disable editing of Tree Node
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:01:48.