473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Question on XMLSerialization

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.
Jun 30 '06 #1
3 1042
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

"Joe Cool" <jo*****@home.net> schreef in bericht
news:9h********************************@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.

Jun 30 '06 #2
On Fri, 30 Jun 2006 07:07:31 +0200, "Cor Ligthert [MVP]"
<no************@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" <jo*****@home.net> schreef in bericht
news:9h********************************@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.

Jun 30 '06 #3
Joe,

Probably can you use the xmlnode reader.

http://www.vb-tips.com/default.aspx?...a-22589f018cd4

I hope this helps,

Cor

"Joe Cool" <jo*****@home.net> schreef in bericht
news:bk********************************@4ax.com...
On Fri, 30 Jun 2006 07:07:31 +0200, "Cor Ligthert [MVP]"
<no************@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" <jo*****@home.net> schreef in bericht
news:9h********************************@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.

Jul 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Omkar Singh | last post by:
When I serialize my class using XmlSerialization.serialize, it make a lot of reference in the output document. Is there any way to off XmlSerialiation class to make references.
0
by: Omkar Singh | last post by:
I am using XmlSerialization and XmlDeserialization for making soap Body part. Then I am making sopa-header and other part of soap envelope manually. At last joining all part to get complete soap...
2
by: STom | last post by:
I have just started reading up on XMLSerialization and still do not understand the practical use of this technology. For example, if I have to know the class type on the client and on the web...
0
by: A programmer desperatly needing help! | last post by:
I use the xmlserialization on asp.net pages and on previous machines it never gave a problem. But now i somethings get a: Timed out waiting for a program to execute. The command being executed was...
13
by: jcrouse | last post by:
Here is some of my code Dim myXmlTextWriter As XmlTextWriter = New XmlTextWriter("C:\CPViewer\CPViewer.xml", System.Text.Encoding.Unicode myXmlTextWriter.Formatting =...
4
by: pfrisbie | last post by:
I am developing a Web Services interface with C# and our partner is using Java (Axis 1.1). They require me to include xsi:types in the SOAP Messages I send them. For example: <Partner...
3
by: LW | last post by:
Hi! I am getting the following error message for my fairly simple web service. I have classes and have two DataSets that reference the same classes. The error is: The XML element named...
1
by: Frank | last post by:
Hi, Let's say I have a file named myFile.xml Within that file I have blocks of data which I'd like to add at different times during the day. e.g. <LogEntry>
0
by: IanWright | last post by:
This is a little bit more of an advanced topic for serialization. For those who don't know what XML serialization is, then this probably isn't for you just yet. For those that do, you may have come...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.