/// <summary> /// Parses the stream. /// </summary> public void Parse() { XmlReader parser = XmlUtils.CreateParser(stream); try { while (true) { XmlNodeType nodeType = parser.NodeType; if (nodeType == XmlNodeType.Element) { string uri = parser.NamespaceURI; string local = parser.LocalName; if (uri == XmlConstants.NamespaceAtom) { if (local == XmlConstants.TAG_FEED) { parseResult = ParseFeed(parser); break; } else if (local == XmlConstants.TAG_ENTRY) { parseResult = ParseEntry(parser); break; } } else if (uri == XmlConstants.NamespaceCmis) { if (local == XmlConstants.TAG_ALLOWABLEACTIONS) { parseResult = ParseAllowableActions(parser); break; } else if (local == XmlConstants.TAG_ACL) { parseResult = ParseACL(parser); break; } } else if (uri == XmlConstants.NamespaceApp) { if (local == XmlConstants.TAG_SERVICE) { parseResult = ParseServiceDoc(parser); break; } } else if (string.Equals(XmlConstants.TAG_HTML, local, StringComparison.OrdinalIgnoreCase)) { parseResult = new HtmlDoc(); break; } } if (!XmlUtils.Next(parser)) { break; } } } finally { parser.Dispose(); // make sure the stream is read and closed in all cases IOUtils.ConsumeAndClose(stream); } }