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 March 12th, 2010, 08:23 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Selecting Several Paths

Hello:

I'm trying to find 2 paths in an XML file by using the | operator, the syntax for it is: //title | //price, when I put the 2 expressions together, I get different errors, below I included the 2 paths, what is the right way to build the complete predicate?


strNode = "//*[ID=""" & intCustomerID & """]"
strNode = "//*[Date=""" & DaterFilterClean.value & """]"

Set FilterNode = FilterDocXML.documentElement.selectSingleNode(strN ode)

When I use either string separatelly, it works fine!


Thanks for any help
 
Old March 13th, 2010, 03:17 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You haven't shown us the incorrect code or the error message, but I suspect you are using "|" to join two boolean expressions, for example

a="3" | b="5"

the correct operator to use here is "or". The "|" is a union operator and can only be used between two expressions that return node-sets.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old March 13th, 2010, 07:23 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML XPath - Selecting Several Paths

I found the solution myself, on selecting several paths, I was using the operator | as per XPath syntaxis, but VB6 didn't like it, so i tried with the AND operator instead, it works!


strNode = "//*[ID=""" & intCustomerID & """ and Date=""" & DaterFilterClean.value & """]"

Thanks to those who replied.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find paths in visual C#? chobo2 C# 2008 aka C# 3.0 2 September 25th, 2008 11:12 PM
Writing paths in Mysql MarkH2 MySQL 1 May 13th, 2008 08:53 AM
not all code paths return a value galua SQL Language 11 January 20th, 2008 09:36 PM
not all code paths return a value c# awaisfaisal C# 5 May 10th, 2007 08:02 AM
paths table FT BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 11:50 AM





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