Get XML Namespace QName - CSharp System.Xml

CSharp examples for System.Xml:XML Namespace

Description

Get XML Namespace QName

Demo Code

// Copyright (c) Microsoft. All rights reserved.
using System.Xml.Xsl;
using System.Xml.XPath;
using System.Xml;
using System.Text;
using System.Security.Policy;
using System.Reflection;
using System.IO;//  ww w . j av a 2 s  .  c  o m
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Collections;
using System;

public class Main{
        public static string GetQName(XmlTextReader r, XmlNamespaceManager nsmgr)
        {
            string prefix = !String.IsNullOrEmpty(r.Prefix) ? r.Prefix : nsmgr.LookupPrefix(r.NamespaceURI);
            if (!String.IsNullOrEmpty(prefix))
                return prefix + ":" + r.LocalName;
            else
                return r.LocalName;
        }
}

Related Tutorials