473,394 Members | 1,812 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,394 software developers and data experts.

Is it possible to convert any given XML into Class?

Given an XML stream as below, is there any possibility to convert the same
into any treditional class style with . (dots) as seperator of the nodes of
the xml file...

for instance

bank.code.tostring() should reslut me "5070" and

bank.description.tostring() should result "ICICI - Bangalore"

bank.location.destination.code should result "MB"

bank.location.zone.code.tostring() should result "12" etc .,

And the XML file being ...

<?xml version="1.0" encoding="utf-8" ?>

<MainBank>

<bank>

<code>5070</code>

<description>ICICI - Bangalore</description>

<contactPerson>Peter Loke</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Main Branch at Mayohall</description>

</destination>

<zone>

<code>12</code>

<description>Admin building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Admin with ExchRout plus Hub</description>

</catagory>

<exchContact>E839IRU</exchContact>

<isTT>true</isTT>

<classification>F98X</classification>

<branchDets>

<code>8525</code>

<description>Administration Branch from 3rd_u70 ?loor
Onwards</description>

<floors>3,4</floors>

<type>FA</type>

<description>

<detail>Fully Automated</detail>

<ATM>True</ATM>

<eTT>False</eTT>

</description>

<offices>

<offtype>

<code>SA</code>

<description>System Admin</description>

</offtype>

<currency>INR</currency>

<frCur>false</frCur>

</offices>

</branchDets>

</bank>

<bank>

<code>5071</code>

<description>ICICI - Mumbai</description>

<contactPerson>Jane Edwards</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Main Branch at VT</description>

</destination>

<zone>

<code>12</code>

<description>Admin building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Admin with ExchRout plus Hub</description>

</catagory>

<exchContact>E839IRU</exchContact>

<isTT>true</isTT>

<classification>F98X</classification>

<branchDets>

<code>8525</code>

<description>Administration Branch from 3rd_u70 ?loor
Onwards</description>

<floors>3,4,5,6</floors>

<type>FA</type>

<description>

<detail>Fully Automated</detail>

<ATM>True</ATM>

<eTT>False</eTT>

</description>

<offices>

<offtype>

<code>SA</code>

<description>System Admin</description>

</offtype>

<currency>INR</currency>

<currency>USD</currency>

<frCur>True</frCur>

</offices></branchDets></bank></MainBank>

--
Every thing is perfect, as long as you share!!!
Apr 29 '06 #1
2 1451
* Chakravarthy wrote in microsoft.public.dotnet.xml:
Given an XML stream as below, is there any possibility to convert the same
into any treditional class style with . (dots) as seperator of the nodes of
the xml file...


You should have a look at XmlSerializer and related features.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Apr 29 '06 #2
This is possible only if the given XML has no problem in converting into it's
schema object.
You can convert any given xml file into treditional class style by using the
XSD.EXE command line tool.

For example, the mentioned example can be converted into a class object with
the bellow steps
Step 1) by using the XSD.EXE create the .XSD file
Step 2) by usng the XSD.EXE create the class file with "/c" option
Step 3) once the class is created, instantiate the object and then populate
the data into the instantiated object by any serialization techniques.

For more explanation, ping me at DS******@MSN.COM ...
cheers,
Happy Coding
--
Every thing is perfect, as long as you share!!!
"Chakravarthy" wrote:
Given an XML stream as below, is there any possibility to convert the same
into any treditional class style with . (dots) as seperator of the nodes of
the xml file...

for instance

bank.code.tostring() should reslut me "5070" and

bank.description.tostring() should result "ICICI - Bangalore"

bank.location.destination.code should result "MB"

bank.location.zone.code.tostring() should result "12" etc .,

And the XML file being ...

<?xml version="1.0" encoding="utf-8" ?>

<MainBank>

<bank>

<code>5070</code>

<description>ICICI - Bangalore</description>

<contactPerson>Peter Loke</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Main Branch at Mayohall</description>

</destination>

<zone>

<code>12</code>

<description>Admin building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Admin with ExchRout plus Hub</description>

</catagory>

<exchContact>E839IRU</exchContact>

<isTT>true</isTT>

<classification>F98X</classification>

<branchDets>

<code>8525</code>

<description>Administration Branch from 3rd_u70 ?loor
Onwards</description>

<floors>3,4</floors>

<type>FA</type>

<description>

<detail>Fully Automated</detail>

<ATM>True</ATM>

<eTT>False</eTT>

</description>

<offices>

<offtype>

<code>SA</code>

<description>System Admin</description>

</offtype>

<currency>INR</currency>

<frCur>false</frCur>

</offices>

</branchDets>

</bank>

<bank>

<code>5071</code>

<description>ICICI - Mumbai</description>

<contactPerson>Jane Edwards</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Main Branch at VT</description>

</destination>

<zone>

<code>12</code>

<description>Admin building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Admin with ExchRout plus Hub</description>

</catagory>

<exchContact>E839IRU</exchContact>

<isTT>true</isTT>

<classification>F98X</classification>

<branchDets>

<code>8525</code>

<description>Administration Branch from 3rd_u70 ?loor
Onwards</description>

<floors>3,4,5,6</floors>

<type>FA</type>

<description>

<detail>Fully Automated</detail>

<ATM>True</ATM>

<eTT>False</eTT>

</description>

<offices>

<offtype>

<code>SA</code>

<description>System Admin</description>

</offtype>

<currency>INR</currency>

<currency>USD</currency>

<frCur>True</frCur>

</offices></branchDets></bank></MainBank>

--
Every thing is perfect, as long as you share!!!

May 10 '06 #3

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

Similar topics

5
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and...
6
by: Picho | last post by:
Hi group. This must have come up a few times before but I found no specific resources regarding this. the problem is simple: convert the number 55 to the string "Fifty five" (obviously with...
3
by: Vu Doan Hung | last post by:
I want to change this Class to VB.NET Class, can you help me ? using System; using System.Windows.Forms; using System.Drawing; using System.Data;
0
by: Vizzybit | last post by:
I am attempting to utilise the HBAAPI.dll that can be found at http://hbaapi.sourceforge.net/ (which is also used in hbaverify at http://hbaverify.sourceforge.net/) as I need to get a small subset...
13
by: HNT20 | last post by:
Hello All i am new to python language. i am working on a gnuradio project where it uses python as the primary programming language. i am trying to convert a message, text, or numbers into binary...
3
by: sherifffruitfly | last post by:
Hi, I've got a dtd for my xml file according to which, for example, 0 or more <componentelements are permitted. I'd like to take any xml file conforming to this dtd, and deserialize it into a...
4
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that...
26
by: mark | last post by:
The idea of this is very simle. The site is 800px wide and sits in the middle of the browser window, on either side of the site I want a different background image aligned against it. If I were...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
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: 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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.