473,568 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.tostr ing() should reslut me "5070" and

bank.descriptio n.tostring() should result "ICICI - Bangalore"

bank.location.d estination.code should result "MB"

bank.location.z one.code.tostri ng() should result "12" etc .,

And the XML file being ...

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

<MainBank>

<bank>

<code>5070</code>

<description>IC ICI - Bangalore</description>

<contactPerson> Peter Loke</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Ma in Branch at Mayohall</description>

</destination>

<zone>

<code>12</code>

<description>Ad min building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Ad min with ExchRout plus Hub</description>

</catagory>

<exchContact>E8 39IRU</exchContact>

<isTT>true</isTT>

<classification >F98X</classification>

<branchDets>

<code>8525</code>

<description>Ad ministration 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>Sy stem Admin</description>

</offtype>

<currency>INR </currency>

<frCur>false</frCur>

</offices>

</branchDets>

</bank>

<bank>

<code>5071</code>

<description>IC ICI - Mumbai</description>

<contactPerson> Jane Edwards</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Ma in Branch at VT</description>

</destination>

<zone>

<code>12</code>

<description>Ad min building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Ad min with ExchRout plus Hub</description>

</catagory>

<exchContact>E8 39IRU</exchContact>

<isTT>true</isTT>

<classification >F98X</classification>

<branchDets>

<code>8525</code>

<description>Ad ministration 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>Sy stem 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 1459
* Chakravarthy wrote in microsoft.publi c.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****@h oehrmann.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.CO M ...
cheers,
Happy Coding
--
Every thing is perfect, as long as you share!!!
"Chakravart hy" 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.tostr ing() should reslut me "5070" and

bank.descriptio n.tostring() should result "ICICI - Bangalore"

bank.location.d estination.code should result "MB"

bank.location.z one.code.tostri ng() should result "12" etc .,

And the XML file being ...

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

<MainBank>

<bank>

<code>5070</code>

<description>IC ICI - Bangalore</description>

<contactPerson> Peter Loke</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Ma in Branch at Mayohall</description>

</destination>

<zone>

<code>12</code>

<description>Ad min building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Ad min with ExchRout plus Hub</description>

</catagory>

<exchContact>E8 39IRU</exchContact>

<isTT>true</isTT>

<classification >F98X</classification>

<branchDets>

<code>8525</code>

<description>Ad ministration 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>Sy stem Admin</description>

</offtype>

<currency>INR </currency>

<frCur>false</frCur>

</offices>

</branchDets>

</bank>

<bank>

<code>5071</code>

<description>IC ICI - Mumbai</description>

<contactPerson> Jane Edwards</contactPerson>

<location>

<destination>

<code>MB</code>

<description>Ma in Branch at VT</description>

</destination>

<zone>

<code>12</code>

<description>Ad min building and
8to8Branch</description>

</zone>

</location>

<catagory>

<code>1LL</code>

<description>Ad min with ExchRout plus Hub</description>

</catagory>

<exchContact>E8 39IRU</exchContact>

<isTT>true</isTT>

<classification >F98X</classification>

<branchDets>

<code>8525</code>

<description>Ad ministration 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>Sy stem 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
3673
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 passes a python object (pO) to pB. Now I require pA to be called in a java class (jC) and pass pO into jC. As pA uses non-python modules, I am not...
6
2019
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 any given number...) The algorithm is quite simple and I would not have bothered you with such a simple problem.
3
6704
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
2194
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 of the data that it provides. However, although I can get the initialisations to work, I cannot manage to get responses that require data to pass to...
13
22078
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 code so that i can process it. i googled many times and tried many of the answers out there, no luck so far. is there a way to convert a...
3
2100
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 programmatic object. My experience with the deserialization method is limited to classes with *fixed* numbers of member data variables - and that...
4
39307
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 will convert each of the records of these service dates to the first date of that month, with results showing: 7/1/2006, 7/1/2006, 7/1/2006. How would...
26
2574
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 doing this with table based layout the code would be as follows: <head> <style type="text/css"> #bgleft { background: url(left_half_circle.gif)...
0
10737
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 inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7916
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7660
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.