Exemplo n.º 1
0
        public override object VisitXmlMemberAccessExpression(XmlMemberAccessExpression xmlMemberAccessExpression, object data)
        {
            switch (xmlMemberAccessExpression.AxisType)
            {
            case XmlAxisType.Element:
            case XmlAxisType.Descendents:
                return(CreateResolveResult(
                           new TypeReference("System.Collections.Generic.IEnumerable",
                                             new List <TypeReference> {
                    new TypeReference("System.Xml.Linq.XElement")
                    {
                        IsGlobal = true
                    }
                }
                                             )
                {
                    IsGlobal = true
                }
                           ));

            case XmlAxisType.Attribute:
                return(CreateResolveResult(new TypeReference("System.String", true)
                {
                    IsGlobal = true
                }));

            default:
                throw new Exception("Invalid value for XmlAxisType");
            }
        }
Exemplo n.º 2
0
        public void VBNetSimpleDescendentsReferenceWithDotTest()
        {
            XmlMemberAccessExpression xmae = ParseUtil.ParseExpression <XmlMemberAccessExpression>("...<ns:Element>");

            Assert.AreEqual("ns:Element", xmae.Identifier);
            Assert.IsTrue(xmae.IsXmlIdentifier);
            Assert.AreEqual(XmlAxisType.Descendents, xmae.AxisType);
            Assert.IsTrue(xmae.TargetObject.IsNull);
        }
Exemplo n.º 3
0
        public void VBNetXmlNameAttributeReferenceWithDotTest()
        {
            XmlMemberAccessExpression xmae = ParseUtil.ParseExpression <XmlMemberAccessExpression>(".@<ns:attribute>");

            Assert.AreEqual("ns:attribute", xmae.Identifier);
            Assert.IsTrue(xmae.IsXmlIdentifier);
            Assert.AreEqual(XmlAxisType.Attribute, xmae.AxisType);
            Assert.IsTrue(xmae.TargetObject.IsNull);
        }
Exemplo n.º 4
0
        public void VBNetSimpleAttributeReferenceTest()
        {
            XmlMemberAccessExpression xmae = ParseUtil.ParseExpression <XmlMemberAccessExpression>("xml.@attribute");

            Assert.AreEqual("attribute", xmae.Identifier);
            Assert.IsFalse(xmae.IsXmlIdentifier);
            Assert.AreEqual(XmlAxisType.Attribute, xmae.AxisType);
            Assert.IsTrue(xmae.TargetObject is IdentifierExpression);
            Assert.AreEqual("xml", ((IdentifierExpression)xmae.TargetObject).Identifier);
        }
Exemplo n.º 5
0
        public void VBNetSimpleElementReferenceTest()
        {
            XmlMemberAccessExpression xmae = ParseUtil.ParseExpression <XmlMemberAccessExpression>("xml.<ns:MyElement>");

            Assert.AreEqual("ns:MyElement", xmae.Identifier);
            Assert.IsTrue(xmae.IsXmlIdentifier);
            Assert.AreEqual(XmlAxisType.Element, xmae.AxisType);
            Assert.IsTrue(xmae.TargetObject is IdentifierExpression);
            Assert.AreEqual("xml", ((IdentifierExpression)xmae.TargetObject).Identifier);
        }
            public override object VisitXmlMemberAccessExpression(XmlMemberAccessExpression xmlMemberAccessExpression, object data)
            {
                if (xmlMemberAccessExpression.TargetObject.IsNull)
                {
                    IdentifierExpression id = new IdentifierExpression(withAccessor);
                    xmlMemberAccessExpression.TargetObject = id;
                    id.Parent = xmlMemberAccessExpression;
                }

                return(base.VisitXmlMemberAccessExpression(xmlMemberAccessExpression, data));
            }
Exemplo n.º 7
0
 public virtual object VisitXmlMemberAccessExpression(XmlMemberAccessExpression xmlMemberAccessExpression, object data)
 {
     throw new global::System.NotImplementedException("XmlMemberAccessExpression");
 }
Exemplo n.º 8
0
 public object VisitXmlMemberAccessExpression(XmlMemberAccessExpression xmlMemberAccessExpression, object data)
 {
     throw new NotImplementedException();
 }