Beispiel #1
0
        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)
            {
                add(nd); if (fn == null)
                {
                    fn = nd;
                }
            }
            return(fn);
        }
Beispiel #2
0
        public void load_xml(string xml)
        {
            int i = 0;

            _decs.Clear();

            while (true)
            {
                _skip_spaces(xml, ref i);

                if (xml[i] != '<')
                {
                    throw new XMLParsingException("Unexpected token");
                }

                i++;               // skip <

                if (xml[i] == '?') // declaration
                {
                    i++;           // skip ?
                    _parse_attrs(xml, ref i, _decs, '?', '>');
                    i++;           // skip ending ?
                    i++;           // skip ending >

                    continue;
                }

                if (xml[i] == '!')        // doctype
                {
                    while (xml[i] != '>') // skip doctype
                    {
                        i++;
                    }

                    i++; // skip >

                    continue;
                }

                _root = new nano_node(xml, ref i);
                break;
            }
        }
Beispiel #3
0
 public nano_node add(nano_node nd)
 {
     _nodes.Add(nd); return(nd);
 }
Beispiel #4
0
 public nano_node add(string name)
 {
     nano_node nd = new nano_node(name); _nodes.Add(nd); return(nd);
 }