Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Few Questions about org.w3c.dom.Element [Thread Next] Re: Few Questions about org.w3c.dom.ElementTo: NULL Date: 4/10/2008 9:31:00 PM
"RC" <raymond.chui@n...> wrote in message
news:ftm02s$ln2$1@n......
> In that org.w3c.dom.Element interface
>
> I can getTagName()
> But
> 1) How do I do know is it an empty tag or not?
>
> <tag ..... />
>
> 2) How do I know when will be a close tag?
>
> <tag1>
> <tag2>xxxx</tag2>
> <tag3 ..... />
> <tag4 ..... />xxxxx</tag4>
> ......
> </tag1>
>
> Thank Q very much in advance!
org.w3c.dom.Element doesn't represent the start tag; it represents the
entire element. Anything occuring between the start and end tag will beomce
children of that element. E.g.
<start>This is <i>italicized</i>text.</start>
resluts in five Nodes:
1. An Element with the tag name "start"
2. A Text with the node value "This is "
3. An Element with tag name "i"
4. A Text with the node value "italicized"
5. A Text with the node value "text."
2, 3, and 5 are (in that order) the child node of 1. 4 is the child of 3.
And in DOM, there's no way to distinugish between, say,
<start></start>
and
<start/>
In both case, you see an Element wth no children.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
