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 7th, 2006, 07:23 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default validateOnParse versus xsi:nil

Hi

I have a problem loading XML-documents that contain the xsi:nil-attribute in the following situation:

 - XML-sample 'Simple.xml':
    <?xml version="1.0" encoding="UTF-8" ?>
   <Simple xmlns="http://www.simple.be/Simple"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <MyDate xsi:nil="true" />
   </Simple>

 - XML-sample 'Simple2.xml':
    <?xml version="1.0" encoding="UTF-8" ?>
   <Simple xmlns="http://www.simple.be/Simple"
           xmlns:dummy="http://www.dummy.be/dummy">
      <MyDate dummy:nil="true" />
   </Simple>>

 - (simplified) C++-code used to load the XML-document
   MSXML2::IXMLDOMDocument2Ptr DOMPtr = NULL;
   try
   {
      if (DOMPtr.CreateInstance (__uuidof (MSXML2::DOMDocument40)) !
          = VARIANT_TRUE)
      {
         DOMPtr->async = VARIANT_FALSE;
         DOMPtr->validateOnParse = VARIANT_FALSE;

         if (DOMPtr->load ("Simple.xml") != VARIANT_TRUE)
         {
            ...
         }
      }
   }
   catch (_com_error e)
   {
      ...
   }

The load fails when validateOnParse = VARIANT_FALSE with error 'xsi:nil attribute on element 'MyDate' is invalid' (code: -1072897995) and I have no clue why.
The MSXML-help for validateOnParse states the following:
'Boolean. The property is read/write. If True, it validates during parsing. If False, it parses only for well-formed XML. The default is True.'
If you set this property to 'True':
 - What exactly is validated?
 - What is it validated against?

And... why is there no problem when loading 'Simple2.xml'?



Kind regards

JaKKe





Similar Threads
Thread Thread Starter Forum Replies Last Post
exclude-result-prefixes="#all" and xsi:type maxtoroq XSLT 2 November 7th, 2008 08:46 PM
problem with xsi:SchemaLocation akshay144 XML 2 August 20th, 2008 05:40 AM
Creating xsi:type as an attribute AjayLuthria XSLT 5 May 10th, 2007 09:49 AM
copy-of xsi namespace chris_strub XSLT 2 October 2nd, 2004 10:32 PM





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