W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

Re: problems validating xml with msxml parser

From: McDonald, Tom [EESUS, Non J&J] <TMcDona@EESUS.JNJ.com>
Date: Tue, 22 Jan 2002 12:00:30 -0500 (EST)
Message-ID: <B62C798CD6ECD511BE8300805F85AE9844FC05@eesusciexs4.eesus.jnj.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
I thought you might be interested in actually seeing the code that I am
trying to debug.  

Here is the schema and the code is below.  Note that I am using ASP code.


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="plyrid" type="xs:short"/>
	<xs:element name="projectedScore" type="xs:decimal"/>
	<xs:element name="projection">
				<xs:element ref="plyrid"/>
				<xs:element ref="projectedScore"/>
	<xs:element name="projectionInfo">
				<xs:element ref="projection"
	<xs:element name="user_number" type="xs:short"/>
	<xs:element name="editplayer">
				<xs:element ref="user_number"/>
				<xs:element ref="projectionInfo"/>



	set xmlDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
	sSchema = "editplayer.xsd"
	sSchemaDef = ""
	sSchemaPath = "http://localhost/tomandlis/stage1/schema/"
	sSchemaLoc = sSchemaPath & sSchema

	Dim xmlDoc1
	Set xmlDoc1 = Server.CreateObject("MSXML2.DOMDocument.4.0")
	xmlDoc1.async = false
	xmlDoc1.setProperty "ServerHTTPRequest", true         
	if not xmlDoc1.load(sSchemaLoc) then
		response.write xmlDoc1.parseError.reason + " Error Element="
+ xmlDoc1.parseError.srcText
		Set xmlDoc1 = Nothing
	end if
	Set xSchemaCache = server.createobject("MSXML2.XMLSchemaCache.4.0")
	xSchemaCache.Add sSchemaDef, xmlDoc1
	' add the schemas to the domdocument
	Set xmlDoc.schemas = xSchemaCache 

	'generate a sample xml doc for testing
	sxml =
	xmlDoc.async = False
	xmlDoc.validateOnParse = False
	'Get the xml doc instance location/name
	'If load fails raise an error
	If Not xmlDoc.loadXML(sxml) Then
		response.write xmlDoc.parseError.reason + " Error Element="
+ xmlDoc.parseError.srcText
		Set xmlDoc = Nothing
		Set xSchemaCache = Nothing
		boo = xmlDoc.Validate()
		If boo Then
		  response.write "Document is valid"
			response.write "Validation error:" +
		End If
	End If
	response.write xmldoc.xml
	Set xmlDoc = Nothing
	Set xSchemaCache = Nothing

Received on Wednesday, 23 January 2002 13:41:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:55 UTC