public nano_node add_xml(string xml) { nano_doc doc = new nano_doc(string.Format("<root>{0}</root>", xml)); nano_node fn = null; foreach (nano_node nd in doc.root.nodes) { _doc.root.add(nd); if (fn == null) { fn = nd; } } return(fn); }
protected void parse_block(StringBuilder sb, core cr, nano_node nd) { string html = cr.config.get_html_block(nd.name).content; // childs StringBuilder sbc = new StringBuilder(); if (html.IndexOf("{@childs@}") >= 0) { foreach (nano_node nd2 in nd.nodes) { parse_block(sbc, cr, nd2); } html = html.Replace("{@childs@}", sbc.Length > 0 ? sbc.ToString() : ""); } // attrs int n = html.IndexOf("{@"); while (n >= 0) { int n2 = html.IndexOf("@}", n + 2); if (n2 >= 0) { string attr = html.Substring(n + 2, n2 - n - 2), name = "", content = ""; int nif = attr.IndexOf("::"); if (nif > 0) { content = attr.Substring(nif + 2); name = attr.Substring(0, nif); } else { name = attr; } string val = nd.get_attr(name, name == "text"); html = html.Replace("{@" + attr + "@}", content != "" ? (val != "" ? content.Replace("#value#", val) : "") : val); } n = html.IndexOf("{@", n + 2); } sb.Append(html); }