SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot JEmLAC's Avatar
    Join Date
    Apr 2002
    Location
    Kansas City
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML data Islands with irregular data

    I would like to use a data island to work with data that I'm updating with a series of "wizard forms." The examples I've seen on using data islands that have what I'd call regular data. e.g.
    Code:
    <data>
        <record>
            <field1>Value01</field1>
            <field2>Value02</field1>
            <field3>Value03</field1>
            <field4>Value04</field1>
        </record>
        <record>
            <field1>Value05</field1>
            <field2>Value06</field1>
            <field3>Value07</field1>
            <field4>Value08</field1>
        </record>
        <record>
            <field1>Value09</field1>
            <field2>Value10</field1>
            <field3>Value11</field1>
            <field4>Value12</field1>
        </record>
    </data>
    If want to work with irregular data, that is data that does not follow a recurring pattern, how to I refer to fields that are nested a ways in. e.g.
    Code:
    <data>
        <property1>Value01</field1>
        <property2>Value02</field1>
        <property3>Value03</field1>
        <property4>Value04</field1>
        <recordcomplex>
            <property5>Value05</property5>
            <property6>Value06</property5>
            <fields>
                <field1>Value07</field1>
                <field2>Value08</field1>
                <field3>Value09</field1>
                <field4>Value10</field1>
            <fields>
            <fields>
                <field1>Value08</field1>
                <field2>Value09</field1>
                <field3>Value10</field1>
                <field4>Value11</field1>
            <fields>
        </recordcomplex>
        <anotherthing>
            <field5>Value12</field1>
            <field6>Value13</field1>
            <field7>Value14</field1>
            <field8>Value15</field1>
        </anotherthing>
    </data>
    One distinction I've made in my example versus what I've seen is that their examples deal with multiple sets of similar data (CD collections, employees, customers etc.), where mine is a single set of data, albeit complex data.

    Should I even bother? The little bit I've seen makes me think if I could get it to work, it would save me a ton of work! I suspect I need to make sure that no field names duplicate (could be a problem). Could I get to a level by referring to a tag's attribute's value? If anyone has resources that go into detail on this I'd be happy to chase it down.

    Thanks!

    B
    Morning person by habit, not by nature.

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not clear exactly you want to do with the XML, but if you are asking the question "Is it possible for me to store this multi-depth form data as XML and then retrieve desired parts of the XML data via script?" then the answer is "Yes, absolutely". (If that wasn't your intended question, then please elaborate!)


    M@rco


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •