Click here to Skip to main content
14,392,424 members
   

XML / XSL

 
AnswerRe: Writing XML from Excel Using VBA Pin
Richard Deeming1-Oct-14 2:45
communityengineerRichard Deeming1-Oct-14 2:45 
Questiondelimiter or tokenizer in xslt Pin
DanielSatheesh27-Aug-14 2:22
MemberDanielSatheesh27-Aug-14 2:22 
AnswerRe: delimiter or tokenizer in xslt Pin
George Jonsson14-Sep-14 0:55
professionalGeorge Jonsson14-Sep-14 0:55 
QuestionMultiple namespaces in xslt Pin
MaryJames7-May-14 23:00
MemberMaryJames7-May-14 23:00 
AnswerRe: Multiple namespaces in xslt Pin
Richard MacCutchan7-May-14 23:24
mveRichard MacCutchan7-May-14 23:24 
GeneralRe: Multiple namespaces in xslt Pin
MaryJames8-May-14 4:16
MemberMaryJames8-May-14 4:16 
GeneralRe: Multiple namespaces in xslt Pin
Richard MacCutchan8-May-14 4:19
mveRichard MacCutchan8-May-14 4:19 
QuestionUse XmlAttributeOverrides, but get an InvalidOperationException nevertheless Pin
Christian Treffler2-Apr-14 9:15
MemberChristian Treffler2-Apr-14 9:15 
Hello,

I'd like to serialize an Objekt with XmlSerializer. The Objekt is a kind of treeview with lots of public properties like this:
public object Instance;


Currently I have different kind of classes stored in the Instance objects, all inheriting from the same base class. If I want to serialize these, I need to tell the XmlSerializer in an XmlAttributeOverrides object about the different Instance object classes. I collect this information dynamically before starting the XmlSerializer.
Setting a breakpoint just before that I can check the Overrides object which looks like this:

-       Overrides   {System.Xml.Serialization.XmlAttributeOverrides}    System.Xml.Serialization.XmlAttributeOverrides
-       Non-Public members
-       types   Count = 5   System.Collections.Hashtable
-       [{CTrModules.MDataSaveXML}] {System.Collections.Hashtable}
+       Key {Name = "MDataSaveXML" FullName = "CTrModules.MDataSaveXML"}    object {System.RuntimeType}
-       Value   Count = 1   object {System.Collections.Hashtable}
+       ["Instance"]    {System.Xml.Serialization.XmlAttributes}
+       Raw View
-       [{CTrModules.QSM_Var_Dict}] {System.Collections.Hashtable}
+       Key {Name = "QSM_Var_Dict" FullName = "CTrModules.QSM_Var_Dict"}    object {System.RuntimeType}
-       Value   Count = 1   object {System.Collections.Hashtable}
+       ["Instance"]    {System.Xml.Serialization.XmlAttributes}
+       Raw View
-       [{System.String}]   {System.Collections.Hashtable}
+       Key {Name = "String" FullName = "System.String"}    object {System.RuntimeType}
-       Value   Count = 1   object {System.Collections.Hashtable}
+       ["Instance"]    {System.Xml.Serialization.XmlAttributes}
+       Raw View
-       [{CTrModules.MHandleException}] {System.Collections.Hashtable}
+       Key {Name = "MHandleException" FullName = "CTrModules.MHandleException"}    object {System.RuntimeType}
-       Value   Count = 1   object {System.Collections.Hashtable}
+       ["Instance"]    {System.Xml.Serialization.XmlAttributes}
+       Raw View
-       [{FFV_Cockpit.InternalExcHandler}]  {System.Collections.Hashtable}
+       Key {Name = "InternalExcHandler" FullName = "FFV_Cockpit.InternalExcHandler"}   object {System.RuntimeType}
-       Value   Count = 1   object {System.Collections.Hashtable}
+       ["Instance"]    {System.Xml.Serialization.XmlAttributes}



Now here's my problem: I get a InvalidOperationException: "The type CTrModules.MDataSaveXML was not expected."
Looking through the Overrides above, CTrModules.MDataSaveXML was handed over to the serializer along with all other classes. All other classes can be serialized, but not this one. All classes have the Serializable attribute and are inheriting the same base class.

I'm at a loss here. Why is CTrModules.MDataSaveXML not expected?

I'm using C# in Visual Studio Espress 2013 for Windows Desktop, the target framework is .NET Framework 4.

TIA,
Christian
AnswerRe: Use XmlAttributeOverrides, but get an InvalidOperationException nevertheless Pin
Bernhard Hiller2-Apr-14 22:24
MemberBernhard Hiller2-Apr-14 22:24 
GeneralRe: Use XmlAttributeOverrides, but get an InvalidOperationException nevertheless Pin
Christian Treffler3-Apr-14 5:03
MemberChristian Treffler3-Apr-14 5:03 
QuestionXpath selecting nodes based on multiple attributes Pin
joost.versteegen4-Dec-13 5:28
Memberjoost.versteegen4-Dec-13 5:28 
AnswerRe: Xpath selecting nodes based on multiple attributes Pin
PIEBALDconsult4-Dec-13 5:46
professionalPIEBALDconsult4-Dec-13 5:46 
GeneralRe: Xpath selecting nodes based on multiple attributes Pin
joost.versteegen4-Dec-13 21:50
Memberjoost.versteegen4-Dec-13 21:50 
AnswerRe: Xpath selecting nodes based on multiple attributes Pin
Richard Deeming4-Dec-13 5:57
communityengineerRichard Deeming4-Dec-13 5:57 
QuestionXPath following-sibling Pin
savbace21-Oct-13 0:20
Membersavbace21-Oct-13 0:20 
QuestionXML validation. Pin
Septimus Hedgehog18-Aug-13 23:02
MemberSeptimus Hedgehog18-Aug-13 23:02 
AnswerRe: XML validation. Pin
joost.versteegen5-Dec-13 23:00
Memberjoost.versteegen5-Dec-13 23:00 
AnswerMessage Closed Pin
20-Sep-14 1:38
MemberRaushank0320-Sep-14 1:38 
QuestionSlow group - noob Xml question - converting binary structure to Xml and back? Pin
charlieg24-Jul-13 4:10
Membercharlieg24-Jul-13 4:10 
AnswerRe: Slow group - noob Xml question - converting binary structure to Xml and back? Pin
Richard MacCutchan24-Jul-13 6:06
mveRichard MacCutchan24-Jul-13 6:06 
GeneralRe: Slow group - noob Xml question - converting binary structure to Xml and back? Pin
charlieg24-Jul-13 6:09
Membercharlieg24-Jul-13 6:09 
QuestionEmpty node when data specified in xsd Pin
DaveyM6919-Jul-13 0:57
professionalDaveyM6919-Jul-13 0:57 
AnswerRe: Empty node when data specified in xsd Pin
Richard MacCutchan19-Jul-13 1:01
mveRichard MacCutchan19-Jul-13 1:01 
GeneralRe: Empty node when data specified in xsd Pin
DaveyM6919-Jul-13 1:06
professionalDaveyM6919-Jul-13 1:06 
GeneralRe: Empty node when data specified in xsd Pin
Richard MacCutchan19-Jul-13 1:14
mveRichard MacCutchan19-Jul-13 1:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.