By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

Is it possible to convert any given XML into Class?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
* 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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.