ClarkePeters
IS-IT--Management
I'm doing a CMS for our distance education program and haven't programmed in years. I have a very basic xml structure for the test maker/tracker module for instructors.
My current structure seems to not work well in DOM or XPath--when I do a nodeValue I get the current element text and all descendants' text as well.
I have my current structure and two options I'll list below. And I'm soliciting your personal preference between them.
Here is my basic structure as it stands now. (which will be used to generate an xforms form after some php Dom/xpath manipulation):
<test>
<instructions> Choose one.
<question> What is the capital of Detroit?
<not> New York City </not>
<not> London </not>
<answer> this is a trick question. </answer>
//... limitless choices....
</question> //...repeating structure....
</instructions> //....repeating structure...
</test> //root
I noticed most xml docs don't put text in higher level elements--is this an issue? So I thought of grouping like this.
<test>
<instruction_set>
<instructions> Choose one.</instructions>
<question_set>
<question>What is the capital of Detroit? </question>
<answer_set>
<not> New York City </not>
<not> London </not>
<answer> this is a trick question. </answer>
</answer_set> // only one set per question.
</question> // ...
</question_set> // ...
</instructions> // ...
</instruction_set> // ...
</test>
Now a simpler model, but not so true to real world grouping/levels would be:
<test>
<instruction_set>
<instructions> Choose one.</instructions>
<question>What is the capital of Detroit? </question>
<not> New York City </not>
<not> London </not>
<answer> this is a trick question. </answer>
</question>
</instructions>
</instruction_set>
// ...
</test>
I'll be transforming this to xforms for online testing. I'll also need to alter the structure on the xforms according to instructor choice... i.e. I'll need to rearrange the answers from their original order (and possibly the questions), and of course, all elements will still need to be matched with their original instuction/question set after the rearranging.
I'm not asking for anyone to go to any length for advice (i'll take what your in the mood for )
Just eyeball this and tell me which structure you would personally prefer.
sincerely,
clarkepeters
My current structure seems to not work well in DOM or XPath--when I do a nodeValue I get the current element text and all descendants' text as well.
I have my current structure and two options I'll list below. And I'm soliciting your personal preference between them.
Here is my basic structure as it stands now. (which will be used to generate an xforms form after some php Dom/xpath manipulation):
<test>
<instructions> Choose one.
<question> What is the capital of Detroit?
<not> New York City </not>
<not> London </not>
<answer> this is a trick question. </answer>
//... limitless choices....
</question> //...repeating structure....
</instructions> //....repeating structure...
</test> //root
I noticed most xml docs don't put text in higher level elements--is this an issue? So I thought of grouping like this.
<test>
<instruction_set>
<instructions> Choose one.</instructions>
<question_set>
<question>What is the capital of Detroit? </question>
<answer_set>
<not> New York City </not>
<not> London </not>
<answer> this is a trick question. </answer>
</answer_set> // only one set per question.
</question> // ...
</question_set> // ...
</instructions> // ...
</instruction_set> // ...
</test>
Now a simpler model, but not so true to real world grouping/levels would be:
<test>
<instruction_set>
<instructions> Choose one.</instructions>
<question>What is the capital of Detroit? </question>
<not> New York City </not>
<not> London </not>
<answer> this is a trick question. </answer>
</question>
</instructions>
</instruction_set>
// ...
</test>
I'll be transforming this to xforms for online testing. I'll also need to alter the structure on the xforms according to instructor choice... i.e. I'll need to rearrange the answers from their original order (and possibly the questions), and of course, all elements will still need to be matched with their original instuction/question set after the rearranging.
I'm not asking for anyone to go to any length for advice (i'll take what your in the mood for )
Just eyeball this and tell me which structure you would personally prefer.
sincerely,
clarkepeters