상속: System.Xml.Xsl.XsltContext
예제 #1
0
 public XPathContext(XPathContext parent)
     : base((NameTable)parent.NameTable)
 {
     this.parent = parent;
     Arguments   = new XsltArgumentList();
     functions   = new Dictionary <string, Func <IXsltContextFunction> >();
 }
예제 #2
0
		public XPathContext(XPathContext parent) 
			: base((NameTable)parent.NameTable)
		{
			this.parent = parent;
			Arguments = new XsltArgumentList();
			functions = new Dictionary<string, Func<IXsltContextFunction>>();
		}
예제 #3
0
 public XPathResult(PropertyDescriptor property, object result, XPathContext context, object matchingBehavior, Func <XPathNavigator> create)
 {
     Result                = result;
     Property              = property;
     Type                  = (property != null) ? Property.PropertyType : null;
     Context               = context;
     this.create           = create;
     this.matchingBehavior = matchingBehavior;
     CanWrite              = (create != null || result is XPathNavigator);
 }
예제 #4
0
		protected XPathAdapter(XPathNavigator source, XPathAdapter parent)
		{
			Parent = parent;
			Context = parent.Context.CreateChild(null);
			root = source.Clone();
		}
예제 #5
0
		protected XPathAdapter(Func<XPathNavigator> createSource, XPathAdapter parent)
		{
			Parent = parent;
			Context = parent.Context.CreateChild(null);
			createRoot = createSource;
		}
예제 #6
0
		public XPathContext(XPathContext parent) : this((NameTable)parent.NameTable)
		{
			this.parent = parent;
		}
예제 #7
0
		public XPathAdapter(IXPathNavigable source)
		{
			Source = source;
			Context = new XPathContext();
			root = source.CreateNavigator();
		}
예제 #8
0
 public XPathResult(PropertyDescriptor property, object result,
                    XPathContext context, object matchingBehavior)
     : this(property, result, context, matchingBehavior, null)
 {
 }
예제 #9
0
 public XPathResult(Type type, object result, XPathContext context, object matchingBehavior)
     : this(null, result, context, matchingBehavior, null)
 {
     Type = type;
 }
예제 #10
0
		protected XPathAdapter(XPathNavigator source, XPathAdapter parent)
		{
			this.parent = parent;
			context = parent.context.CreateChild();
			root = source.Clone();
		}
예제 #11
0
 public XPathContext(XPathContext parent)
     : base((NameTable)parent.NameTable)
 {
     this.parent = parent;
     Arguments   = new XsltArgumentList();
 }
예제 #12
0
 protected XPathAdapter(Func <XPathNavigator> createSource, XPathAdapter parent)
 {
     Parent     = parent;
     Context    = parent.Context.CreateChild(null);
     createRoot = createSource;
 }
예제 #13
0
		void IDictionaryInitializer.Initialize(IDictionaryAdapter dictionaryAdapter, object[] behaviors)
		{
			var meta = dictionaryAdapter.Meta;
			if (meta.MetaInitializers.OfType<XPathBehavior>().FirstOrDefault() == null)
			{
				throw new InvalidOperationException(string.Format(
					"Interface {0} requested xpath support, but was not configured properly.  " +
					"Did you forget to add an XPathBehavior?", meta.Type.FullName));
			}

			var xmlMeta = dictionaryAdapter.GetXmlMeta();

			if (dictionaryAdapter.This.CreateStrategy == null)
			{
				dictionaryAdapter.This.CreateStrategy = this;
				dictionaryAdapter.This.AddCopyStrategy(this);
			}

			if (rootXmlMeta == null)
			{
				rootXmlMeta = xmlMeta;
				Context.ApplyBehaviors(rootXmlMeta, behaviors);

				if (Parent == null)
				{
					foreach (var behavior in behaviors)
					{
						if (behavior is XPathAttribute)
						{
							var attrib = (XPathAttribute)behavior;
							var compiledExpression = attrib.CompiledExpression;
							if (MoveOffRoot(root, XPathNodeType.Element) == false || Context.Matches(compiledExpression, root))
							{
								break;
							}

							var navigator = Context.SelectSingleNode(compiledExpression, root);
							if (navigator != null)
							{
								root = navigator;
								break;
							}
						}
					}
					MoveOffRoot(root, XPathNodeType.Element);
				}
			}
			else
			{
				if (overlays == null)
					overlays = new Dictionary<Type, XPathContext>();

				XPathContext overlay;
				if (overlays.TryGetValue(meta.Type, out overlay) == false)
				{
					overlay = new XPathContext().ApplyBehaviors(xmlMeta, behaviors);
					overlays.Add(meta.Type, overlay);
				}
			}
		}
예제 #14
0
 protected XPathAdapter(XPathNavigator source, XPathAdapter parent)
 {
     Parent  = parent;
     Context = parent.Context.CreateChild(null);
     root    = source.Clone();
 }
예제 #15
0
 public XPathAdapter(IXPathNavigable source)
 {
     Source  = source;
     Context = new XPathContext();
     root    = source.CreateNavigator();
 }
예제 #16
0
		public XPathContext(XPathContext parent) 
			: base((NameTable)parent.NameTable)
		{
			this.parent = parent;
			Arguments = new XsltArgumentList();
		}
예제 #17
0
			public XPathSemantics(XPathContext xpathContext)
			{
				this.xpathContext = xpathContext;
			}
예제 #18
0
		protected XPathAdapter(Func<XPathNavigator> createSource, XPathAdapter parent)
		{
			this.parent = parent;
			context = parent.context.CreateChild();
			createRoot = createSource;
		}
예제 #19
0
 public XPathSemantics(XPathContext xpathContext)
 {
     this.xpathContext = xpathContext;
 }
예제 #20
0
        void IDictionaryInitializer.Initialize(IDictionaryAdapter dictionaryAdapter, object[] behaviors)
        {
            var meta = dictionaryAdapter.Meta;

            if (meta.MetaInitializers.OfType <XPathBehavior>().FirstOrDefault() == null)
            {
                throw new InvalidOperationException(string.Format(
                                                        "Interface {0} requested xpath support, but was not configured properly.  " +
                                                        "Did you forget to add an XPathBehavior?", meta.Type.FullName));
            }

            var xmlMeta = dictionaryAdapter.GetXmlMeta();

            if (dictionaryAdapter.This.CreateStrategy == null)
            {
                dictionaryAdapter.This.CreateStrategy = this;
                dictionaryAdapter.This.AddCopyStrategy(this);
            }

            if (rootXmlMeta == null)
            {
                rootXmlMeta = xmlMeta;
                Context.ApplyBehaviors(rootXmlMeta, behaviors);

                if (Parent == null)
                {
                    foreach (var behavior in behaviors)
                    {
                        if (behavior is XPathAttribute)
                        {
                            var attrib             = (XPathAttribute)behavior;
                            var compiledExpression = attrib.CompiledExpression;
                            if (MoveOffRoot(root, XPathNodeType.Element) == false || Context.Matches(compiledExpression, root))
                            {
                                break;
                            }

                            var navigator = Context.SelectSingleNode(compiledExpression, root);
                            if (navigator != null)
                            {
                                root = navigator;
                                break;
                            }
                        }
                    }
                    MoveOffRoot(root, XPathNodeType.Element);
                }
            }
            else
            {
                if (overlays == null)
                {
                    overlays = new Dictionary <Type, XPathContext>();
                }

                XPathContext overlay;
                if (overlays.TryGetValue(meta.Type, out overlay) == false)
                {
                    overlay = new XPathContext().ApplyBehaviors(xmlMeta, behaviors);
                    overlays.Add(meta.Type, overlay);
                }
            }
        }