{"record":{"id":"e407fe2adea4f450","repo":"dianping/cat","slug":"elements-closed-character-and-must-be-conn","errorCode":null,"errorMessage":"elements closed character '/' and '>' must be connected to","messagePattern":"elements closed character '/' and '>' must be connected to","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/editor/worker-xml.js","lineNumber":1632,"sourceCode":"\t\t\t\tswitch(s){\n\t\t\t\tcase S_ATTR_S:\n\t\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed value!! \"'+attrName+'\" instead!!')\n\t\t\t\t\tel.add(attrName,attrName,start);\n\t\t\t\t\tstart = p;\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_E:\n\t\t\t\t\terrorHandler.warning('attribute space is required\"'+attrName+'\"!!')\n\t\t\t\tcase S_S:\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_EQ:\n\t\t\t\t\ts = S_V;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_C:\n\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tp++;\n\t}\n}\nfunction appendElement(el,domBuilder,parseStack){\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\n\tvar currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n\tvar i = el.length;\n\twhile(i--){\n\t\tvar a = el[i];\n\t\tvar qName = a.qName;\n\t\tvar value = a.value;\n\t\tvar nsp = qName.indexOf(':');\n\t\tif(nsp>0){\n\t\t\tvar prefix = a.prefix = qName.slice(0,nsp);","sourceCodeStart":1614,"sourceCodeEnd":1650,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/editor/worker-xml.js#L1614-L1650","documentation":"Whitespace between '/' and '>' inside a start tag is rejected by the XML worker's attribute scanner (worker-css.js sibling worker-xml.js:~1632). After '/' the state becomes S_C; the space case at line 1628-1632 hits S_C and throws, because this parser requires the empty-element close sequence to be exactly '/>' with nothing between.","triggerScenarios":"'<br / >' or '<img src=\"x.png\" / >' — a space (or any c<=' ' char) after the closing slash. The default/space switch case for S_C throws at line 1632.","commonSituations":"HTML habits ('<br />' is fine, but '<br / >' after extra editing), code reformatters that insert spaces around punctuation, hand-edited XHTML.","solutions":["Write the empty-element close as '/>' with no whitespace between the two characters.","If you need whitespace formatting, put it before the '/', not between '/' and '>'.","Re-run the XML parse/lint to confirm the annotation clears."],"exampleFix":"<!-- before -->\n<br / >\n\n<!-- after -->\n<br/>","handlingStrategy":"validation","validationCode":"// Normalize '/ >' (and longer splits) to '/>' before parsing:\nfunction normalizeSelfClosing(xml) {\n  return xml.replace(/\\s+\\/\\s*>/g, '/>');\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseStartTag(source, start, tagNameReplacer);\n} catch (ex) {\n  if (/closed character/.test(ex.message)) reportXmlError(ex); else throw ex;\n}","preventionTips":["Write '/>' with no space between the characters.","Configure formatters to never break '/>' across edits.","Scan generated XML for the literal sequence '/ >' before shipping."],"tags":["xml","sax","ace-editor","self-closing","parser"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}