OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] XML Schema Validation Problem

[ Lists Home | Date Index | Thread Index ]

Title: RE: [xml-dev] 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

Jason

-----Original Message-----
From: Jeni Tennison [mailto:jeni@jenitennison.com]
Sent: 09 January 2003 11:06
To: Jason Brown
Cc: XML-DEV (E-mail)
Subject: Re: [xml-dev] 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
element.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS