populating my object model from XMl file

Discussion in 'XML' started by enigma261@yahoo.com, Dec 23, 2004.

  1. Guest

    Hi,

    I am a XML beginner.
    I need some guidance in intrepreting a XML file
    and then populating my object model.

    Following is an example of the XML file ..

    <Tom>
    <Version>x.0</Version>
    <Ref>
    <Id>5555</Id>
    <SubList>
    <Sub>
    <Type>zzzz</Type>
    </Sub>
    <Sub>
    <Type>tttt</Type>
    </Sub>
    </SubList>
    <VarList>
    <Var>
    <Type>kkkk</Type>
    </Var>
    <Var>
    <Type>mmmm</Type>
    </Var>
    </VarList>
    </Ref>
    </Tom>

    After, I parse this file, I end up with a name-value pair,
    that looks like following

    ..Tom.Version x.0
    ..Tom.Ref.Id 5555
    ..Tom.Ref.SubList.Sub.Type zzzz
    ..Tom.Ref.SubList.Sub.Type tttt
    ..Tom.Ref.VarList.Var.Type kkkk
    ..Tom.Ref.VarList.Var.Type mmmm

    After I have this name-value pair, I would like to populate my object
    model, which looks something like following

    There is a class called "Tom" that has a property called "Version".
    "Tom" has a pointer to another class called "Ref" which in turn
    has a property called "Id". "Ref" also holds two lists each holding
    pointers to "Sub" and "Var".

    This is just an example. But the general model is very similar.

    I need some guidance in populating my object model after I have the
    name-value pair. ( At this point, I don't think it is really an
    XMl issue).
    Any other better way would also be highyl appreciated.

    thanks
    , Dec 23, 2004
    #1
    1. Advertising

  2. wrote:


    > I need some guidance in intrepreting a XML file
    > and then populating my object model.
    >
    > Following is an example of the XML file ..
    >
    > <Tom>
    > <Version>x.0</Version>
    > <Ref>
    > <Id>5555</Id>
    > <SubList>
    > <Sub>
    > <Type>zzzz</Type>
    > </Sub>
    > <Sub>
    > <Type>tttt</Type>
    > </Sub>
    > </SubList>
    > <VarList>
    > <Var>
    > <Type>kkkk</Type>
    > </Var>
    > <Var>
    > <Type>mmmm</Type>
    > </Var>
    > </VarList>
    > </Ref>
    > </Tom>
    >
    > After, I parse this file, I end up with a name-value pair,
    > that looks like following
    >
    > .Tom.Version x.0
    > .Tom.Ref.Id 5555
    > .Tom.Ref.SubList.Sub.Type zzzz
    > .Tom.Ref.SubList.Sub.Type tttt
    > .Tom.Ref.VarList.Var.Type kkkk
    > .Tom.Ref.VarList.Var.Type mmmm
    >
    > After I have this name-value pair, I would like to populate my object
    > model, which looks something like following
    >
    > There is a class called "Tom" that has a property called "Version".
    > "Tom" has a pointer to another class called "Ref" which in turn
    > has a property called "Id". "Ref" also holds two lists each holding
    > pointers to "Sub" and "Var".
    >
    > This is just an example. But the general model is very similar.


    You haven't told us which language you are using, for Java you might
    want to look into XMLBeans:
    <http://xmlbeans.apache.org/>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Dec 23, 2004
    #2
    1. Advertising

  3. Guest

    I am using C++
    thanks
    , Dec 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Philip Battle

    Object Model for XML???

    Philip Battle, Jul 18, 2003, in forum: XML
    Replies:
    2
    Views:
    827
    Martin Honnen
    Jul 19, 2003
  2. Replies:
    1
    Views:
    471
    Andreas Wollschlaeger
    Oct 6, 2006
  3. Jason Shohet

    Populating a treeview contol from an xml file

    Jason Shohet, Jul 21, 2003, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    231
    Manfred Braun
    Jul 22, 2003
  4. Erik Wasser
    Replies:
    5
    Views:
    430
    Peter J. Holzer
    Mar 5, 2006
  5. Billy Smith

    Populating a combobox from an XML file

    Billy Smith, Jul 18, 2005, in forum: Javascript
    Replies:
    2
    Views:
    168
Loading...

Share This Page