DXL
1 program
Added 2026-03-05T12:00:00Z
Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled
Evidence
Report issue
View issues
Aliases: DOORS eXtension Language
Provenance: commit 29fd507423 · authored 2026-03-05T01:04:53+01:00 · agent claude-code · model claude-sonnet-4-6
Sources mentioning this language
3 sources · pl_id:
pl/dxlRelated languages
LLM-contributed programs
Export Module to JSON
Provenance: commit 29fd507423 · authored 2026-03-05T01:04:53+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
// Export current module to JSON file
/*
* Export current module to JSON file
Author: M. Serdar Karaman
*/
//********************************** History ******************************
// M. Serdar Karaman 2025-02-05 Initial version of this script
pragma runLim, 0 // disable timeout limit
pragma encoding, "utf-8"
string myEscape(string str) {
int str_index;
Buffer escaped = create;
escaped = "";
for (str_index = 0; str_index < length(str); str_index++) {
char c = str[str_index];
if (c == '\n') {
escaped += "\\n";
} else if (c == '\t') {
escaped += "\\t";
} else if (c == '"') {
escaped += "\\\"";
} else if (c == '\\') {
escaped += "\\\\";
} else if (c == '\b') {
escaped += "\\b";
} else if (c == '\f') {
escaped += "\\f";
} else if (c == '\r') {
escaped += "\\r";
} else {
escaped += c;
}
}
return stringOf(escaped);
}
string urlEscape(string str) {
int str_index;
Buffer escaped = create;
escaped = "";
for (str_index = 0; str_index < length(str); str_index++) {
char c = str[str_index];
if (c == ' ') {
escaped += "%20";
} else if (c == '�') {
escaped += "%C3%84";
} else if (c == '�') {
escaped += "%C3%96";
} else if (c == '�') {
escaped += "%C3%9C";
} else if (c == '�') {
escaped += "%C3%A4";
} else if (c == '�') {
escaped += "%C3%B6";
} else if (c == '�') {
escaped += "%C3%BC";
} else if (c == '�') {
escaped += "%C3%9F";
} else {
escaped += c;
}
}
return stringOf(escaped);
}
string getFileName(string moduleName) {
DB fileNameBox = create(current, "Select Destination to Export", styleCentered|styleFixed);
label(fileNameBox , "Please enter the file path");
DBE fn = fileName(fileNameBox , "Output-File", moduleName, "*.json", "JSON", false);
block fileNameBox;
string fileName = get(fn);
return fileName;
}
string getFileName() {
return getFileName("fileName");
}
//////////////////////// MAIN PROGRAM ////////////////////////
Object o;
Module m;
m = current Module;
string proj = name(getParentFolder(m));
proj = urlEscape(proj);
string mod = name(m);
mod = urlEscape(mod);
Buffer buf = create;
buf += "[";
int count = 0;
for o in m do
{
int lvl = level(o);
string txt = o.(NLS_("Object Text"));
txt = myEscape(txt);
string heading = o."Object Heading";
heading = myEscape(heading);
string objId = identifier(o);
string meansOfVerification = myEscape(o."Means of Verification" "");
string safetyRequirement = myEscape(o."Safety Requirement" "");
if (count > 0) {
buf += ",";
}
buf += "{\"Req ID\":\"" objId "\",\"heading\":\"" heading "\",\"text\":\"" txt "\",\"level\":" lvl ",\"Means Of Verification\":\"" meansOfVerification "\",\"Safety Requirement\":\"" safetyRequirement "\"}";
count += 1;
}
buf += "]";
string tmpName;
tmpName = "export_" name(m);
string fname = getFileName(tmpName);
Stream out = write(fname, CP_UTF8);
out << buf;
close out;
delete(buf);
print "Successfully exported " count " requirements to " fname;
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)