• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IXmlNamespaceResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IXmlNamespaceResolver的典型用法代码示例。如果您正苦于以下问题:C# IXmlNamespaceResolver类的具体用法?C# IXmlNamespaceResolver怎么用?C# IXmlNamespaceResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IXmlNamespaceResolver类属于命名空间,在下文中一共展示了IXmlNamespaceResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Select

 public static IEnumerable Select(object container, string xPath, IXmlNamespaceResolver resolver)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (string.IsNullOrEmpty(xPath))
     {
         throw new ArgumentNullException("xPath");
     }
     ArrayList list = new ArrayList();
     IXPathNavigable navigable = container as IXPathNavigable;
     if (navigable == null)
     {
         throw new ArgumentException(System.Web.SR.GetString("XPathBinder_MustBeIXPathNavigable", new object[] { container.GetType().FullName }));
     }
     XPathNodeIterator iterator = navigable.CreateNavigator().Select(xPath, resolver);
     while (iterator.MoveNext())
     {
         IHasXmlNode current = iterator.Current as IHasXmlNode;
         if (current == null)
         {
             throw new InvalidOperationException(System.Web.SR.GetString("XPathBinder_MustHaveXmlNodes"));
         }
         list.Add(current.GetNode());
     }
     return list;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XPathBinder.cs


示例2: Eval

 public static object Eval(object container, string xPath, IXmlNamespaceResolver resolver)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (string.IsNullOrEmpty(xPath))
     {
         throw new ArgumentNullException("xPath");
     }
     IXPathNavigable navigable = container as IXPathNavigable;
     if (navigable == null)
     {
         throw new ArgumentException(System.Web.SR.GetString("XPathBinder_MustBeIXPathNavigable", new object[] { container.GetType().FullName }));
     }
     object obj2 = navigable.CreateNavigator().Evaluate(xPath, resolver);
     XPathNodeIterator iterator = obj2 as XPathNodeIterator;
     if (iterator == null)
     {
         return obj2;
     }
     if (iterator.MoveNext())
     {
         return iterator.Current.Value;
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:XPathBinder.cs


示例3: TryParseValue

 internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
 {
     typedValue = null;
     if ((s == null) || (s.Length == 0))
     {
         return new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);
     }
     Exception exception = DatatypeImplementation.durationFacetsChecker.CheckLexicalFacets(ref s, this);
     if (exception == null)
     {
         XsdDuration duration;
         exception = XsdDuration.TryParse(s, XsdDuration.DurationType.YearMonthDuration, out duration);
         if (exception == null)
         {
             TimeSpan span;
             exception = duration.TryToTimeSpan(XsdDuration.DurationType.YearMonthDuration, out span);
             if (exception == null)
             {
                 exception = DatatypeImplementation.durationFacetsChecker.CheckValueFacets(span, this);
                 if (exception == null)
                 {
                     typedValue = span;
                     return null;
                 }
             }
         }
     }
     return exception;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:Datatype_yearMonthDuration.cs


示例4: ChangeType

 public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (destinationType == XmlBaseConverter.ObjectType)
     {
         destinationType = base.DefaultClrType;
     }
     if (destinationType == XmlBaseConverter.StringType)
     {
         return value;
     }
     if (destinationType == XmlBaseConverter.XmlAtomicValueType)
     {
         return new XmlAtomicValue(base.SchemaType, value);
     }
     if (destinationType == XmlBaseConverter.XPathItemType)
     {
         return new XmlAtomicValue(base.SchemaType, value);
     }
     return this.ChangeListType(value, destinationType, nsResolver);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XmlStringConverter.cs


示例5: ParseConfiguration

		protected override void ParseConfiguration(XPathNavigator configurationElement, IXmlNamespaceResolver xmlNamespaceResolver, ContentType contentType)
		{
            //<MinValue>-6</MinValue>
			//<MaxValue>42</MaxValue>
			foreach (XPathNavigator node in configurationElement.SelectChildren(XPathNodeType.Element))
			{
				switch (node.LocalName)
				{
					case MinValueName:
                        int minValue;
                        if (Int32.TryParse(node.InnerXml, out minValue))
                            _minValue = minValue;
						break;
					case MaxValueName:
						int maxValue;
						if (Int32.TryParse(node.InnerXml, out maxValue))
							_maxValue = maxValue;
						break;
                    case ShowAsPercentageName:
                        bool perc;
                        if (Boolean.TryParse(node.InnerXml, out perc))
                            _showAsPercentage = perc;
                        break;
				}
			}
		}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:26,代码来源:IntegerFieldSetting.cs


示例6: TryParseValue

 internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
 {
     typedValue = null;
     if ((s == null) || (s.Length == 0))
     {
         return new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);
     }
     Exception exception = DatatypeImplementation.qnameFacetsChecker.CheckLexicalFacets(ref s, this);
     if (exception == null)
     {
         XmlQualifiedName name = null;
         try
         {
             string str;
             name = XmlQualifiedName.Parse(s, nsmgr, out str);
         }
         catch (ArgumentException exception2)
         {
             return exception2;
         }
         catch (XmlException exception3)
         {
             return exception3;
         }
         exception = DatatypeImplementation.qnameFacetsChecker.CheckValueFacets(name, this);
         if (exception == null)
         {
             typedValue = name;
             return null;
         }
     }
     return exception;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:Datatype_NOTATION.cs


示例7: Apply

        public void Apply (XmlDocument targetDocument, IXmlNamespaceResolver context) {

            XPathExpression local_file_expression = file_expression.Clone();
            local_file_expression.SetContext(context);

            XPathExpression local_source_expression = source_expression.Clone();
            local_source_expression.SetContext(context);

            XPathExpression local_target_expression = target_expression.Clone();
            local_target_expression.SetContext(context);

            string file_name = (string) targetDocument.CreateNavigator().Evaluate(local_file_expression);
            string file_path = Path.Combine(root_directory, file_name);

            if (!File.Exists(file_path)) return;
            XPathDocument sourceDocument = new XPathDocument(file_path);

            XPathNavigator target_node = targetDocument.CreateNavigator().SelectSingleNode(local_target_expression);
            if (target_node == null) return;

            XPathNodeIterator source_nodes = sourceDocument.CreateNavigator().Select(local_source_expression);
            foreach (XPathNavigator source_node in source_nodes) {
                target_node.AppendChild(source_node);
            }
       
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:26,代码来源:CopyFromFiles.cs


示例8: ChangeType

 public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     Type derivedType = value.GetType();
     if (destinationType == XmlBaseConverter.ObjectType)
     {
         destinationType = base.DefaultClrType;
     }
     if ((destinationType == XmlBaseConverter.XPathNavigatorType) && XmlBaseConverter.IsDerivedFrom(derivedType, XmlBaseConverter.XPathNavigatorType))
     {
         return (XPathNavigator) value;
     }
     if ((destinationType == XmlBaseConverter.XPathItemType) && XmlBaseConverter.IsDerivedFrom(derivedType, XmlBaseConverter.XPathNavigatorType))
     {
         return (XPathItem) value;
     }
     return this.ChangeListType(value, destinationType, nsResolver);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:XmlNodeConverter.cs


示例9: Eval

        public static object Eval(object container, string xPath, IXmlNamespaceResolver resolver) {
            if (container == null) {
                throw new ArgumentNullException("container");
            }
            if (String.IsNullOrEmpty(xPath)) {
                throw new ArgumentNullException("xPath");
            }

            IXPathNavigable node = container as IXPathNavigable;
            if (node == null) {
                throw new ArgumentException(SR.GetString(SR.XPathBinder_MustBeIXPathNavigable, container.GetType().FullName));
            }
            XPathNavigator navigator = node.CreateNavigator();

            object retValue = navigator.Evaluate(xPath, resolver);

            // If we get back an XPathNodeIterator instead of a simple object, advance
            // the iterator to the first node and return the value.
            XPathNodeIterator iterator = retValue as XPathNodeIterator;
            if (iterator != null) {
                if (iterator.MoveNext()) {
                    retValue = iterator.Current.Value;
                }
                else {
                    retValue = null;
                }
            }

            return retValue;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:30,代码来源:XPathBinder.cs


示例10: ReadContentAsAsync

        // Concatenates values of textual nodes of the current content, ignoring comments and PIs, expanding entity references, 
        // and converts the content to the requested type. Stops at start tags and end tags.
        public virtual async Task<object> ReadContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver)
        {
            if (!CanReadContentAs())
            {
                throw CreateReadContentAsException("ReadContentAs");
            }

            string strContentValue = await InternalReadContentAsStringAsync().ConfigureAwait(false);
            if (returnType == typeof(string))
            {
                return strContentValue;
            }
            else
            {
                try
                {
                    return XmlUntypedStringConverter.Instance.FromString(strContentValue, returnType, (namespaceResolver == null ? this as IXmlNamespaceResolver : namespaceResolver));
                }
                catch (FormatException e)
                {
                    throw new XmlException(SR.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
                }
                catch (InvalidCastException e)
                {
                    throw new XmlException(SR.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
                }
            }
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:30,代码来源:XmlReaderAsync.cs


示例11: ReadContentAsAsync

        public override async Task< object > ReadContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver) {
            if (!CanReadContentAs(this.NodeType)) {
                throw CreateReadContentAsException("ReadContentAs");
            }
            string originalStringValue;

            var tuple_0 = await InternalReadContentAsObjectTupleAsync(false).ConfigureAwait(false);
            originalStringValue = tuple_0.Item1;

            object typedValue = tuple_0.Item2;

            XmlSchemaType xmlType = NodeType == XmlNodeType.Attribute ? AttributeXmlType : ElementXmlType; //
            try {
                if (xmlType != null) {
                    // special-case convertions to DateTimeOffset; typedValue is by default a DateTime 
                    // which cannot preserve time zone, so we need to convert from the original string
                    if (returnType == typeof(DateTimeOffset) && xmlType.Datatype is Datatype_dateTimeBase) {
                        typedValue = originalStringValue;
                    }
                    return xmlType.ValueConverter.ChangeType(typedValue, returnType);
                }
                else {
                    return XmlUntypedConverter.Untyped.ChangeType(typedValue, returnType, namespaceResolver);
                }
            }
            catch (FormatException e) {
                throw new XmlException(Res.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
            }
            catch (InvalidCastException e) {
                throw new XmlException(Res.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
            }
            catch (OverflowException e) {
                throw new XmlException(Res.Xml_ReadContentAsFormatException, returnType.ToString(), e, this as IXmlLineInfo);
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:35,代码来源:XsdValidatingReaderAsync.cs


示例12: TryParseValue

 internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
 {
     typedValue = null;
     Exception exception = DatatypeImplementation.binaryFacetsChecker.CheckLexicalFacets(ref s, this);
     if (exception == null)
     {
         byte[] buffer = null;
         try
         {
             buffer = XmlConvert.FromBinHexString(s, false);
         }
         catch (ArgumentException exception2)
         {
             return exception2;
         }
         catch (XmlException exception3)
         {
             return exception3;
         }
         exception = DatatypeImplementation.binaryFacetsChecker.CheckValueFacets(buffer, this);
         if (exception == null)
         {
             typedValue = buffer;
             return null;
         }
     }
     return exception;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:Datatype_hexBinary.cs


示例13: ChangeType

 public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     Type sourceType = value.GetType();
     if ((sourceType == XmlBaseConverter.XmlAtomicValueType) && this.hasAtomicMember)
     {
         return ((XmlAtomicValue) value).ValueAs(destinationType, nsResolver);
     }
     if ((sourceType == XmlBaseConverter.XmlAtomicValueArrayType) && this.hasListMember)
     {
         return XmlAnyListConverter.ItemList.ChangeType(value, destinationType, nsResolver);
     }
     if (!(sourceType == XmlBaseConverter.StringType))
     {
         throw base.CreateInvalidClrMappingException(sourceType, destinationType);
     }
     if (destinationType == XmlBaseConverter.StringType)
     {
         return value;
     }
     XsdSimpleValue value2 = (XsdSimpleValue) base.SchemaType.Datatype.ParseValue((string) value, new NameTable(), nsResolver, true);
     return value2.XmlType.ValueConverter.ChangeType((string) value, destinationType, nsResolver);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:XmlUnionConverter.cs


示例14: XPathEvaluate

		public static object XPathEvaluate (this XNode node, string expression, IXmlNamespaceResolver resolver)
		{
			object navigationResult = CreateNavigator (node).Evaluate (expression, resolver);
			if (!(navigationResult is XPathNodeIterator))
				return navigationResult;
			return GetUnderlyingXObjects((XPathNodeIterator) navigationResult);
		}
开发者ID:carrie901,项目名称:mono,代码行数:7,代码来源:Extensions.cs


示例15: XPathSelectElement

		public static XElement XPathSelectElement (this XNode node, string expression, IXmlNamespaceResolver resolver)
		{
			XPathNavigator nav = CreateNavigator (node).SelectSingleNode (expression, resolver);
			if (nav == null)
				return null;
			return nav.UnderlyingObject as XElement;
		}
开发者ID:carrie901,项目名称:mono,代码行数:7,代码来源:Extensions.cs


示例16: Apply

        //=====================================================================

        /// <summary>
        /// Apply the copy command to the specified target document using the specified context
        /// </summary>
        /// <param name="targetDocument">The target document</param>
        /// <param name="context">The context to use</param>
        public override void Apply(XmlDocument targetDocument, IXmlNamespaceResolver context)
        {
            // Extract the target node
            XPathExpression targetXPath = this.Target.Clone();
            targetXPath.SetContext(context);

            XPathNavigator target = targetDocument.CreateNavigator().SelectSingleNode(targetXPath);

            if(target != null)
            {
                // Extract the source nodes
                XPathExpression sourceXPath = this.Source.Clone();
                sourceXPath.SetContext(context);

                XPathNodeIterator sources = this.SourceDocument.CreateNavigator().Select(sourceXPath);

                // Append the source nodes to the target node
                foreach(XPathNavigator source in sources)
                    target.AppendChild(source);

                // Don't warn or generate an error if no source nodes are found, that may be the case
            }
            else
                base.ParentComponent.WriteMessage(MessageLevel.Error, "CopyFromFileCommand target node not found");
        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:32,代码来源:CopyFromFileCommand.cs


示例17: XmlSchemaValidator

 public XmlSchemaValidator(XmlNameTable nameTable, XmlSchemaSet schemas, IXmlNamespaceResolver namespaceResolver, XmlSchemaValidationFlags validationFlags)
 {
     if (nameTable == null)
     {
         throw new ArgumentNullException("nameTable");
     }
     if (schemas == null)
     {
         throw new ArgumentNullException("schemas");
     }
     if (namespaceResolver == null)
     {
         throw new ArgumentNullException("namespaceResolver");
     }
     this.nameTable = nameTable;
     this.nsResolver = namespaceResolver;
     this.validationFlags = validationFlags;
     if (((validationFlags & XmlSchemaValidationFlags.ProcessInlineSchema) != XmlSchemaValidationFlags.None) || ((validationFlags & XmlSchemaValidationFlags.ProcessSchemaLocation) != XmlSchemaValidationFlags.None))
     {
         this.schemaSet = new XmlSchemaSet(nameTable);
         this.schemaSet.ValidationEventHandler += schemas.GetEventHandler();
         this.schemaSet.CompilationSettings = schemas.CompilationSettings;
         this.schemaSet.XmlResolver = schemas.GetResolver();
         this.schemaSet.Add(schemas);
         this.validatedNamespaces = new Hashtable();
     }
     else
     {
         this.schemaSet = schemas;
     }
     this.Init();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:XmlSchemaValidator.cs


示例18: ExpressionBuilderParameters

        public ExpressionBuilderParameters(ParameterExpression[] parameters, IQueryProvider queryProvider, Type elementType, IXmlNamespaceResolver namespaceResolver, bool mayRootPathBeImplied, IOperatorImplementationProvider operatorImplementationProvider, Func<Type, IXmlNamespaceResolver, XPathTypeNavigator> navigatorCreator=null)
        {
            Debug.Assert(parameters!=null);
            if (parameters==null)
                throw new ArgumentNullException("parameters");
            Debug.Assert(parameters.Length>0);
            if (parameters.Length==0)
                throw new ArgumentException(
                    string.Format(
                        CultureInfo.CurrentCulture,
                        SR.ArrayShouldHaveElementsException,
                        1,
                        parameters.Length
                    ),
                    "parameters"
                );
            Debug.Assert(queryProvider!=null);
            if (queryProvider==null)
                throw new ArgumentNullException("queryProvider");
            Debug.Assert(elementType!=null);
            if (elementType==null)
                throw new ArgumentNullException("elementType");

            Parameters=new ReadOnlyCollection<ParameterExpression>(parameters);
            ElementType=elementType;
            QueryProvider=queryProvider;
            NamespaceResolver=namespaceResolver;
            MayRootPathBeImplied=mayRootPathBeImplied;
            OperatorImplementationProvider=operatorImplementationProvider;
            NavigatorCreator=navigatorCreator;
        }
开发者ID:mcartoixa,项目名称:GeoSIK,代码行数:31,代码来源:ExpressionBuilderParameter.cs


示例19: ParseValue

 public override object ParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr)
 {
     object obj2;
     if ((s == null) || (s.Length == 0))
     {
         throw new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);
     }
     if (nsmgr == null)
     {
         throw new ArgumentNullException("nsmgr");
     }
     try
     {
         string str;
         obj2 = XmlQualifiedName.Parse(s.Trim(), nsmgr, out str);
     }
     catch (XmlSchemaException exception)
     {
         throw exception;
     }
     catch (Exception exception2)
     {
         throw new XmlSchemaException(Res.GetString("Sch_InvalidValue", new object[] { s }), exception2);
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:Datatype_QNameXdr.cs


示例20: OdtTemplate

        public OdtTemplate( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver,
		                    IXDocumentParserService xDocumentParserService )
            : base(documentInformation, xmlNamespaceResolver, xDocumentParserService)
        {
            ScriptSectionFormatting();
            ReplaceFields();
        }
开发者ID:EventBooking,项目名称:AntiShaun,代码行数:7,代码来源:OdtTemplate.cs



注:本文中的IXmlNamespaceResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IXmlNode类代码示例发布时间:2022-05-24
下一篇:
C# IXmlLineInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap