EDN Admin
Well-known member
My C++ code used MSXML 4.0 and I have now modified it to use MSXML 6.0. The code compiles for 32-bit and 64-bit platform. I have installed MSXML 6.0 on the 32 bit and 64 bit platform appropriately.
The code loads and validates an XML file with its schema(.xsd) file using the interface method IXMLDOMDocument2::validate(). The validation succeeds on 32 bit platform but fails on 64 bit platform with the error -
"Validate failed because a DTD or schema was not specified in the document."
The XML file and schema file exist in the same directory but still the error shows up on 64 bit platform. Below are contents of the files:
XML File
=========
<?xml version="1.0" standalone="no"?>
<ROOT xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance " xsi:noNamespaceSchemaLocation="ABCSettings.xsd" >
<Speed value="32" value_type="long"/>
<Constraint value="1" value_type="long"/>
<DestPaths>
<DestPath value="%DIR%Log" value_type="string"/>
</DestPaths>
</ROOT>
Schema (.XSD) File
===================
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd=" http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema
<xsd:element name="ROOT
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded
<xsd:element name="Speed" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:attribute name="value" type="xsd:long"/>
<xsd:attribute name="value_type" type="xsd:string" fixed="long"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Constraint" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:attribute name="value" type="xsd:long"/>
<xsd:attribute name="value_type" type="xsd:string" fixed="long"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DestPaths" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded
<xsd:element name="DestPath" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:attribute name="value" type="xsd:string"/>
<xsd:attribute name="value_type" type="xsd:string" fixed="string"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Can anyone please help me in knowing answers for the below questions -
1. Why is the validation failing on 64 bit platform?
2. In the xml file replacing "xsi" with "xs" still works? Why?
View the full article
The code loads and validates an XML file with its schema(.xsd) file using the interface method IXMLDOMDocument2::validate(). The validation succeeds on 32 bit platform but fails on 64 bit platform with the error -
"Validate failed because a DTD or schema was not specified in the document."
The XML file and schema file exist in the same directory but still the error shows up on 64 bit platform. Below are contents of the files:
XML File
=========
<?xml version="1.0" standalone="no"?>
<ROOT xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance " xsi:noNamespaceSchemaLocation="ABCSettings.xsd" >
<Speed value="32" value_type="long"/>
<Constraint value="1" value_type="long"/>
<DestPaths>
<DestPath value="%DIR%Log" value_type="string"/>
</DestPaths>
</ROOT>
Schema (.XSD) File
===================
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd=" http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema
<xsd:element name="ROOT
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded
<xsd:element name="Speed" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:attribute name="value" type="xsd:long"/>
<xsd:attribute name="value_type" type="xsd:string" fixed="long"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Constraint" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:attribute name="value" type="xsd:long"/>
<xsd:attribute name="value_type" type="xsd:string" fixed="long"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DestPaths" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded
<xsd:element name="DestPath" minOccurs="0" maxOccurs="unbounded
<xsd:complexType>
<xsd:attribute name="value" type="xsd:string"/>
<xsd:attribute name="value_type" type="xsd:string" fixed="string"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Can anyone please help me in knowing answers for the below questions -
1. Why is the validation failing on 64 bit platform?
2. In the xml file replacing "xsi" with "xs" still works? Why?
View the full article