Saving XML Data into a Table


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Saving XML Data into a Table

  1. #1
    Vlad Patryshev Guest

    Saving XML Data into a Table


    Well, one can ask a general question: how do we map XML-like data to a relational
    database?

    It is not that complicated if we take a relatively abstract look into the
    nature of the data in XML - there are two types of relationships: "is-an-element-of"
    and "is-an-attribute-of"; normally I would also separate attribute values
    as very separate entities. Thus we have three tables: entities (a.k.a. elements),
    properties (a.k.a. attributes) (name-value-owner triples), and "is-an-element-of"
    many-to-one map.

    In a relational database all these guys should of course have unique ids,
    which are meaningless outside (in XML), since relationships become physical
    once we export the data.

    I implemented this a while ago, adding some inessential tricks for efficiency
    - well, it worked.

    The think one needs least here is a dtd or a schema. These are a threat to
    our freedom.

  2. #2
    David Hopp Guest

    Re: Saving XML Data into a Table


    Very intriguing, Vlad, but a bit sketchy. How do you handle the recursive,
    i.e., unknown depth, issues? How do you walk the tree? As I recall, Oracle
    has a bill-of-materials facility that understands parent and child, but I
    haven't used it for years. Does SQLserver have something to handle recursion?

  3. #3
    Vlad Patryshev Guest

    Re: Saving XML Data into a Table


    "David Hopp" <dhopp@cato.com> wrote:
    >
    >Very intriguing, Vlad, but a bit sketchy. How do you handle the recursive,
    >i.e., unknown depth, issues? How do you walk the tree? As I recall, Oracle
    >has a bill-of-materials facility that understands parent and child, but

    I
    >haven't used it for years. Does SQLserver have something to handle recursion?


    David, any unknown depth consists of repetition of the same kind of relationship,
    right? This means that we only have to register "parent-child"-like relationsships.
    Actually, in real life, there are more, and an element can be a member of
    different collections. This still can be reflected in an XML (but this goes
    in the opposite direction now.)

    I have a sketch of an article on this here: http://www.patryshev.com/dev/Generic...DataModel.htm;
    there was an implementation too that worked at least with mySQL... as if
    anybody was interested. The time for it seems to have gone now, with native
    XML databases appearing all around.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center