O'Reilly logo

XML Parsing with PHP by John M. Stokes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advanced XMLReader and XMLWriter

Namespaces in XMLReader

XMLReader does include support for namespaces. Similar to DOM, XMLReader provides separate methods to handle namespaces, which are named after the simpler, non-namespace accepting methods with “Ns” tacked on the end. Perhaps surprisingly, there aren’t many of them. Many methods, like next() and readOuterXML(), don’t care whether you’re working with namespaces or not. They operate on whichever node the cursor is pointing to, regardless of the presence or absence of a namespace identifier.

Because XMLReader’s cursor doesn’t care whether the node it’s pointing to has a namespace or not, almost all the methods that operate on namespaces are related to attributes. The one exception, and probably ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required