MCPcopy Create free account
hub / github.com/BaseXdb/basex / toNode

Method toNode

basex-core/src/main/java/org/basex/query/func/db/DbInfo.java:32–50  ·  view source on GitHub ↗

Converts the specified info string to a node fragment. @param name name of the root node @param string string to be converted @param qc query context @return node

(final QNm name, final String string, final QueryContext qc)

Source from the content-addressed store, hash-verified

30 * @return node
31 */
32 static FNode toNode(final QNm name, final String string, final QueryContext qc) {
33 final FBuilder root = FElem.build(name);
34
35 FBuilder header = null;
36 for(final String line : string.split(Prop.NL)) {
37 final String[] cols = line.split(": ", 2);
38 if(cols[0].isEmpty()) continue;
39
40 final String col = cols[0].replaceAll("[ -:]", "").toLowerCase(Locale.ENGLISH);
41 final FBuilder node = FElem.build(qc.shared.qName(Token.token(col)));
42 if(Strings.startsWith(cols[0], ' ')) {
43 header.node(node.text(cols[1]));
44 } else {
45 if(header != null) root.node(header);
46 header = node;
47 }
48 }
49 return root.node(header).finish();
50 }
51}

Callers 14

itemMethod · 0.95
itemMethod · 0.95
itemMethod · 0.45
itemMethod · 0.45
itemMethod · 0.45
idsMethod · 0.45
itemMethod · 0.45
valueMethod · 0.45
testMethod · 0.45
valueMethod · 0.45
itemMethod · 0.45
itemMethod · 0.45

Calls 9

buildMethod · 0.95
tokenMethod · 0.95
startsWithMethod · 0.95
nodeMethod · 0.95
textMethod · 0.95
splitMethod · 0.45
isEmptyMethod · 0.45
qNameMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected