System.Xml.XmlLoader.ParseXmlDeclarationValue C# (CSharp) Méthode

ParseXmlDeclarationValue() static private méthode

static private ParseXmlDeclarationValue ( string strValue, string &version, string &encoding, string &standalone ) : void
strValue string
version string
encoding string
standalone string
Résultat void
        internal static void ParseXmlDeclarationValue(string strValue, out string version, out string encoding, out string standalone)
        {
            version = null;
            encoding = null;
            standalone = null;
            XmlTextReaderImpl tempreader = new XmlTextReaderImpl(strValue, (XmlParserContext)null);
            try
            {
                tempreader.Read();
                //get version info.
                if (tempreader.MoveToAttribute(nameof(version)))
                    version = tempreader.Value;
                //get encoding info
                if (tempreader.MoveToAttribute(nameof(encoding)))
                    encoding = tempreader.Value;
                //get standalone info
                if (tempreader.MoveToAttribute(nameof(standalone)))
                    standalone = tempreader.Value;
            }
            finally
            {
                tempreader.Close();
            }
        }

Usage Example

        internal override void WriteXmlDeclaration(string xmldecl)
        {
            VerifyState(Method.WriteXmlDeclaration);
            string?version, encoding, standalone;

            XmlLoader.ParseXmlDeclarationValue(xmldecl, out version, out encoding, out standalone);
            XmlNode node = _document.CreateXmlDeclaration(version !, encoding, standalone);

            AddChild(node, _write);
        }
All Usage Examples Of System.Xml.XmlLoader::ParseXmlDeclarationValue