Issue 31808  —   xmlToStruct fails when schemaLocation points to non-existing XML schema

Status:   Planned for resolution in 10.4.01

Solution available in patch(es):


 The xmlToStruct statement fails when the schemaLocation or
 noNamespaceSchemaLocation attribute of a XML document points to a non-existing
 XML schema location.

 * Version 9.5.01 (and higher)

 +Operating System:
 * OS independent

 * DBMS independent

 The schemaLocation attribute can be used to specify the location of a XML
 schema for a specific namespace. And the noNamespaceSchemaLocation attribute
 references an XML Schema document that does not have a target namespace. In
 case the specified XML schema (XSD file) is not valid then the xmlToStruct
 statement will fail with the error -1503 ("Fatal error encountered during
 schema scan"). This is not excepted, since the schema files should only be read
 when using structToXml/schema.

 Consider the following XML (mysample.xml):

 <?xml version="1.0"?>
 <root xmlns=""
 <text>this is a text</text>

 When executing the following statement then the error -1503 is returned:

 xmlToStruct vStruct, "mysample.xml"

 Expectation: xmlToStruct should ignore the schemaLocation attribute.


 Remove the namespace attribute before using xmlToStruct. E.g.
 vFileName = "mysample.xml"
 fileload vFileName, vXml
 vXml = $replace(vXml, 1, 'xsi:schemaLocation="(*)"', "")
 vXml = $replace(vXml, 1, 'xsi:noNamespaceSchemaLocation ="(*)"', "")
 xmltostruct vStruct, vXml