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

XML Schema Validation Problem

  • To: "XML-DEV (E-mail)" <xml-dev@l...>
  • Subject: XML Schema Validation Problem
  • From: Jason Brown <Jason@i...>
  • Date: Thu, 9 Jan 2003 10:46:42 -0000

vb6 xml schema validation
Title: XML Schema Validation Problem

Hi everybody,

Firstly, I'm new to the list so a quick intro, I program in VB6 SP5 MSXML4 at work OS is Windows 2K Professional.  My experience is fairly short with XML (approx 6-8 months), currently I am building XML-Schemas for data exchange between two progams.  I have used XSLT in the past but it is not required for this project.

I am having a problem with namespaces at the moment and wondered if anyone could help.  Obviously if this is the wrong forum for this question please let me know ;-)

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. (Sample XML1)

***************
Sample XML1
***************
<?xml version="1.0" encoding="UTF-8"?>
<Environment xmlns="xyz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="xyz simple_env.xsd">

</Environment>

*********************************
Sample Schema
Used with all 3 XML samples
*********************************

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                                targetNamespace="xyz"
                                xmlns="xyz"
                                elementFormDefault="unqualified" attributeFormDefault="unqualified">
        <xs:element name="Environment">
        </xs:element>
</xs:schema>



If I remove the Namespaces and just use a basic structure (Sample XML2), the xml still parses and I get a return value from SelectSingleNode.  The only problem being that the schema is not then enforced and I can invent any tags I like in the xml without a parse error (Sample XML3).

****************
Sample XML2
****************

<?xml version="1.0" encoding="UTF-8"?>
<Environment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="xyz simple_env.xsd">

</Environment>

****************
Sample XML3
****************
<?xml version="1.0" encoding="UTF-8"?>
<Environment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="xyz simple_env.xsd">
        <fred/>
</Environment>


Incidentally I have tried using the Microsoft example from the MSDN and this has the same problem.

Thanks in advance

Jason

Jason Brown
I2 Limited
The Visual Space
Capital Park
Fubourn
Cambridge
CB1 5XH

Tel: (01223) 728 670
Fax: (01223) 728 601 
Mobile: 07952 246 375


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.