XML parsing issue on Data Load

I am woking with large xml files that have numerous branches and nested structures. The xsd file is approx 20K lines and the xml files typical run a couple thousand lines. I am having a small issue when a tag has an optional attribute.

I have numerous examples but they all follow this general structure. Here is an example for the middle name

<Middle>Eric</Middle> 

or the tag would be

<Middle Type="NMN"/>

which stands for no middle name

My type structure for the canonical is

@xml(rootElement=‘Middle’, compact=true)

type MiddleStructure {

@ser(name=‘Type’)

type_: string



xmlElementTextContent: string

}

This works for the tag with tpye_ = “NMN” and xmlElementTextContent = null

It does not work when the attribute is not present. It just has both values as null.

Does anyone know how I would handle this?