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">
<Header>
........
</Header>
<Body>
<Notification xmlns="http://www.talk.co.uk/gateway/notification">
..............
</TalkMessage>

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'"


where objXMLDOM is a DOMDOCUMENT

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?


thanks

 
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
Default

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:
Code:
Dim oNode
Set oNode = objXMLDOM.selectSingleNode("/Talk:TalkMessage/Talk:Body/Talka:Notification")
If Not oNode Is Nothing Then
 'Process
Else
 'Don't process
End If
Joe (MVP - xml)
assuming xml like:
Code:
<TalkMessage xmlns="http://www.xyz.co.uk/CM/envelope">
<Header>
Header stuff
</Header>
<Body>
<Notification xmlns="http://www.talk.co.uk/gateway/notification">
Notification data
</Notification>
</Body>
</TalkMessage>





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.