Skip to main content
deleted 12 characters in body
Source Link

I've been tasked with taking a sample of survey results that are stored in CSV and to convert them to XML.

CSV Data

I'm still fairly new to XML, but have come up with a couple of layouts I could use and was hoping I could get some advice on what way is best to go.

1)

<survey>
    <response>
        <id>1</id>
        <question>
            <title>When did you start playing Pokemon Go?</title>
            <answer>June</answer>
        </question>
        <question>
            <title>What type of phone/OS do you play on?</title>
            <answer>Android</answer>
        </question>
        <question>
            <title>What team are you on?</title>
            <answer>Mystic (Blue)</answer>
        </question>
        <question>
            <title>What Level Are You?</title>
            <answer>29</answer>
        </question>
        <question>
            <title>How many pokemon have you caught?</title>
            <answer>0 to 1000</answer>
        </question>
        <question>
            <title>How many KM have you traveled? (Jogger medal)</title>
            <answer>Bronze</answer>
        </question>
    </response>
    ... more responses ...
</survey>
<survey>
    <response id="1">
        <answer question="1">June</answer>
        <answer question="2">Android</answer>
        <answer question="3">Mystic (Blue)</answer>
        <answer question="4">29</answer>
        <answer question="5">question="1"0question="5">0 to 1000</answer>
        <answer question="6">Bronze</answer>
    </response>
    ... more responses ...
</survey>

Should I include the question text at all, since it will be repeated for every response?

I will be using a XSD file to put restrictions on what the answers can be and then transforming it using an XSLT to display the data in charts/tables.

I've been tasked with taking a sample of survey results that are stored in CSV and to convert them to XML.

CSV Data

I'm still fairly new to XML, but have come up with a couple of layouts I could use and was hoping I could get some advice on what way is best to go.

1)

<survey>
    <response>
        <id>1</id>
        <question>
            <title>When did you start playing Pokemon Go?</title>
            <answer>June</answer>
        </question>
        <question>
            <title>What type of phone/OS do you play on?</title>
            <answer>Android</answer>
        </question>
        <question>
            <title>What team are you on?</title>
            <answer>Mystic (Blue)</answer>
        </question>
        <question>
            <title>What Level Are You?</title>
            <answer>29</answer>
        </question>
        <question>
            <title>How many pokemon have you caught?</title>
            <answer>0 to 1000</answer>
        </question>
        <question>
            <title>How many KM have you traveled? (Jogger medal)</title>
            <answer>Bronze</answer>
        </question>
    </response>
    ... more responses ...
</survey>
<survey>
    <response id="1">
        <answer question="1">June</answer>
        <answer question="2">Android</answer>
        <answer question="3">Mystic (Blue)</answer>
        <answer question="4">29</answer>
        <answer question="5">question="1"0 to 1000</answer>
        <answer question="6">Bronze</answer>
    </response>
    ... more responses ...
</survey>

Should I include the question text at all, since it will be repeated for every response?

I will be using a XSD file to put restrictions on what the answers can be and then transforming it using an XSLT to display the data in charts/tables.

I've been tasked with taking a sample of survey results that are stored in CSV and to convert them to XML.

CSV Data

I'm still fairly new to XML, but have come up with a couple of layouts I could use and was hoping I could get some advice on what way is best to go.

1)

<survey>
    <response>
        <id>1</id>
        <question>
            <title>When did you start playing Pokemon Go?</title>
            <answer>June</answer>
        </question>
        <question>
            <title>What type of phone/OS do you play on?</title>
            <answer>Android</answer>
        </question>
        <question>
            <title>What team are you on?</title>
            <answer>Mystic (Blue)</answer>
        </question>
        <question>
            <title>What Level Are You?</title>
            <answer>29</answer>
        </question>
        <question>
            <title>How many pokemon have you caught?</title>
            <answer>0 to 1000</answer>
        </question>
        <question>
            <title>How many KM have you traveled? (Jogger medal)</title>
            <answer>Bronze</answer>
        </question>
    </response>
    ... more responses ...
</survey>
<survey>
    <response id="1">
        <answer question="1">June</answer>
        <answer question="2">Android</answer>
        <answer question="3">Mystic (Blue)</answer>
        <answer question="4">29</answer>
        <answer question="5">0 to 1000</answer>
        <answer question="6">Bronze</answer>
    </response>
    ... more responses ...
</survey>

Should I include the question text at all, since it will be repeated for every response?

I will be using a XSD file to put restrictions on what the answers can be and then transforming it using an XSLT to display the data in charts/tables.

Source Link

Storing survey data from csv to xml

I've been tasked with taking a sample of survey results that are stored in CSV and to convert them to XML.

CSV Data

I'm still fairly new to XML, but have come up with a couple of layouts I could use and was hoping I could get some advice on what way is best to go.

1)

<survey>
    <response>
        <id>1</id>
        <question>
            <title>When did you start playing Pokemon Go?</title>
            <answer>June</answer>
        </question>
        <question>
            <title>What type of phone/OS do you play on?</title>
            <answer>Android</answer>
        </question>
        <question>
            <title>What team are you on?</title>
            <answer>Mystic (Blue)</answer>
        </question>
        <question>
            <title>What Level Are You?</title>
            <answer>29</answer>
        </question>
        <question>
            <title>How many pokemon have you caught?</title>
            <answer>0 to 1000</answer>
        </question>
        <question>
            <title>How many KM have you traveled? (Jogger medal)</title>
            <answer>Bronze</answer>
        </question>
    </response>
    ... more responses ...
</survey>
<survey>
    <response id="1">
        <answer question="1">June</answer>
        <answer question="2">Android</answer>
        <answer question="3">Mystic (Blue)</answer>
        <answer question="4">29</answer>
        <answer question="5">question="1"0 to 1000</answer>
        <answer question="6">Bronze</answer>
    </response>
    ... more responses ...
</survey>

Should I include the question text at all, since it will be repeated for every response?

I will be using a XSD file to put restrictions on what the answers can be and then transforming it using an XSLT to display the data in charts/tables.