[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML Schema Validation Problem

  • To: 'Jeni Tennison' <jeni@j...>
  • Subject: RE: XML Schema Validation Problem
  • From: Jason Brown <Jason@i...>
  • Date: Thu, 9 Jan 2003 11:26:10 -0000
  • Cc: "XML-DEV (E-mail)" <xml-dev@l...>

selectsinglenode namespace
Title: RE: XML Schema Validation Problem

Hi Jeni,

Thank you very much, That is now working fine.  I had the XPath property set but didn't know about the namespaces property. 

Best regards


-----Original Message-----
From: Jeni Tennison [mailto:jeni@j...]
Sent: 09 January 2003 11:06
To: Jason Brown
Cc: XML-DEV (E-mail)
Subject: Re: XML Schema Validation Problem

Hi Jason,

> I have a Schema that has 2 namespaces. This is referenced by an XML
> document. I can successfully parse the XML against the schema,
> however I cannot then assign any data to an Object using the
> SelectSingleNode method of a FreeThreadedDOMDocument40. According to
> the object browser this should return an IXMLDOMNode, the result I
> get is the object is still nothing.

You don't show the code that you're using, but my guess would be that
when you use selectSingleNode(), you're not including a namespace
prefix on the element name. Try using the following code:

  // Use XPath rather than XSL Patterns to select your nodes
  yourDOM.setProperty("SelectionLanguage", "XPath");

  // Declare the namespace you want to use with a prefix
  yourDOM.setProperty("SelectionNamespaces", "xmlns:xyz='xyz'");
  // Use the prefix when you refer to the element you want to select
  node = yourDOM.selectSingleNode("/xyz:Environment");

When you use XPath, if you specify an element name without a prefix as
in "/Environment" then you will only select elements with that local
name in *no namespace*. If you want to select elements that are in a
namespace (as your <Environment> element is) then you need to declare
that namespace with a prefix and use that prefix to refer to the



Jeni Tennison


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.