• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 22. XML and XSLT > Accessing XML Elements by Name

Accessing XML Elements by Name

We’ve used properties such as nextSibling and nextChild to navigate through XML documents. However, you also can get individual elements by searching for them by name using methods such as getElementsByTagName.

Here’s an example. In this case, I’ll do the same thing that we did using properties such as nextSibling and nextChild—find the third person’s name in Listing 22-01.xml. I’ll start by getting a document object for that XML document:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint