I am looking for converting normal xml from a LMS Quiz with multiple choice questions to QTIv2.0 compliant XML. I have searched the web through and see XSLT is a possible option.having just started learning coding 5 months ago am looking for some help or guidance on how to go about the conversion.
I proposed XSLT and it is not accepted.I am writing a dot net code to transform an XML file.
I've taken this sample as a basis.
private static string XmlParamsWriterForLogin(string headerId, string courseType, string scheduleID, string courseId, string nric, string attendance, string result, string score) { using (var sw = new StringWriter()) { using (var xw = XmlWriter.Create(sw)) { xw.WriteStartDocument();
// start dataInterface
xw.WriteStartElement("dataInterface");
// start header
xw.WriteStartElement("header");
xw.WriteElementString("id", headerId);
xw.WriteElementString("from", "LMS");
xw.WriteElementString("to", "FMS");
xw.WriteElementString("interfaceType", "LMS_FMS_STORE_CLASS_RESULT");
xw.WriteElementString("sentTime", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
xw.WriteElementString("numOfEntries", "1");
xw.WriteElementString("deliveryMode", "Synchronously");
xw.WriteElementString("concurrency", "False");
// end header
xw.WriteEndElement();
// start content
xw.WriteStartElement("content");
// start contentItem
xw.WriteStartElement("contentItem");
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "courseType");
xw.WriteElementString("fieldValue", courseType);
xw.WriteEndElement();
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "scheduleID");
xw.WriteElementString("fieldValue", scheduleID);
xw.WriteEndElement();
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "courseID");
xw.WriteElementString("fieldValue", courseId);
xw.WriteEndElement();
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "nric");
xw.WriteElementString("fieldValue", nric);
xw.WriteEndElement();
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "attendance");
xw.WriteElementString("fieldValue", attendance);
xw.WriteEndElement();
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "result");
xw.WriteElementString("fieldValue", result);
xw.WriteEndElement();
xw.WriteStartElement("field");
xw.WriteElementString("fieldName", "score");
xw.WriteElementString("fieldValue", score);
xw.WriteEndElement();
// end contentItem
xw.WriteEndElement();
// for error
xw.WriteStartElement("contentItem");
xw.WriteEndElement();
// end content
xw.WriteEndElement();
// end dataInterface
xw.WriteEndElement();
xw.WriteEndDocument();
}
return sw.ToString();
}
}
I still dont see how it is going to work though.