Comparing version 0.3.6 to 0.3.7
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"name": "jgexml", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "The Just-Good-Enough XML Toolkit", | ||
@@ -5,0 +5,0 @@ "main": "jgeXml.js", |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -71,3 +71,3 @@ # jgeXml - The Just-Good-Enough XML Toolkit | ||
See testx2x for parsing XML to XML, testx2j for parsing XML to JSON, testj2x for converting JSON to XML, testj2y for converting JSON to YAML, testfrag for writing XML fragments, testjpath for JSONPath examples, testjsont for JSONT examples and pullparser / pushparser for how to set up and run the parser. | ||
See `testx2x` for parsing XML to XML, `testx2j` for parsing XML to JSON, `testj2x` for converting JSON to XML, `testj2y` for converting JSON to YAML, `testfrag` for writing XML fragments, `testjpath` for JSONPath examples, `testjsont` for JSONT examples and `pullparser` / `pushparser` for how to set up and run the parser. | ||
@@ -74,0 +74,0 @@ [twitter-image]: https://img.shields.io/twitter/url/http/PermittedSoc.svg?style=social |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -26,5 +26,5 @@ 'use strict'; | ||
function diff(s1,s2) { | ||
var red = '\x1b[31m'; | ||
var green = '\x1b[32m'; | ||
var normal = '\x1b[0m'; | ||
var red = process.env.NODE_DISABLE_COLORS ? '' : '\x1b[31m'; | ||
var green = process.env.NODE_DISABLE_COLORS ? '' : '\x1b[32m'; | ||
var normal = process.env.NODE_DISABLE_COLORS ? '' : '\x1b[0m'; | ||
var l1 = lines(s1); | ||
@@ -31,0 +31,0 @@ var l2 = lines(s2); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -26,3 +26,3 @@ 'use strict'; | ||
var laxUris = (filename.indexOf('.lax')>=0); | ||
var json = xsd.getJsonSchema(obj,filename,'',laxUris); | ||
var json = xsd.getJsonSchema(obj,filename,'',laxUris,'xs:'); | ||
console.log(); | ||
@@ -36,2 +36,2 @@ //console.log(JSON.stringify(json,null,2)); | ||
fs.writeFileSync(outfile,JSON.stringify(json,null,2),'utf8'); | ||
} | ||
} |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
228
xsd2json.js
@@ -10,4 +10,5 @@ 'use strict'; | ||
var defaultNameSpace = ''; | ||
var xsPrefix = 'xs:'; | ||
function reset(attrPrefix,laxURIprocessing) { | ||
function reset(attrPrefix,laxURIprocessing,newXsPrefix) { | ||
target = null; | ||
@@ -17,2 +18,3 @@ attributePrefix = attrPrefix; | ||
defaultNameSpace = ''; | ||
xsPrefix = newXsPrefix||'xs:'; | ||
} | ||
@@ -117,22 +119,22 @@ | ||
} | ||
else if (type == 'xs:integer') { | ||
else if (type == xsPrefix+'integer') { | ||
result.type = 'integer'; | ||
} | ||
else if (type == 'xs:positiveInteger') { | ||
else if (type == xsPrefix+'positiveInteger') { | ||
result.type = 'integer'; | ||
result.minimum = 1; | ||
} | ||
else if (type == 'xs:nonPositiveInteger') { | ||
else if (type == xsPrefix+'nonPositiveInteger') { | ||
result.type = 'integer'; | ||
result.maximum = 0; | ||
} | ||
else if (type == 'xs:negativeInteger') { | ||
else if (type == xsPrefix+'negativeInteger') { | ||
result.type = 'integer'; | ||
result.maximum = -1; | ||
} | ||
else if (type == 'xs:nonNegativeInteger') { | ||
else if (type == xsPrefix+'nonNegativeInteger') { | ||
result.type = 'integer'; | ||
result.minimum = 0; | ||
} | ||
else if (type == 'xs:unsignedInt') { | ||
else if (type == xsPrefix+'unsignedInt') { | ||
result.type = 'integer'; | ||
@@ -142,3 +144,3 @@ result.minimum = 0; | ||
} | ||
else if (type == 'xs:unsignedShort') { | ||
else if (type == xsPrefix+'unsignedShort') { | ||
result.type = 'integer'; | ||
@@ -148,3 +150,3 @@ result.minimum = 0; | ||
} | ||
else if (type == 'xs:unsignedByte') { | ||
else if (type == xsPrefix+'unsignedByte') { | ||
result.type = 'integer'; | ||
@@ -154,3 +156,3 @@ result.minimum = 0; | ||
} | ||
else if (type == 'xs:int') { | ||
else if (type == xsPrefix+'int') { | ||
result.type = 'integer'; | ||
@@ -160,3 +162,3 @@ result.maximum = 2147483647; | ||
} | ||
else if (type == 'xs:short') { | ||
else if (type == xsPrefix+'short') { | ||
result.type = 'integer'; | ||
@@ -166,3 +168,3 @@ result.maximum = 32767; | ||
} | ||
else if (type == 'xs:byte') { | ||
else if (type == xsPrefix+'byte') { | ||
result.type = 'integer'; | ||
@@ -172,6 +174,6 @@ result.maximum = 127; | ||
} | ||
else if (type == 'xs:long') { | ||
else if (type == xsPrefix+'long') { | ||
result.type = 'integer'; | ||
} | ||
else if (type == 'xs:unsignedLong') { | ||
else if (type == xsPrefix+'unsignedLong') { | ||
result.type = 'integer'; | ||
@@ -181,21 +183,21 @@ result.minimum = 0; | ||
if (type == 'xs:string') result.type = 'string'; | ||
if (type == 'xs:NMTOKEN') result.type = 'string'; | ||
if (type == 'xs:NMTOKENS') result.type = 'string'; | ||
if (type == 'xs:ENTITY') result.type = 'string'; | ||
if (type == 'xs:ENTITIES') result.type = 'string'; | ||
if (type == 'xs:ID') result.type = 'string'; | ||
if (type == 'xs:IDREF') result.type = 'string'; | ||
if (type == 'xs:IDREFS') result.type = 'string'; | ||
if (type == 'xs:NOTATION') result.type = 'string'; | ||
if (type == 'xs:token') result.type = 'string'; | ||
if (type == 'xs:Name') result.type = 'string'; | ||
if (type == 'xs:NCName') result.type = 'string'; | ||
if (type == 'xs:QName') result.type = 'string'; | ||
if (type == 'xs:normalizedString') result.type = 'string'; | ||
if (type == 'xs:base64Binary') { | ||
if (type == xsPrefix+'string') result.type = 'string'; | ||
if (type == xsPrefix+'NMTOKEN') result.type = 'string'; | ||
if (type == xsPrefix+'NMTOKENS') result.type = 'string'; | ||
if (type == xsPrefix+'ENTITY') result.type = 'string'; | ||
if (type == xsPrefix+'ENTITIES') result.type = 'string'; | ||
if (type == xsPrefix+'ID') result.type = 'string'; | ||
if (type == xsPrefix+'IDREF') result.type = 'string'; | ||
if (type == xsPrefix+'IDREFS') result.type = 'string'; | ||
if (type == xsPrefix+'NOTATION') result.type = 'string'; | ||
if (type == xsPrefix+'token') result.type = 'string'; | ||
if (type == xsPrefix+'Name') result.type = 'string'; | ||
if (type == xsPrefix+'NCName') result.type = 'string'; | ||
if (type == xsPrefix+'QName') result.type = 'string'; | ||
if (type == xsPrefix+'normalizedString') result.type = 'string'; | ||
if (type == xsPrefix+'base64Binary') { | ||
result.type = 'string'; | ||
result.format = 'byte'; | ||
} | ||
if (type == 'xs:hexBinary') { | ||
if (type == xsPrefix+'hexBinary') { | ||
result.type = 'string'; | ||
@@ -205,37 +207,37 @@ result.format = '^[0-9,a-f,A-F]*'; | ||
if (type == 'xs:boolean') result.type = 'boolean'; | ||
if (type == xsPrefix+'boolean') result.type = 'boolean'; | ||
if (type == 'xs:date') { | ||
if (type == xsPrefix+'date') { | ||
result.type = 'string'; | ||
result.pattern = '^[0-9]{4}\-[0-9]{2}\-[0-9]{2}.*$'; //timezones | ||
} | ||
else if (type == 'xs:dateTime') { | ||
else if (type == xsPrefix+'dateTime') { | ||
result.type = 'string'; | ||
result.format = 'date-time'; | ||
} | ||
else if (type == 'xs:time') { | ||
else if (type == xsPrefix+'time') { | ||
result.type = 'string'; | ||
result.pattern = '^[0-9]{2}\:[0-9]{2}:[0-9]{2}.*$'; // timezones | ||
} | ||
else if (type == 'xs:duration') { | ||
else if (type == xsPrefix+'duration') { | ||
result.type = 'string'; | ||
result.pattern = '^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$'; | ||
} | ||
else if (type == 'xs:gDay') { | ||
else if (type == xsPrefix+'gDay') { | ||
result.type = 'string'; | ||
result.pattern = '[0-9]{2}'; | ||
} | ||
else if (type == 'xs:gMonth') { | ||
else if (type == xsPrefix+'gMonth') { | ||
result.type = 'string'; | ||
result.pattern = '[0-9]{2}'; | ||
} | ||
else if (type == 'xs:gMonthDay') { | ||
else if (type == xsPrefix+'gMonthDay') { | ||
result.type = 'string'; | ||
result.pattern = '[0-9]{2}\-[0-9]{2}'; | ||
} | ||
else if (type == 'xs:gYear') { | ||
else if (type == xsPrefix+'gYear') { | ||
result.type = 'string'; | ||
result.pattern = '[0-9]{4}'; | ||
} | ||
else if (type == 'xs:gYearMonth') { | ||
else if (type == xsPrefix+'gYearMonth') { | ||
result.type = 'string'; | ||
@@ -245,3 +247,3 @@ result.pattern = '[0-9]{4}\-[0-9]{2}'; | ||
if (type == 'xs:language') { | ||
if (type == xsPrefix+'language') { | ||
result.type = 'string'; | ||
@@ -251,10 +253,10 @@ result.pattern = '[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*'; | ||
if (type == 'xs:decimal') { | ||
if (type == xsPrefix+'decimal') { | ||
result.type = 'number'; | ||
} | ||
else if (type == 'xs:double') { | ||
else if (type == xsPrefix+'double') { | ||
result.type = 'number'; | ||
result.format = 'double'; | ||
} | ||
else if (type == 'xs:float') { | ||
else if (type == xsPrefix+'float') { | ||
result.type = 'number'; | ||
@@ -264,3 +266,3 @@ result.format = 'float'; | ||
if (type == 'xs:anyURI') { | ||
if (type == xsPrefix+'anyURI') { | ||
result.type = 'string'; | ||
@@ -301,8 +303,8 @@ if (!laxURIs) { | ||
if ((key == "xs:any") || (key == "xs:anyAttribute")) { | ||
if ((key == xsPrefix+"any") || (key == xsPrefix+"anyAttribute")) { | ||
if (target) target.additionalProperties = true; // target should always be defined at this point | ||
} | ||
if (element["xs:annotation"]) { | ||
doc = element["xs:annotation"]["xs:documentation"]; | ||
if (element[xsPrefix+"annotation"]) { | ||
doc = element[xsPrefix+"annotation"][xsPrefix+"documentation"]; | ||
} | ||
@@ -316,18 +318,18 @@ | ||
} | ||
else if ((element["@name"]) && (element["xs:simpleType"])) { | ||
type = element["xs:simpleType"]["xs:restriction"]["@base"]; | ||
simpleType = element["xs:simpleType"]["xs:restriction"]; | ||
if (element["xs:simpleType"]["xs:annotation"]) { | ||
simpleType["xs:annotation"] = element["xs:simpleType"]["xs:annotation"]; | ||
else if ((element["@name"]) && (element[xsPrefix+"simpleType"])) { | ||
type = element[xsPrefix+"simpleType"][xsPrefix+"restriction"]["@base"]; | ||
simpleType = element[xsPrefix+"simpleType"][xsPrefix+"restriction"]; | ||
if (element[xsPrefix+"simpleType"][xsPrefix+"annotation"]) { | ||
simpleType[xsPrefix+"annotation"] = element[xsPrefix+"simpleType"][xsPrefix+"annotation"]; | ||
} | ||
} | ||
else if ((element["@name"]) && (element["xs:restriction"])) { | ||
type = element["xs:restriction"]["@base"]; | ||
simpleType = element["xs:restriction"]; | ||
if (element["xs:annotation"]) { | ||
simpleType["xs:annotation"] = element["xs:annotation"]; | ||
else if ((element["@name"]) && (element[xsPrefix+"restriction"])) { | ||
type = element[xsPrefix+"restriction"]["@base"]; | ||
simpleType = element[xsPrefix+"restriction"]; | ||
if (element[xsPrefix+"annotation"]) { | ||
simpleType[xsPrefix+"annotation"] = element[xsPrefix+"annotation"]; | ||
} | ||
} | ||
else if ((element["xs:extension"]) && (element["xs:extension"]["@base"])) { | ||
type = element["xs:extension"]["@base"]; | ||
else if ((element[xsPrefix+"extension"]) && (element[xsPrefix+"extension"]["@base"])) { | ||
type = element[xsPrefix+"extension"]["@base"]; | ||
var tempType = finaliseType(mapType(type)); | ||
@@ -351,4 +353,4 @@ if (!tempType["$ref"]) { | ||
} | ||
else if (element["xs:union"]) { | ||
var types = element["xs:union"]["@memberTypes"].split(' '); | ||
else if (element[xsPrefix+"union"]) { | ||
var types = element[xsPrefix+"union"]["@memberTypes"].split(' '); | ||
type = []; | ||
@@ -359,3 +361,3 @@ for (var t in types) { | ||
} | ||
else if (element["xs:list"]) { | ||
else if (element[xsPrefix+"list"]) { | ||
type = 'string'; | ||
@@ -401,3 +403,3 @@ } | ||
// handle @ref / attributeGroups | ||
if ((key == "xs:attributeGroup") && (element["@ref"])) { // || (name == '$ref')) { | ||
if ((key == xsPrefix+"attributeGroup") && (element["@ref"])) { // || (name == '$ref')) { | ||
if (!target.anyOf) target.anyOf = []; | ||
@@ -414,7 +416,7 @@ var newt = {}; | ||
if ((parent["xs:annotation"]) && ((parent["xs:annotation"]["xs:documentation"]))) { | ||
target.description = parent["xs:annotation"]["xs:documentation"]; | ||
if ((parent[xsPrefix+"annotation"]) && ((parent[xsPrefix+"annotation"][xsPrefix+"documentation"]))) { | ||
target.description = parent[xsPrefix+"annotation"][xsPrefix+"documentation"]; | ||
} | ||
if ((element["xs:annotation"]) && ((element["xs:annotation"]["xs:documentation"]))) { | ||
target.description = (target.description ? target.decription + '\n' : '') + element["xs:annotation"]["xs:documentation"]; | ||
if ((element[xsPrefix+"annotation"]) && ((element[xsPrefix+"annotation"][xsPrefix+"documentation"]))) { | ||
target.description = (target.description ? target.decription + '\n' : '') + element[xsPrefix+"annotation"][xsPrefix+"documentation"]; | ||
} | ||
@@ -424,7 +426,7 @@ | ||
if (element["xs:simpleType"] && element["xs:simpleType"]["xs:restriction"] && element["xs:simpleType"]["xs:restriction"]["xs:enumeration"]) { | ||
var enumSource = element["xs:simpleType"]["xs:restriction"]["xs:enumeration"]; | ||
if (element[xsPrefix+"simpleType"] && element[xsPrefix+"simpleType"][xsPrefix+"restriction"] && element[xsPrefix+"simpleType"][xsPrefix+"restriction"][xsPrefix+"enumeration"]) { | ||
var enumSource = element[xsPrefix+"simpleType"][xsPrefix+"restriction"][xsPrefix+"enumeration"]; | ||
} | ||
else if (element["xs:restriction"] && element["xs:restriction"]["xs:enumeration"]) { | ||
var enumSource = element["xs:restriction"]["xs:enumeration"]; | ||
else if (element[xsPrefix+"restriction"] && element[xsPrefix+"restriction"][xsPrefix+"enumeration"]) { | ||
var enumSource = element[xsPrefix+"restriction"][xsPrefix+"enumeration"]; | ||
} | ||
@@ -437,7 +439,7 @@ | ||
typeData["enum"].push(enumSource[i]["@value"]); | ||
if ((enumSource[i]["xs:annotation"]) && (enumSource[i]["xs:annotation"]["xs:documentation"])) { | ||
if ((enumSource[i][xsPrefix+"annotation"]) && (enumSource[i][xsPrefix+"annotation"][xsPrefix+"documentation"])) { | ||
if (typeData.description) { | ||
typeData.description += ''; | ||
} | ||
typeData.description += enumSource[i]["@value"]+': '+enumSource[i]["xs:annotation"]["xs:documentation"]; | ||
typeData.description += enumSource[i]["@value"]+': '+enumSource[i][xsPrefix+"annotation"][xsPrefix+"documentation"]; | ||
} | ||
@@ -466,7 +468,7 @@ } | ||
if (simpleType) { | ||
if (simpleType["xs:minLength"]) typeData.minLength = parseInt(simpleType["xs:minLength"]["@value"],10); | ||
if (simpleType["xs:maxLength"]) typeData.maxLength = parseInt(simpleType["xs:maxLength"]["@value"],10); | ||
if (simpleType["xs:pattern"]) typeData.pattern = simpleType["xs:pattern"]["@value"]; | ||
if ((simpleType["xs:annotation"]) && (simpleType["xs:annotation"]["xs:documentation"])) { | ||
typeData.description = simpleType["xs:annotation"]["xs:documentation"]; | ||
if (simpleType[xsPrefix+"minLength"]) typeData.minLength = parseInt(simpleType[xsPrefix+"minLength"]["@value"],10); | ||
if (simpleType[xsPrefix+"maxLength"]) typeData.maxLength = parseInt(simpleType[xsPrefix+"maxLength"]["@value"],10); | ||
if (simpleType[xsPrefix+"pattern"]) typeData.pattern = simpleType[xsPrefix+"pattern"]["@value"]; | ||
if ((simpleType[xsPrefix+"annotation"]) && (simpleType[xsPrefix+"annotation"][xsPrefix+"documentation"])) { | ||
typeData.description = simpleType[xsPrefix+"annotation"][xsPrefix+"documentation"]; | ||
} | ||
@@ -490,3 +492,3 @@ } | ||
function moveAttributes(obj,parent,key) { | ||
if (key == 'xs:attribute') { | ||
if (key == xsPrefix+'attribute') { | ||
@@ -497,9 +499,9 @@ obj[key] = toArray(obj[key]); | ||
if (obj["xs:sequence"] && obj["xs:sequence"]["xs:element"]) { | ||
obj["xs:sequence"]["xs:element"] = toArray(obj["xs:sequence"]["xs:element"]); | ||
target = obj["xs:sequence"]["xs:element"]; | ||
if (obj[xsPrefix+"sequence"] && obj[xsPrefix+"sequence"][xsPrefix+"element"]) { | ||
obj[xsPrefix+"sequence"][xsPrefix+"element"] = toArray(obj[xsPrefix+"sequence"][xsPrefix+"element"]); | ||
target = obj[xsPrefix+"sequence"][xsPrefix+"element"]; | ||
} | ||
if (obj["xs:choice"] && obj["xs:choice"]["xs:element"]) { | ||
obj["xs:choice"]["xs:element"] = toArray(obj["xs:choice"]["xs:element"]); | ||
target = obj["xs:choice"]["xs:element"]; | ||
if (obj[xsPrefix+"choice"] && obj[xsPrefix+"choice"][xsPrefix+"element"]) { | ||
obj[xsPrefix+"choice"][xsPrefix+"element"] = toArray(obj[xsPrefix+"choice"][xsPrefix+"element"]); | ||
target = obj[xsPrefix+"choice"][xsPrefix+"element"]; | ||
} | ||
@@ -525,4 +527,4 @@ | ||
function processChoice(obj,parent,key) { | ||
if (key == 'xs:choice') { | ||
var e = obj[key]["xs:element"] = toArray(obj[key]["xs:element"]); | ||
if (key == xsPrefix+'choice') { | ||
var e = obj[key][xsPrefix+"element"] = toArray(obj[key][xsPrefix+"element"]); | ||
for (var i=0;i<e.length;i++) { | ||
@@ -533,4 +535,4 @@ if (!e[i]["@isAttr"]) { | ||
} | ||
if (obj[key]["xs:group"]) { | ||
var g = obj[key]["xs:group"] = toArray(obj[key]["xs:group"]); | ||
if (obj[key][xsPrefix+"group"]) { | ||
var g = obj[key][xsPrefix+"group"] = toArray(obj[key][xsPrefix+"group"]); | ||
for (var i=0;i<g.length;i++) { | ||
@@ -546,3 +548,3 @@ if (!g[i]["@isAttr"]) { | ||
function renameObjects(obj,parent,key) { | ||
if (key == 'xs:complexType') { | ||
if (key == xsPrefix+'complexType') { | ||
var name = obj["@name"]; | ||
@@ -557,3 +559,3 @@ if (name) { | ||
function moveProperties(obj,parent,key) { | ||
if (key == 'xs:sequence') { | ||
if (key == xsPrefix+'sequence') { | ||
if (obj[key].properties) { | ||
@@ -668,4 +670,4 @@ obj.properties = obj[key].properties; | ||
module.exports = { | ||
getJsonSchema : function getJsonSchema(src,title,outputAttrPrefix,laxURIs) { // TODO convert to options parameter | ||
reset(outputAttrPrefix,laxURIs); | ||
getJsonSchema : function getJsonSchema(src,title,outputAttrPrefix,laxURIs,newXsPrefix) { // TODO convert to options parameter | ||
reset(outputAttrPrefix,laxURIs,newXsPrefix); | ||
@@ -682,6 +684,6 @@ recurse(src,{},function(src,parent,key) { | ||
var id = ''; | ||
if (src["xs:schema"]) { | ||
id = src["xs:schema"]["@targetNamespace"]; | ||
if (src[xsPrefix+"schema"]) { | ||
id = src[xsPrefix+"schema"]["@targetNamespace"]; | ||
if (!id) { | ||
id = src["xs:schema"]["@xmlns"]; | ||
id = src[xsPrefix+"schema"]["@xmlns"]; | ||
} | ||
@@ -691,5 +693,5 @@ } | ||
for (var a in src["xs:schema"]) { | ||
for (var a in src[xsPrefix+"schema"]) { | ||
if (a.startsWith('@xmlns:')) { | ||
if (src["xs:schema"][a] == id) { | ||
if (src[xsPrefix+"schema"][a] == id) { | ||
defaultNameSpace = a.replace('@xmlns:',''); | ||
@@ -706,12 +708,12 @@ } | ||
} | ||
if (src["xs:schema"] && src["xs:schema"]["xs:annotation"]) { | ||
if (src[xsPrefix+"schema"] && src[xsPrefix+"schema"][xsPrefix+"annotation"]) { | ||
obj.description = ''; | ||
src["xs:schema"]["xs:annotation"] = toArray(src["xs:schema"]["xs:annotation"]); | ||
for (var a in src["xs:schema"]["xs:annotation"]) { | ||
var annotation = src["xs:schema"]["xs:annotation"][a]; | ||
if ((annotation["xs:documentation"]) && (annotation["xs:documentation"]["#text"])) { | ||
obj.description += (obj.description ? '\n' : '') + annotation["xs:documentation"]["#text"]; | ||
src[xsPrefix+"schema"][xsPrefix+"annotation"] = toArray(src[xsPrefix+"schema"][xsPrefix+"annotation"]); | ||
for (var a in src[xsPrefix+"schema"][xsPrefix+"annotation"]) { | ||
var annotation = src[xsPrefix+"schema"][xsPrefix+"annotation"][a]; | ||
if ((annotation[xsPrefix+"documentation"]) && (annotation[xsPrefix+"documentation"]["#text"])) { | ||
obj.description += (obj.description ? '\n' : '') + annotation[xsPrefix+"documentation"]["#text"]; | ||
} | ||
else { | ||
if (annotation["xs:documentation"]) obj.description += (obj.description ? '\n' : '') + annotation["xs:documentation"]; | ||
if (annotation[xsPrefix+"documentation"]) obj.description += (obj.description ? '\n' : '') + annotation[xsPrefix+"documentation"]; | ||
} | ||
@@ -721,3 +723,3 @@ } | ||
var rootElement = src["xs:schema"]["xs:element"]; | ||
var rootElement = src[xsPrefix+"schema"][xsPrefix+"element"]; | ||
if (Array.isArray(rootElement)) { | ||
@@ -757,8 +759,8 @@ rootElement = rootElement[0]; | ||
// remove rootElement to leave ref'd definitions | ||
if (Array.isArray(src["xs:schema"]["xs:element"])) { | ||
//src["xs:schema"]["xs:element"] = src["xs:schema"]["xs:element"].splice(0,1); | ||
delete src["xs:schema"]["xs:element"][0]; | ||
if (Array.isArray(src[xsPrefix+"schema"][xsPrefix+"element"])) { | ||
//src[xsPrefix+"schema"][xsPrefix+"element"] = src[xsPrefix+"schema"][xsPrefix+"element"].splice(0,1); | ||
delete src[xsPrefix+"schema"][xsPrefix+"element"][0]; | ||
} | ||
else { | ||
delete src["xs:schema"]["xs:element"]; | ||
delete src[xsPrefix+"schema"][xsPrefix+"element"]; | ||
} | ||
@@ -782,3 +784,3 @@ | ||
delete(obj.definitions["xs:schema"]); | ||
delete(obj.definitions[xsPrefix+"schema"]); | ||
@@ -795,2 +797,2 @@ var count = 1; | ||
} | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2276
71156
24
12