Add LiquidXmlObject to AnyElements type problem
Question asked by E B - October 3 at 11:31 AM
Answered
Hi!
I have generated C# code from an XSD which contains extensions of another XSD. (the extensions are additions to the original railML 2.4 definition)

The extensions are supposed to be added to the "AnyElement" list of the object defined in the original definition, however adding the element directly to this list results in a type mismatch: "cannot convert from LiquidXmlObjects.norextension.Nor.LineSectionElm" to "System.Xml.Linq.XElement".

I already have C# classes created from the XSD for LineSectionElm, and I would prefer to use this generated structure instead of building an XElement myself.

Are there any easy ways to handle this without building the XElement manually?

1 Reply

Reply to Thread
0
Liquid Support Replied
Employee Post Marked As Answer
Hi,

You would need to write the LineSectionElm to an XML string and then read it back into the XElement.

The use of AnyElement is described in the documentation.


Reply to Thread