/// <summary> /// Enter a level and get ElementNode /// </summary> /// <returns></returns> protected XmlElementNode EnterScope() { // Just check if there is no multiple root elements if (this.depth == 0) { if (this.rootElement) throw new XmlException("ThrowMultipleRootElements"); this.rootElement = true; } // Increase depth ++this.depth; if (this.depth > this.quotas.MaxDepth) throw new XmlException("ThrowMaxDepthExceeded"); // try get the element node XmlElementNode xmlElementNode; // Try to get elementNode from elementNodes // If not get it from BufferReader if (!this.elementNodes.TryGetValue(this.depth, out xmlElementNode)) { xmlElementNode = new XmlElementNode(this.BufferReader); this.elementNodes[this.depth] = xmlElementNode; } this.attributeCount = 0; this.attributeStart = -1; this.attributeIndex = -1; // Move to this node this.MoveToNode(xmlElementNode); return xmlElementNode; }
/// <summary> /// Internal Constructor /// </summary> internal XmlJsonReader() { this.BufferReader = new XmlBufferReader(); this.rootElementNode = new XmlElementNode(this.BufferReader); this.atomicTextNode = new XmlAtomicTextNode(this.BufferReader); this.Node = closedNode; }