void XmlView::Load(int parent, XmlParser& p) { if(p.IsTag()) { String tag = p.ReadTag(); String txt = tag; for(int i = 0; i < p.GetAttrCount(); i++) txt << ' ' << p.GetAttr(i) << "=\"" << p[i] << "\""; parent = xml.Add(parent, XmlImg::Tag(), tag, txt); while(!p.End()) { if(p.IsEof()) throw XmlError(""); Load(parent, p); } } else if(p.IsText()) xml.Add(parent, XmlImg::Text(), Null, NormalizeSpaces(p.ReadText())); else if(p.IsPI()) xml.Add(parent, XmlImg::PI(), Null, NormalizeSpaces(p.ReadPI())); else if(p.IsDecl()) xml.Add(parent, XmlImg::Decl(), Null, NormalizeSpaces(p.ReadDecl())); else if(p.IsComment()) xml.Add(parent, XmlImg::Comment(), Null, NormalizeSpaces(p.ReadComment())); else NEVER(); }
static XmlNode sReadXmlNode(XmlParser& p, dword style) { XmlNode m; if(p.IsTag()) { m.CreateTag(p.ReadTag()); m.SetAttrsPick(p.PickAttrs()); while(!p.End()) if(!Ignore(p, style)) m.Add() = sReadXmlNode(p, style); return m; } if(p.IsPI()) { m.CreatePI(p.ReadPI()); return m; } if(p.IsDecl()) { m.CreateDecl(p.ReadDecl()); return m; } if(p.IsComment()) { m.CreateComment(p.ReadComment()); return m; } m.CreateText(p.ReadText()); return m; }