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 December 11th, 2003, 09:52 AM
Authorized User
Join Date: Jun 2003
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default namespace within namespace

HI All,

if my XML comprises:
<TalkMessage xmlns="http://www.xyz.co.uk/CM/envelope">
<Notification xmlns="http://www.talk.co.uk/gateway/notification">

If I set :

objXMLDOM.setProperty "SelectionLanguage", "XPath"
objXMLDOM.setProperty "SelectionNamespaces", "xmlns:Talk='http://www.gtalk.co.uk/CM/envelope' xmlns:Talka='http://www.talk.co.uk/gateway/enrolmentnotification'"


how do I make a reference to an element within the second namespace? and have I even declared the second correctly in the SetProperty above?


Old December 11th, 2003, 10:59 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

You've done it right by assigning a made up prefix to match the default prefix in the source xml except that your namespace URIs don't exactly match the ones in setProperty, probably a typo. To select an element do:
Dim oNode
Set oNode = objXMLDOM.selectSingleNode("/Talk:TalkMessage/Talk:Body/Talka:Notification")
If Not oNode Is Nothing Then
 'Don't process
End If
Joe (MVP - xml)
assuming xml like:
<TalkMessage xmlns="http://www.xyz.co.uk/CM/envelope">
Header stuff
<Notification xmlns="http://www.talk.co.uk/gateway/notification">
Notification data

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two namespace contain same name nir_pankaj C# 1 February 21st, 2007 12:30 PM
Namespace ~Bean~ Classic ASP Basics 2 June 3rd, 2005 02:31 PM
namespace Ibn_Aziz C# 2 December 25th, 2003 05:41 AM
Namespace flute Pro VB.NET 2002/2003 2 October 21st, 2003 09:15 AM

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