当前位置: 首页>>代码示例>>C#>>正文


C# XmlNodeType.ToString方法代码示例

本文整理汇总了C#中System.Xml.XmlNodeType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNodeType.ToString方法的具体用法?C# XmlNodeType.ToString怎么用?C# XmlNodeType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNodeType的用法示例。


在下文中一共展示了XmlNodeType.ToString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestOnInvalidNodeType

 protected void TestOnInvalidNodeType(XmlNodeType nt)
 {
     XmlReader DataReader = GetReader(pBase64Xml);
     PositionOnNodeType(DataReader, nt);
     if (!DataReader.CanReadBinaryContent) return;
     try
     {
         byte[] buffer = new byte[1];
         int nBytes = DataReader.ReadContentAsBase64(buffer, 0, 1);
     }
     catch (InvalidOperationException ioe)
     {
         if (ioe.ToString().IndexOf(nt.ToString()) < 0)
             TestLog.Compare(false, "Call threw wrong invalid operation exception on " + nt);
         else
             return;
     }
     TestLog.Compare(false, "Call succeeded on " + nt);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:19,代码来源:ReadBase64.cs

示例2: TestOnInvalidNodeType

 protected void TestOnInvalidNodeType(XmlNodeType nt)
 {
     ReloadSource();
     PositionOnNodeType(nt);
     if (CheckCanReadBinaryContent()) return;
     try
     {
         byte[] buffer = new byte[1];
         int nBytes = DataReader.ReadContentAsBase64(buffer, 0, 1);
     }
     catch (InvalidOperationException ioe)
     {
         if (ioe.ToString().IndexOf(nt.ToString()) < 0)
             CError.Compare(false, "Call threw wrong invalid operation exception on " + nt);
         else
             return;
     }
     CError.Compare(false, "Call succeeded on " + nt);
 }
开发者ID:jmhardison,项目名称:corefx,代码行数:19,代码来源:ReadBase64.cs

示例3: CreateReadElementContentAsException

 internal static Exception CreateReadElementContentAsException(string methodName, XmlNodeType nodeType, IXmlLineInfo lineInfo)
 {
     return new InvalidOperationException(AddLineInfo(Res.GetString("Xml_InvalidReadElementContentAs", new string[] { methodName, nodeType.ToString() }), lineInfo));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:XmlReader.cs

示例4: CreateReadElementContentAsException

 static internal Exception CreateReadElementContentAsException(string methodName, XmlNodeType nodeType, IXmlLineInfo lineInfo)
 {
     return new InvalidOperationException(AddLineInfo(SR.Format(SR.Xml_InvalidReadElementContentAs, methodName, nodeType.ToString()), lineInfo));
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:4,代码来源:XmlReader.cs

示例5: CreateNode

		public virtual XmlNode CreateNode (
			XmlNodeType type,
			string prefix,
			string name,
			string namespaceURI)
		{
			switch (type) {
				case XmlNodeType.Attribute: return CreateAttribute (prefix, name, namespaceURI);
				case XmlNodeType.CDATA: return CreateCDataSection (null);
				case XmlNodeType.Comment: return CreateComment (null);
				case XmlNodeType.Document: return new XmlDocument ();
				case XmlNodeType.DocumentFragment: return CreateDocumentFragment ();
				case XmlNodeType.DocumentType: return CreateDocumentType (null, null, null, null);
				case XmlNodeType.Element: return CreateElement (prefix, name, namespaceURI);
				case XmlNodeType.EntityReference: return CreateEntityReference (null);
				case XmlNodeType.ProcessingInstruction: return CreateProcessingInstruction (null, null);
				case XmlNodeType.SignificantWhitespace: return CreateSignificantWhitespace (String.Empty);
				case XmlNodeType.Text: return CreateTextNode (null);
				case XmlNodeType.Whitespace: return CreateWhitespace (String.Empty);
				case XmlNodeType.XmlDeclaration: return CreateXmlDeclaration ("1.0", null, null);
				default:
#if NET_2_0
					throw new ArgumentException (
#else // makes less sense
					throw new ArgumentOutOfRangeException (
#endif
						String.Format("{0}\nParameter name: {1}",
							 "Specified argument was out of the range of valid values", type.ToString ()));
			}
		}
开发者ID:nzaugg,项目名称:mono,代码行数:30,代码来源:XmlDocument.cs

示例6: InitFragmentReader

        private void InitFragmentReader(XmlNodeType fragmentType, XmlParserContext parserContext, bool allowXmlDeclFragment)
        {
            _fragmentParserContext = parserContext;

            if (parserContext != null)
            {
                if (parserContext.NamespaceManager != null)
                {
                    _namespaceManager = parserContext.NamespaceManager;
                    _xmlContext.defaultNamespace = _namespaceManager.LookupNamespace(string.Empty);
                }
                else
                {
                    _namespaceManager = new XmlNamespaceManager(_nameTable);
                }

                _ps.baseUriStr = parserContext.BaseURI;
                _ps.baseUri = null;
                _xmlContext.xmlLang = parserContext.XmlLang;
                _xmlContext.xmlSpace = parserContext.XmlSpace;
            }
            else
            {
                _namespaceManager = new XmlNamespaceManager(_nameTable);
                _ps.baseUriStr = string.Empty;
                _ps.baseUri = null;
            }

            _reportedBaseUri = _ps.baseUriStr;

            switch (fragmentType)
            {
                case XmlNodeType.Attribute:
                    _ps.appendMode = false;
                    _parsingFunction = ParsingFunction.SwitchToInteractive;
                    _nextParsingFunction = ParsingFunction.FragmentAttribute;
                    break;
                case XmlNodeType.Element:
                    Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl);
                    _nextParsingFunction = ParsingFunction.DocumentContent;
                    break;
                case XmlNodeType.Document:
                    Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl);
                    Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent);
                    break;
                case XmlNodeType.XmlDeclaration:
                    if (allowXmlDeclFragment)
                    {
                        _ps.appendMode = false;
                        _parsingFunction = ParsingFunction.SwitchToInteractive;
                        _nextParsingFunction = ParsingFunction.XmlDeclarationFragment;
                        break;
                    }
                    else
                    {
                        goto default;
                    }
                default:
                    Throw(SR.Xml_PartialContentNodeTypeNotSupportedEx, fragmentType.ToString());
                    return;
            }
            _fragmentType = fragmentType;
            _fragment = true;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:64,代码来源:XmlTextReaderImpl.cs

示例7: UnexpectedNodeType

#pragma warning restore 618

        static internal Exception UnexpectedNodeType(XmlNodeType nodetype)
        {
            return new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, SR.Xml_UnexpectedNodeType, nodetype.ToString()));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:6,代码来源:XmlLoader.cs

示例8: PositionOnNodeType

        //////////////////////////////////////////
        // PositionOnNodeType
        //////////////////////////////////////////
        public void PositionOnNodeType(XmlNodeType nodeType)
        {
            CError.WriteLine("Seeking Nodetype : " + nodeType.ToString());

            if (NodeType == nodeType)
                return;

            while (Read() && NodeType != nodeType)
            {
                if (NodeType == XmlNodeType.EntityReference)
                {
                    if (CanResolveEntity)
                        ResolveEntity();
                }
                if (nodeType == XmlNodeType.ProcessingInstruction && NodeType == XmlNodeType.XmlDeclaration)
                {
                    if (String.Compare(Name, 0, ST_XML, 0, 3) != 0)
                        return;
                }
                if (NodeType == XmlNodeType.Element && nodeType == XmlNodeType.Attribute)
                {
                    if (MoveToFirstAttribute())
                    {
                        return;
                    };
                }
            }
            if (EOF)
            {
                throw new CTestException(CTestBase.TEST_FAIL, "Couldn't find XmlNodeType " + nodeType);
            }
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:35,代码来源:CDataReader.cs

示例9: UnexpectedNodeType

 void UnexpectedNodeType(XmlNodeType type)
 {
     IXmlLineInfo li = (IXmlLineInfo)reader;
     throw new XmlException(string.Format(SR.UnexpectedNodeType, type.ToString()), null,
         li.LineNumber, li.LinePosition);
 }
开发者ID:ic014308,项目名称:xml-notepad-for-mono,代码行数:6,代码来源:DomLoader.cs

示例10: CreateReadElementContentAsException

 static internal Exception CreateReadElementContentAsException(string methodName, XmlNodeType nodeType)
 {
     return new InvalidOperationException(Res.GetString(Res.Xml_InvalidReadElementContentAs, new string[] { methodName, nodeType.ToString() }));
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:4,代码来源:XmlReader.cs

示例11: UnexpectedNodeType

 internal static Exception UnexpectedNodeType(XmlNodeType nodetype)
 {
     return new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Res.GetString("Xml_UnexpectedNodeType"), new object[] { nodetype.ToString() }));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:XmlLoader.cs

示例12: CreateXElement

        /// <summary>
        /// 
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        protected XElement CreateXElement(string name, XmlNodeType type)
        {
            if (_mode.Equals(XmlNodeMode.type))
            {
                XElement element = new XElement(type.ToString());
                element.SetAttributeValue("name", name);
                element.SetAttributeValue("type", type.ToString());

                return element;
            }

            if (_mode.Equals(XmlNodeMode.xPath))
            {
                XElement element = new XElement(name.Replace(" ", ""));
                element.SetAttributeValue("type", type.ToString());

                return element;
            }

            return null;
        }
开发者ID:BEXIS2,项目名称:Core,代码行数:29,代码来源:XmlWriter.cs

示例13: AddCodeProperty

        private static void AddCodeProperty(
            string nodeName,
            XmlNodeType nodeType,
            CodeTypeReference propertyType,
            CodeTypeDeclaration classType,
            bool collection,
            string nameSpaceName)
        {
            string propertyVariableName = CodePrivateNameFromRssName(nodeName);
            string propertyName = CodeNameFromRssName(nodeName);

            if (collection)
            {
                propertyVariableName = Pluralizer.ToPlural(propertyVariableName);
                propertyName = Pluralizer.ToPlural(propertyName);
                propertyType = new CodeTypeReference(
                    "List",
                    new CodeTypeReference[1] { propertyType });
            }

            bool alreadyThere = TypeContainsProperty(classType, propertyVariableName);
            if (alreadyThere)
                return;

            classType.Members.Add(new CodeMemberField(propertyType, propertyVariableName));

            CodeMemberProperty property = new CodeMemberProperty();
            property.Attributes &= ~MemberAttributes.AccessMask;
            property.Attributes |= MemberAttributes.Public;
            property.Name = propertyName;
            property.Type = propertyType;

            // prevent warnings for RssDocumentBase properties
            if (propertyName.Equals("Version", StringComparison.Ordinal)
                || propertyName.Equals("Channel", StringComparison.Ordinal))
            {
                property.Attributes |= MemberAttributes.New;
            }

            CodeAttributeDeclaration cad;
            if (nodeType != XmlNodeType.Text)
            {
                 cad = new CodeAttributeDeclaration(
                     "Xml" + nodeType.ToString(),
                     new CodeAttributeArgument(new CodePrimitiveExpression(nodeName)));
            }
            else
            {
                cad = new CodeAttributeDeclaration("Xml" + nodeType.ToString());
            }

            if (!String.IsNullOrEmpty(nameSpaceName))
            {
                cad.Arguments.Add(new CodeAttributeArgument("Namespace", new CodePrimitiveExpression(nameSpaceName)));
            }

            property.CustomAttributes.Add(cad);

            property.GetStatements.Add(new CodeMethodReturnStatement(new CodeVariableReferenceExpression(propertyVariableName)));
            property.SetStatements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(propertyVariableName), new CodeArgumentReferenceExpression("value")));

            classType.Members.Add(property);
        }
开发者ID:Throy,项目名称:derp-octo-robot,代码行数:63,代码来源:RssCodeGenerator.cs


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