public override bool Visit(TiXmlUnknown unknown) { DoIndent(); buffer.Append("<"); buffer.Append(unknown.Value()); buffer.Append(">"); DoLineBreak(); return(true); }
/// <summary> /// Creates a copy of this Unknown and returns it. /// </summary> public override TiXmlNode Clone() { TiXmlUnknown clone = new TiXmlUnknown(); if (clone == null) { return(null); } CopyTo(clone); return(clone); }
/// <summary> /// Figure out what is at *p, and parse it. Returns null if it is not an xml node. /// </summary> protected TiXmlNode Identify(string p, int index, int encoding) { TiXmlNode returnNode = null; index = SkipWhiteSpace(p, index, encoding); if (p == null || index < 0 || index >= p.Length || p[index] != '<') { return(null); } TiXmlDocument doc = GetDocument(); index = SkipWhiteSpace(p, index, encoding); if (index < 0 || index >= p.Length) { return(null); } // What is this thing? // - Elements start with a letter or underscore, but xml is reserved. // - Comments: <!-- // - Decleration: <?xml // - Everthing else is unknown to tinyxml. // const string xmlHeader = "<?xml"; const string commentHeader = "<!--"; const string dtdHeader = "<!"; const string cdataHeader = "<![CDATA["; if (StringEqual(p, index, xmlHeader, true, encoding)) { #if UNUSED TIXML_LOG("XML parsing Declaration\n"); #endif returnNode = new TiXmlDeclaration(); } else if (StringEqual(p, index, commentHeader, false, encoding)) { #if UNUSED TIXML_LOG("XML parsing Comment\n"); #endif returnNode = new TiXmlComment(); } else if (StringEqual(p, index, cdataHeader, false, encoding)) { #if UNUSED TIXML_LOG("XML parsing CDATA\n"); #endif TiXmlText text = new TiXmlText(""); text.SetCDATA(true); returnNode = text; } else if (StringEqual(p, index, dtdHeader, false, encoding)) { #if UNUSED TIXML_LOG("XML parsing Unknown(1)\n"); #endif returnNode = new TiXmlUnknown(); } else if (IsAlpha(p[index + 1], encoding) || p[index + 1] == '_') { #if UNUSED TIXML_LOG("XML parsing Element\n"); #endif returnNode = new TiXmlElement(""); } else { #if UNUSED TIXML_LOG("XML parsing Unknown(2)\n"); #endif returnNode = new TiXmlUnknown(); } if (returnNode != null) { // Set the parent, so it can report errors returnNode.parent = this; } else { if (doc != null) { doc.SetError(ErrorType.TIXML_ERROR_OUT_OF_MEMORY, null, 0, null, TiXmlEncoding.TIXML_ENCODING_UNKNOWN); } } return(returnNode); }
/// <summary> /// Visit an unknown node /// </summary> public virtual bool Visit(TiXmlUnknown unknown) { return(true); }
public TiXmlUnknown(TiXmlUnknown copy) : base(TiXmlNode.NodeType.UNKNOWN) { copy.CopyTo(this); }
protected void CopyTo(TiXmlUnknown target) { base.CopyTo(target); }