Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 31st, 2005, 02:53 PM
Authorized User
Join Date: Jun 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Namespaces


I want to retrieve all the namespaces associated with a specific node. For example, consider the following node:

<animal xmlns='www.animals.com' xmlns:dogs='www.animals.com/dogs' xmlns:cats='www.animals.com/cats'>

Using XPathDocument I load the xml file, create a navigator, and use the Namespace property to get the associated namespace (www.animals.com) for this node. I would like to retrieve all the namespaces and not just the default namespace (i.e. 'www.animals.com', 'www.animals.com/dogs', and ''www.animals.com/cats').

How can I do this?


Old January 31st, 2005, 03:41 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Use the namespace axis:


returns all the in-scope namespaces.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Similar Threads
Thread Thread Starter Forum Replies Last Post
cant reach data in xml with namespaces TPP XSLT 3 March 25th, 2006 04:40 PM
cant reach data in xml with namespaces TPP XSLT 1 March 24th, 2006 11:47 AM
Confused about XML namespaces planoie XSLT 2 June 2nd, 2005 04:23 AM
.NET and XML Namespaces - NamespaceManager billy_bob_the_3rd XML 1 December 15th, 2004 08:51 AM
Accessing XML Node with multiple namespaces bamirzada C# 0 August 14th, 2003 07:41 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.