Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old January 31st, 2005, 02:53 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Namespaces

Hi,

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?

Thanks!

  #2 (permalink)  
Old January 31st, 2005, 03:41 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use the namespace axis:

namespace::*

returns all the in-scope namespaces.



Michael Kay
http://www.saxonica.com/
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.