Note that there are some explanatory texts on larger screens.

plurals
  1. POXmlSerializer throws InvalidOperationException when having a namespace prefix in the attribute
    text
    copied!<p>I try to read an XML file that contains the following element:</p> <pre><code>&lt;ho:CODED-TYPE ho:BASE-DATA-TYPE="A_UINT16" CATEGORY="STANDARD-LENGTH-TYPE" ENCODING="UNSIGNED"&gt; </code></pre> <p>My class to describe this node looks like that:</p> <pre><code>public ref class FIBEXCodedType { public: [XmlAttribute("ho:BASE-DATA-TYPE")] property String^ BaseDataType; [XmlAttribute("CATEGORY")] property String^ Category; [XmlAttribute("ENCODING")] property String^ Encoding; FIBEXCodedType(void); }; </code></pre> <p>I get an InvalidOperationException from XmlSerializer.ctor telling me:</p> <p>"Ungültiges Namenszeichen in 'ho:BASE-DATA-TYPE'." (this could be translated as "invalid character in: 'ho:BASE-DATA-TYPE'").</p> <p>I also tried the following:</p> <pre><code>[XmlAttribute("BASE-DATA-TYPE", Namespace="http://www.asam.net/xml")] property String^ BaseDataType; </code></pre> <p>But this didn't work either. This time without the error message but the unit test fails telling me, that the property is still set to "null".</p> <p>I am completely stuck with this. So any help is appreciated</p> <p>thanks in advance</p> <p>EDIT: some more XML</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;fx:FIBEX xmlns:fx="http://www.asam.net/xml/fbx" xmlns:ho="http://www.asam.net/xml" xmlns:can="http://www.asam.net/xml/fbx/can" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="fibex4can.xsd" VERSION="3.1.0"&gt; &lt;fx:CODING ID="codingSpeed"&gt; &lt;ho:SHORT-NAME&gt;CodingSpeed&lt;/ho:SHORT-NAME&gt; &lt;ho:DESC&gt;Coding for speed values within this system.&lt;/ho:DESC&gt; &lt;ho:CODED-TYPE ho:BASE-DATA-TYPE="A_UINT16" CATEGORY="STANDARD-LENGTH-TYPE" ENCODING="UNSIGNED"&gt; &lt;ho:BIT-LENGTH&gt;16&lt;/ho:BIT-LENGTH&gt; &lt;/ho:CODED-TYPE&gt; &lt;/fx:CODING&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload