/// <summary> /// Returns the next input node from the XML document, if it is a /// child element of the specified input node. This essentially /// the same as the <c>ReadElement(InputNode)</c> object /// except that this will not read the element if it does not have /// the name specified. This essentially acts as a peak function. /// </summary> /// <param name="from"> /// This is the input node to read with. /// </param> /// <param name="name"> /// This is the name expected from the next element. /// </param> /// <returns> /// This returns the next input node from the document. /// </returns> public InputNode ReadElement(InputNode from, String name) { if (!stack.IsRelevant(from)) { return(null); } EventNode node = reader.Peek(); while (node != null) { if (node.IsEnd()) { if (stack.Top() == from) { return(null); } else { stack.Pop(); } } else if (node.IsStart()) { if (IsName(node, name)) { return(ReadElement(from)); } break; } node = reader.Next(); node = reader.Peek(); } return(null); }
/// <summary> /// Returns the next input node from the XML document, if it is a /// child element of the specified input node. This essentially /// determines whether the end tag has been read for the specified /// node, if so then null is returned. If however the specified /// node has not had its end tag read then this returns the next /// element, if that element is a child of the that node. /// </summary> /// <param name="from"> /// This is the input node to read with. /// </param> /// <returns> /// This returns the next input node from the document. /// </returns> public InputNode ReadElement(InputNode from) { if (!stack.IsRelevant(from)) { return(null); } EventNode node = reader.Next(); while (node != null) { if (node.IsEnd()) { if (stack.Pop() == from) { return(null); } } else if (node.IsStart()) { return(ReadStart(from, node)); } node = reader.Next(); } return(null); }
/// <summary> /// This is used to determine if this input node is empty. An /// empty node is one with no attributes or children. This can /// be used to determine if a given node represents an empty /// entity, with which no extra data can be extracted. /// </summary> /// <param name="from"> /// This is the input node to read the value from. /// </param> /// <returns> /// This returns true if the node is an empty element. /// </returns> public bool IsEmpty(InputNode from) { if (stack.Top() == from) { EventNode node = reader.Peek(); if (node.IsEnd()) { return(true); } } return(false); }