|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Question on XMLSerializationhave the source to and have no control over at all. I would like to read this XML file using VS2005 VB with XMLSerialization. The following XML file exhibits the structure of this file: <Root> <Group> <TypeA Attrib1="xxx" Attrib2="xxx"> <TypeAProperty1>xxx</TypeAProperty1> <TypeAProperty2>zzz</TypeAProperty2> </TypeA> <TypeB Attrib1="xxx"> <TypeBProperty1>xxx</TypeBProperty1> </TypeB> </Group> </Root> The problem is how to define a class that will be the target of the Group node list. There can be a variable number of types. Different types will have each own list of attributes and nodelist. The list of types in the group can be any mix of different types in any order, but the order matters. I cannot figure out how to structure such a class. Any help will be appreciated. Joe,
Any reason that you want to use serialization because an XML file is a kind of serialized file. If this is the result of a XMLserialized object, than you never get it back to that not knowed Type, you only have the property dataparts. Why not just read it? Cor Show quoteHide quote "Joe Cool" <joec***@home.net> schreef in bericht news:9h39a254slilhuo6c5si1522bv7endkoh5@4ax.com... >I have an XML file that is created by an application that I do not > have the source to and have no control over at all. I would like to > read this XML file using VS2005 VB with XMLSerialization. The > following XML file exhibits the structure of this file: > > <Root> > <Group> > <TypeA Attrib1="xxx" Attrib2="xxx"> > <TypeAProperty1>xxx</TypeAProperty1> > <TypeAProperty2>zzz</TypeAProperty2> > </TypeA> > <TypeB Attrib1="xxx"> > <TypeBProperty1>xxx</TypeBProperty1> > </TypeB> > </Group> > </Root> > > The problem is how to define a class that will be the target of the > Group node list. There can be a variable number of types. Different > types will have each own list of attributes and nodelist. The list of > types in the group can be any mix of different types in any order, but > the order matters. > > I cannot figure out how to structure such a class. Any help will be > appreciated. > > On Fri, 30 Jun 2006 07:07:31 +0200, "Cor Ligthert [MVP]"
<notmyfirstn***@planet.nl> wrote: >Joe, I do not have access to the code that generated the XML file, so I> >Any reason that you want to use serialization because an XML file is a kind >of serialized file. have no idea if it is a product of serialization or not. > Since I have figured out how to use XMLSerialzation, I prefer to use>If this is the result of a XMLserialized object, than you never get it back >to that not knowed Type, you only have the property dataparts. > >Why not just read it? it when I can to read and write XML. But I'm afraid I am going to have to go back to the DOM to read this one in. Show quoteHide quote > >Cor > >"Joe Cool" <joec***@home.net> schreef in bericht >news:9h39a254slilhuo6c5si1522bv7endkoh5@4ax.com... >>I have an XML file that is created by an application that I do not >> have the source to and have no control over at all. I would like to >> read this XML file using VS2005 VB with XMLSerialization. The >> following XML file exhibits the structure of this file: >> >> <Root> >> <Group> >> <TypeA Attrib1="xxx" Attrib2="xxx"> >> <TypeAProperty1>xxx</TypeAProperty1> >> <TypeAProperty2>zzz</TypeAProperty2> >> </TypeA> >> <TypeB Attrib1="xxx"> >> <TypeBProperty1>xxx</TypeBProperty1> >> </TypeB> >> </Group> >> </Root> >> >> The problem is how to define a class that will be the target of the >> Group node list. There can be a variable number of types. Different >> types will have each own list of attributes and nodelist. The list of >> types in the group can be any mix of different types in any order, but >> the order matters. >> >> I cannot figure out how to structure such a class. Any help will be >> appreciated. >> >> > Joe,
Probably can you use the xmlnode reader. http://www.vb-tips.com/default.aspx?ID=e788c048-e547-4de3-9c6a-22589f018cd4 I hope this helps, Cor Show quoteHide quote "Joe Cool" <joec***@home.net> schreef in bericht news:bk4ba2d4aqdt4u1fp7ruu7jvoa48t452hg@4ax.com... > On Fri, 30 Jun 2006 07:07:31 +0200, "Cor Ligthert [MVP]" > <notmyfirstn***@planet.nl> wrote: > >>Joe, >> >>Any reason that you want to use serialization because an XML file is a >>kind >>of serialized file. > > I do not have access to the code that generated the XML file, so I > have no idea if it is a product of serialization or not. > >> >>If this is the result of a XMLserialized object, than you never get it >>back >>to that not knowed Type, you only have the property dataparts. >> >>Why not just read it? > > Since I have figured out how to use XMLSerialzation, I prefer to use > it when I can to read and write XML. But I'm afraid I am going to have > to go back to the DOM to read this one in. > >> >>Cor >> >>"Joe Cool" <joec***@home.net> schreef in bericht >>news:9h39a254slilhuo6c5si1522bv7endkoh5@4ax.com... >>>I have an XML file that is created by an application that I do not >>> have the source to and have no control over at all. I would like to >>> read this XML file using VS2005 VB with XMLSerialization. The >>> following XML file exhibits the structure of this file: >>> >>> <Root> >>> <Group> >>> <TypeA Attrib1="xxx" Attrib2="xxx"> >>> <TypeAProperty1>xxx</TypeAProperty1> >>> <TypeAProperty2>zzz</TypeAProperty2> >>> </TypeA> >>> <TypeB Attrib1="xxx"> >>> <TypeBProperty1>xxx</TypeBProperty1> >>> </TypeB> >>> </Group> >>> </Root> >>> >>> The problem is how to define a class that will be the target of the >>> Group node list. There can be a variable number of types. Different >>> types will have each own list of attributes and nodelist. The list of >>> types in the group can be any mix of different types in any order, but >>> the order matters. >>> >>> I cannot figure out how to structure such a class. Any help will be >>> appreciated. >>> >>> >>
String and int Issue
MDI Form loading Late Binding Return Value Weirdness Visual Basic 6.0, Enterprise Edition ASP.NET: VSNET2003 to VSNET2005 Global.asax.vb in Visual Studio .NET 2005 determine which radiobutton in a groupbox is checked? Getting the text from a bound combobox. Comparing recordsets in VB2005 Datefield from variable into a datefield in an access b |
|||||||||||||||||||||||