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!!!
0
dskcheck (22)
4/29/2006 7:19:01 AM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
581 Views

Similar Articles

[PageSpeed] 56

* 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:bjoern@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/ 
0
bjoern1 (135)
4/29/2006 1:18:31 PM
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 DSKCHECK@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!!!
0
dskcheck (22)
5/9/2006 7:33:01 AM
Reply:

Similar Artilces:

converting hh:mm:ss to decimal
is it possible to format a cell so that if I enter the time as 1.15 am it converts it to 0125 or if I enter the time as 2.45 pm it converts it to 1475. if anybody could help me with this it would be very much appreciated markcain@sympac.com.au With your time values in A1 =A1*2400 format as 0000 not that 01.35 (assuming you use period as time delimiter as opposed to colon) will return a value with decimals so you might want to round to nearest integer =ROUND(A1*2400,0) -- No private emails please, for everyone's benefit keep the discussion in the newsgroup. Regards, Peo Sj...

Possible to take a SNAPSHOT of a common dialog box?
Hi, I wrote a generic function that takes a "CDialog" type input as a parameter. My function then does a "Create()" on it (making a modeless dialog), leaving off the WS_VISIBLE style so that its not visible on the screen. It then sends it a WM_PRINT message.. the result is that I am able to take a "snapshot" of a dialog into a HBITMAP object without the dialog ever appearing on the screen. This works for CDialog and CPropertySheet, etc. Basically any object that responds to a WM_PRINT would work. Then I tried to do the same with a CFileDialog. Well, obviou...

"read only" cell in a given worksheet
is it possible to have a particuler cell in a worksheet to be only "read only"? meaning to hae that cell be read and not to be edited be others (even preventing the view of that cell's formula). thank you. "Colin2u" <Colin2u@discussions.microsoft.com> wrote in message news:FAAE5C9B-ADF9-4AD4-AA6B-4688684ABCB9@microsoft.com... > is it possible to have a particuler cell in a worksheet to be only "read > only"? meaning to hae that cell be read and not to be edited be others > (even > preventing the view of that cell's formula). > th...

Possible to Promote Outlook Contacts to CRM Contacts?
Is there a way to promote Outlook Contacts to CRM Contacts? Further, if Contacts are loaded into CRM, and the CRM for Outlook Client is sync'd with Outlook, all the CRM Contacts come down to Outlook. That is great except for duplicates coming from CRM to Outlook. Any way to merge duplicate Contact records then in Outlook? Thanks, Boolean1 Boolean1 wrote: > Is there a way to promote Outlook Contacts to CRM Contacts? > > Further, if Contacts are loaded into CRM, and the CRM for Outlook > Client is sync'd with Outlook, all the CRM Contacts come down to > Outlo...

Base Class
Hello, I am trying to create a common "SessionProvider" that a SessionService use. I came up with the following Session provider: // SessionProvider public class SessionProvider<Child> where Child : SessionProvider<Child>, new() { private static String Key { get { return typeof(SessionProvider<Child>).FullName; } } // Key private static Child Value { get { return (Child)HttpContext.Current.Session[Key]; } set { HttpContext.Current.Session[Key] = value; } } public static Child Current { get { ...

Contact list problem:Is it possible to use 'local' e-mail address that links to an external e-mail ?
I need to send alerts from MOM server to my cell@mobile.att.net. If try to enter this address on MOM directly, it doesn't work because it is an external address. Then I created a contact on the Exchange server. Alias is EmailAdmins. SMTP:cell@mobile.att.net. The only information I have on my local domain is my EmailAdmins (alias). If I enter cell@mobile.att.net that is still an external address. The problem here is that MOM app would not resolve the *alias* to the e-mail address on my contact list ( cell@mobile.att.net.) Any input on how I can establish a local e-mail address on my cont...

Dialog box in application class
I have a dialog box application. I added a dialog box resource and code and try to launch it in the application class before the original dialog box launch. If I use the controls inside it the dialog - like press some check box, the application crashes. Trying to launch it in another class works fine. Is that normal? Thanks beni "Beni" <beni@beni.com> wrote in message news:%23erze1l$GHA.204@TK2MSFTNGP04.phx.gbl... > I have a dialog box application. > I added a dialog box resource and code and try to launch it in the > application class before the original dialog b...

Possible to change the default cell format?
Hello - I am constantly changing the format of my cells (when they are the number format) to include the comma separator and to use zero decimal places. Is there a way to change the settings so that by default the values will not have decimal places (and by default they will have the comma separator? Thanks for any suggestions! (FYI, I considered creating a simple macro to do this, but I believe that it would limit me from being able to use the UNDO command as often as I would like). To address the "default" number format, you would have to use a template as your default workbook...

How to convert a .dat file to excel?
I have an inventory .dat file that I need to convert to excel so that I can import it. Please advise how to perform this task? Thank you for your time and consideration. Best regards, victor Victor, I depends how the file is laid out. As far as I know .dat can be used by many types of program, and the resultant file will be different. It may have commas or spaces between the text /data you want to put in to different columns You could open it with notepad to see what it looks like. In excel File, open, in the type of file at the bottom select 'all files *.*' find your fil...

Converting 123 to Excel
We're converting from 123 ('97 version) to Excel (2000). I've noticed that if a .123 file is saved in 123 as an Excel Worksheet or an Excel Workbook, when the file is opened in Excel it sometimes has a set of double quote marks around the file name. I've stayed away from that method, and save the file in 123 as a .WK4, then open into Excel and save there. Does anyone have an idea why the double quote marks occur? Thanks! It sounds as if you've kept the file's name with the .123 extension, rather than change it to .xls. If so, Excel will put quotes around the...

Converting text to numerals across spreadsheets
I'm referencing cells on a different worksheet with information in, but where it is says 'Yes' on Sheet 1 I need it to say '1' on sheet 2. Likewise, where it says 'No' on sheet 1, I need it to say '2' on sheet 2. Can anyone tell me how this could be achieved? Thanks. Hi Ed use an IF statement =IF(Sheet1!A1="yes",1,IF(Sheet1!A1="no",2,"")) Cheers JulieD "Ed Anton" <EdAnton@discussions.microsoft.com> wrote in message news:F885006D-3A1C-47D2-8DB8-BF44C944E2A3@microsoft.com... > I'm referencing cells...

Converting Hours an minutes just into minutes #2
Is thier a formula to use to change hous and minutes, just into minutes ex: 01:30 (1 hour and 30 minutes) into 90 minutes. And how do you format the cells. Thank you Select the cell and change the format to: [m] -- Gary's Student "Six Sigma Blackbelt" wrote: > Is thier a formula to use to change hous and minutes, just into minutes ex: > 01:30 (1 hour and 30 minutes) into 90 minutes. And how do you format the > cells. > > Thank you ...

How do I convert a resume saved as a templ(.docx) to wrd(.doc)
I have a resume that I created and saved as a template (.docx). I want to many company websites that do not accept my resume as a .docx and want me to create a resume as a .doc. Can I convert my resume saved as a template to a regular document? If not, any suggestions? Save As - and change the type to Word 97-2003 format. BTW, .docx is not a template, it's a Word 2007 format. -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "RJ" <RJ@discussions.microsoft.com> wrote in message news:33560928-...

Is this possible? 01-14-05
We are inventory-ing all our Access databases in preparation for converting all to Access 2000 (we still have many 97). Is there any way to tell the Access version of an MDB and an MDE without opening the database and without altering the Windows 'Last Access' date? Also is there any way to tell if there are linked tables without altering the Windows 'Last Access' date? I guess if there is a way to set this date, we could store it, then access the database, then reset it afterwards. Any help or tips most appreciated. There's no way that I'm aware of to open a d...

Convert VBA macro to Applescript
Version: 2008 I don't know if this is even possible. I have an existing VBA macro I use on Word for Windows and I need to get the equivalent functionality running on Word 2008 for Mac. This code needs to show/hide logos in the headers and will be used when the author decides to print onto letterhead or not. <br><br>The basic task breakdown is: <br> 1. Toggle the value of an existing boolean custom document property <br> 2. Search all graphic objects in the headers and if they have a specific text value, make the visibility of the graphic match the custom docume...

Strange problem initialising class members
I have a strange problem initialise base class member variables. I have the following classes: class AFX_EXT_CLASS CChartView : public CAutoScrollView { protected: CChartView( ); CSize m_sizePage; } class CServerChartView : public CChartView { public: CServerChartView( CServerDoc* pDoc ); } CChartView::CChartView( ) { // m_sizePage full of random data m_sizePage = CSize( 0, 0 ); // m_sizePage still full of same random data } CServerChartView::CServerChartView( CServerDoc* pDoc ) : CChartView( ) { // m_sizePage full of random data m_sizePage = CSize( 0, 0...

Class not visible in ClassWizard
Hi all, I have derived a class from CFileDialog with the ClassWizard. Now I want to derive a class from my derived Class, but it is not listed as a possible base class. How can I add this class to the list? Thanks Marco Marco Singer wrote: > Hi all, > > I have derived a class from CFileDialog with the ClassWizard. Now I want to > derive a class from my derived Class, but it is not listed as a possible > base class. How can I add this class to the list? > > Thanks > > Marco > > Sorry, the wizard doesn't do that. Either type it yourself (Project...

Convert Traditional Chinese to Simplified Chinese and vice versa
Can Microsoft's Office 2004 for Mac convert Traditional Chinese to Simplified Chinese and vice versa, and such function available in Word, Excel and Powerpoint? Thanks! Hi Black: No. Sorry, that was a nice simple answer, wasn't it :-) Cheers -- Please reply in the group. Please do NOT email me unless I ask you to. http://jgmcghie.fastmail.com.au/ John McGhie, Consultant Technical Writer McGhie Information Engineering Pty Ltd Sydney, Australia. GMT + 10 Hrs +61 4 1209 1410, mailto:john@mcghie.name "Black" <andy.wai@bocigroup.com> wrote in message news:11770...

For XML Path / used with Pivot
I was able to use the below code example to get the results I was looking for. I put this together using different examples found googling for dynamic cross tab views. Can someone help me understand what is happening in The top part ... FOR XML PATH('') What does the last part... ), 1, 2, '') + ']' mean Any explanation / help is much appreciated. thanks in advance, ...bob DECLARE @listCol VARCHAR(2000) SELECT @listCol = STUFF(( SELECT DISTINCT '],[' + rtrim(convert(char,DateAppended,112) ) FR...

Converting lotus notes emails to outlook
Does Microsoft have a mailbox converter to export Lotus Notes Release 5 emails and folders to a Outlook 2000 .pst file. I want to convert a large ..nsf to a .pst. Kevin C <Kevin C@discussions.microsoft.com> wrote: > Does Microsoft have a mailbox converter to export Lotus Notes Release > 5 emails and folders to a Outlook 2000 .pst file. I want to convert > a large .nsf to a .pst. Microsoft doesn't, but you might find one here: http://www.transend.com/ -- Brian Tillman Thanks. I did find something here. It does cost $, but then there is no free lunch. "Brian ...

2007 GPO install via config.xml
Hi I am attempting to perform an update from 2003 to 2007 Here is my config.xml (edited) <Configuration Product="ProPlus"> <!-- <Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" /> --> <!-- <Logging Type="standard" Path="%temp%" Template="Microsoft Office Professional Plus Setup(*).txt" /> --> <!-- <PIDKEY Value="LICENSE KEY" /> --> <!-- <USERNAME Value="Company Name" /> --> <...

converting old money files to money 2004
I just got a new computer with money 2004 on it. I've used money 99 for years and want to upload or convert all of my files. Is this possible? Yes. But there are certain things you need to be aware of. The old version and new version must be versions for the same locale. (I.e., no M99 UK -> M04 US.) M05 should be out Real Soon Now. M04 will probably be MUCH SLOWER than M99 and the file size will grow marginally. For whatever reason(s), some old files have problems upgrading. Some of these can be solved, some not. There is a trial version of M04 available at http://www.microsoft.co...

How to convert a long to a hWnd?
hi, I tried this : // the long variable is recieved in parameter as varLonghWnd HWND varhWnd; varhWnd = varLonghWnd; but I recieve this error when compiling : error C2440: '=' : cannot convert from 'long' to 'struct HWND__ *' so how can I go from a long (vb giving me the hwnd of a window) to a HWND? thanks ThunderMusic "ThunderMusic" > hi, > I tried this : > > // the long variable is recieved in parameter as varLonghWnd > HWND varhWnd; > > varhWnd = varLonghWnd; varhWnd = (HWND)varLonghWnd; That ought to do it... ok...

Converting Lotus Approach to Access
I have a Lotus Approach db from a client and need to pump it into Access. Anyone know how to do that? I should add that the file is named {Myfile}.APR So there are no .dbf's supplied unless they are "inside" the .APR file. "Sydney Lotterby" <sydney@infosearch.com> wrote in message news:uovep0cmEHA.1152@TK2MSFTNGP11.phx.gbl... > I have a Lotus Approach db from a client and need to pump it into Access. > Anyone know how to do that? > > >-----Original Message----- >I have a Lotus Approach db from a client and need to pump it into Access. &g...

where are xml files?
I read that with 2007 version, document files get separated into different chunks like xml format for text etc. whereas I still see one file .docx. If this file gets corrupted or deleted how do I recover my text? Thanks docx is essentially a zip file. Open it with WinRar. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<>...