Example #1
0
 internal void AddValueRange(DocumentRange startNodeRange, DocumentRange valueRange)
 {
     this.objRgnToInitValueRgnMapping.Add(startNodeRange, valueRange);
 }
Example #2
0
 internal ValueNodeXamlMemberInvoker(XamlDebuggerXmlReader parent, XamlMemberInvoker wrapped, DocumentRange attributeValueRange)
 {
     this.parent              = parent;
     this.wrapped             = wrapped;
     this.attributeValueRange = attributeValueRange;
 }
Example #3
0
        public override bool Read()
        {
            bool result = base.Read();

            if (this.NodeType == Xml.XmlNodeType.Element)
            {
                DocumentLocation elementLocation = this.CurrentLocation;
                if (this.IsEmptyElement)
                {
                    DocumentRange emptyElementRange = this.FindEmptyElementRange(elementLocation);
                    this.EmptyElementRanges.Add(elementLocation, emptyElementRange);
                }
                else
                {
                    DocumentLocation startElementBracket = this.FindStartElementBracket(elementLocation);
                    this.StartElementLocations.Add(elementLocation, startElementBracket);

                    // Push a null as a place holder. In XmlNodeType.Text part, we replace this
                    // null with real data. Why not pushing real data only without this place holder?
                    // Because in XmlNodeType.EndElement, we need to know whether there is Text. Think
                    // about situation like <a>Text1<b><c>Text2</c></b>Text3</a>
                    // So, each time an Element starts, we push a place holder in the stack so that Start
                    // and End don't mis-match.
                    this.contentStartLocationStack.Push(null);
                }

                int attributeCount = this.AttributeCount;
                if (attributeCount > 0)
                {
                    for (int i = 0; i < attributeCount; i++)
                    {
                        this.MoveToAttribute(i);
                        DocumentLocation memberLocation      = this.CurrentLocation;
                        DocumentRange    attributeValueRange = this.FindAttributeValueLocation(memberLocation);
                        this.AttributeValueRanges.Add(memberLocation, attributeValueRange);
                    }

                    this.MoveToElement();
                }
            }
            else if (this.NodeType == Xml.XmlNodeType.EndElement)
            {
                DocumentLocation endElementLocation = this.CurrentLocation;
                DocumentLocation endElementBracket  = this.FindEndElementBracket(endElementLocation);
                this.EndElementLocations.Add(endElementLocation, endElementBracket);
                UnitTestUtility.Assert(
                    this.contentStartLocationStack.Count > 0,
                    "The stack should contain at least a null we pushed in StartElement.");
                DocumentLocation contentStartLocation = this.contentStartLocationStack.Pop();
                if (contentStartLocation != null)
                {
                    DocumentLocation contentEnd = this.FindContentEndBefore(endElementLocation);
                    this.ContentValueRanges.Add(endElementLocation, new DocumentRange(contentStartLocation, contentEnd));
                }
            }
            else if (this.NodeType == Xml.XmlNodeType.Text)
            {
                UnitTestUtility.Assert(this.contentStartLocationStack.Count > 0, "Adding Text with out StartElement?");
                if (this.contentStartLocationStack.Peek() == null)
                {
                    // no text was added since the last StartElement.
                    // This is the start of the content of this Element.
                    // <a>ABCDE</a>
                    // Sometimes, xml reader gives the text by ABC and DE in
                    // two times.
                    this.contentStartLocationStack.Pop();
                    this.contentStartLocationStack.Push(this.CurrentLocation);
                }
            }

            return(result);
        }