katmai539 62 Junior Poster in Training

Hello, i'm working on a xml-style format protocol for question-and-answer applications. The concept is simple: there are just a few types answers possible (just like in real life): open answers which are entered as strings, numeric answers as integers, multiple choice answers and ratings (which are just numeric integers, really, but for the client it's easier to keep those two apart). The questions-xml files are indexed a little like this:

<questions>
	<chapter name="chapter 1">
		<section name="first section">
			<question>
				<q>How are you?</q>
				<a type="multiplechoice">
					<ac>Very well!</ac>
					<ac>Quite good, thank you.</ac>
					<ac>FML!</ac>
				</a>
			</question>
		</section>
	</chapter>
</questions>

Now the reason I split up the questions in chapters and sections is that this protocol is not only aimed at people-related questions but also to things like inspections, mass statistics and such.

The protocol is xml style so not limited to VB.NET, though my priority is to have a questioning application working in VB.

The problem, finally, is that i'm screwing around with XPATHs that exceed my display BIG time. The code looks awful and i'm pretty sure there are more comfortable, cleaner and more flexible ways to accomplish this.

Also, i'm quite unsure about the protocol-definition. Am i walking the right way with this or am i overseeing huge flexibility-flaws?

A full interview-file follows:

<?xml version="1.0" encoding="UTF-8"?>
<interview version="0.1">
	<properties>
		<name>Interview Name</name>
		<publisher>Interview Publisher</publisher>
		<interviewer>Interviewer</interviewer>
		<version>0.1</version>
		<subject>Subject</subject>
		<targets>1</targets>
	</properties>
	<questions>
		<chapter name="First Chapter">
			<section name="First Section">
				<question>
					<q>First Question</q>
					<a type="number">
						<nmin>0</nmin>
						<nmax>1000</nmax>
					</a>
				</question>
				<question>
					<q>Second Question</q>
					<a type="multiplechoice">
						<ac>Choice 1</ac>
						<ac>Choice 2</ac>
					</a>
				</question>
				<question>
					<q>Third Question</q>
					<a type="open"></a>
				</question>
				<question>
					<q>Fourth Question</q>
					<a type="rating">
						<rmin>1</rmin>
						<rmax>10</rmax>
					</a>
				</question>
			</section>
			<section name="Second Section">
				<question>
					<q>Fifth Question</q>
					<a type="number">
						<nmin>0</nmin>
						<nmax>500</nmax>
					</a>
				</question>
			</section>
		</chapter>
		<chapter name="Second Chapter">
			<section name="First Section">
				<question>
					<q>First Question</q>
					<a type="number">
						<nmin>0</nmin>
						<nmax>1000</nmax>
					</a>
				</question>
				<question>
					<q>Second Question</q>
					<a type="multiplechoice">
						<ac>Choice 1</ac>
						<ac>Choice 2</ac>
					</a>
				</question>
				<question>
					<q>Third Question</q>
					<a type="open"></a>
				</question>
				<question>
					<q>Fourth Question</q>
					<a type="rating">
						<rmin>1</rmin>
						<rmax>10</rmax>
					</a>
				</question>
			</section>
			<section name="Second Section">
				<question>
					<q>Fifth Question</q>
					<a type="number">
						<nmin>0</nmin>
						<nmax>500</nmax>
					</a>
				</question>
			</section>
		</chapter>
	</questions>
</interview>

Many thanks,

Katmai