XML.Reader correlate produces ERROR #6277: Type attribute does not specify valid type for XML input tag
I'm using %XML.Reader to open an XML file and use it's correlate method to try and convert it to a class.
The conversion fails with an error of:
ERROR #6277: Type attribute, LimitedFreeTextFieldInstance, does not specify valid type for XML input tag: Field (ending at line 3 character 118).
This is the XML
<Fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<Field xsi:type="UDFLookupFieldInstance" ID="2925" Description="FIRE ALARM ACTIVE" Suffix="FDT_ACTIVATE"/>
</Fields>
This error is produced when xsi:type is any value, when it is left blank conversion using the code listed below is successful.
The XML I'm working with is produced by a third party and can't changed.
I can't figure out why. Can anyone help?
The classes are as follows:
Class Field Extends (%Persistent, %XML.Adaptor)
{
Parameter XMLFORMAT = "literal";
Parameter XMLNAME = "Field";
Parameter NAMESPACE = "http://www.civica.co.uk/ParisConnect/ConnectXml/1.0/Messaging";
Property Type As %String(XMLNAME = "xsi:type", XMLPROJECTION = "ATTRIBUTE");
Property Suffix As %String(XMLNAME = "Suffix", XMLPROJECTION = "ATTRIBUTE");
Property Description As %String(XMLNAME = "Description", XMLPROJECTION = "ATTRIBUTE");
Property ID As %String(XMLNAME = "ID", XMLPROJECTION = "ATTRIBUTE");
}
Class Fields Extends (%Persistent, %XML.Adaptor)
{
Parameter XMLFORMAT = "literal";
Parameter XMLNAME = "Fields";
Parameter XMLSEQUENCE = 1;
Parameter NAMESPACE = "http://www.civica.co.uk/ParisConnect/ConnectXml/1.0/Messaging";
Parameter SUPPRESSTYPEPREFIX = 1;
Property Fields As list Of Field(XMLNAME = "Field", XMLPROJECTION = "ELEMENT");
}
And I test with
ClassMethod TestFieldsCorrelate()
{
Set reader = ##class(%XML.Reader).%New()
Set tSc=reader.OpenFile("E:\temp\Fields.xml")
#dim match as Fields
Do reader.Correlate("Fields","Fields")
While reader.Next(.match,.tSc) {
w !, "Hurrah"
}
If $$$ISERR(tSc) {
w !, $SYSTEM.Status.GetErrorText(tSc)
}
}
Any feedback, thoughts, comments would be greatfuly received.
Cheers
Andy
Product version: IRIS 2021.1
$ZV: IRIS for Windows (x86-64) 2021.2.1 (Build 654U) Fri Mar 18 2022 06:09:35 EDT