Ejemplo n.º 1
0
        /// <summary>
        /// Searches the child block for new elements
        /// </summary>
        private void Search(DtdChildElements childBlock)
        {
            switch (childBlock.ElementType)
            {
            case DtdChildElements.DtdChildElementTypes.Empty:
                break;

            case DtdChildElements.DtdChildElementTypes.SingleChild:
                if (!Elements.Contains(childBlock.ElementName))
                {
                    Elements.Add(childBlock.ElementName);
                }
                break;

            case DtdChildElements.DtdChildElementTypes.ChildList:
                for (int iChild = 0; iChild < childBlock.ChildrenCount; iChild++)
                {
                    this.Search(childBlock.Child(iChild));
                }
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the list of all elements mentioned in the Children
        /// </summary>
        private IEnumerable <string> GetDtdElementNamesFromChildElements(DtdChildElements children)
        {
            switch (children.ElementType)
            {
            case DtdChildElements.DtdChildElementTypes.SingleChild:
                // is a single ChildElement
                yield return(children.ElementName);

                break;

            case DtdChildElements.DtdChildElementTypes.ChildList:
                for (int i = 0; i < children.ChildrenCount; i++)
                {
                    foreach (string childElementName in this.GetDtdElementNamesFromChildElements(children.Child(i)))
                    {
                        yield return(childElementName);
                    }
                }
                break;

            case DtdChildElements.DtdChildElementTypes.Empty:
                break;

            default:
                throw new ApplicationException($"unknown DTDChildElementType {children.ElementType}");
            }

            yield return("#COMMENT");     //Add the comment tag, as this is always allowed
        }