Retrieving Information from the DOM

In earlier examples in this chapter, you created elements and set values for attributes belonging to newly created elements. You can also access information already contained in the DOM and use it for additional purposes.

The DocumentType Interface’s Properties

If you want to retrieve the information contained in the DOCTYPE declaration, you can access and process the properties of the DocumentType object. Listing 17.3 shows an example.

Listing 17.3. DoctypeProps.svg: Retrieving and Displaying the DocumentType Object’s Properties
 <?xml version='1.0'?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ""> <svg:svg xmlns:svg="" ...

Get Sams Teach Yourself XML in 10 Minutes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.