Skip to content
Snippets Groups Projects
Commit aff1f614 authored by srosse's avatar srosse
Browse files

OO-3268: check if version or tool name already exists

parent 7ab002b0
No related branches found
No related tags found
No related merge requests found
...@@ -205,16 +205,25 @@ public class Onyx38ToQtiWorksHandler extends DefaultHandler2 { ...@@ -205,16 +205,25 @@ public class Onyx38ToQtiWorksHandler extends DefaultHandler2 {
private void writeAssessmentElement(String qName, Attributes attributes) private void writeAssessmentElement(String qName, Attributes attributes)
throws XMLStreamException { throws XMLStreamException {
boolean hasToolName = false;
boolean hasVersion = false;
xtw.writeStartElement(qName); xtw.writeStartElement(qName);
int numOfAttributes = attributes.getLength(); int numOfAttributes = attributes.getLength();
for(int i=0;i<numOfAttributes; i++) { for(int i=0;i<numOfAttributes; i++) {
String attrQName = attributes.getQName(i); String attrQName = attributes.getQName(i);
String attrValue = attributes.getValue(i); String attrValue = attributes.getValue(i);
xtw.writeAttribute(attrQName, attrValue); xtw.writeAttribute(attrQName, attrValue);
if("toolName".equals(attrQName)) {
hasToolName = true;
} else if("toolVersion".equals(attrQName)) {
hasVersion = true;
}
} }
xtw.writeAttribute("toolName", "Onyx Editor"); if(!hasToolName) {
if(StringHelper.containsNonWhitespace(version)) { xtw.writeAttribute("toolName", "Onyx Editor");
}
if(!hasVersion && StringHelper.containsNonWhitespace(version)) {
xtw.writeAttribute("toolVersion", version); xtw.writeAttribute("toolVersion", version);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment