Using the Xml name space in the query : XNamespace « XML LINQ « VB.Net






Using the Xml name space in the query

    

Imports System
Imports System.Reflection
Imports System.Xml

Module Module1

    Sub Main()
        Dim xml As XElement = XElement.Load("XLINQ.xml")
        Dim o As XNamespace = "urn:schemas-microsoft-com:office:office"

        Dim query = From w In xml.Descendants(o + "Author") _
            Select w

        For Each record In query
            Console.WriteLine("Author: {0}", record.Value)
        Next

    End Sub
End Module

   
    
    
    
  








Related examples in the same category

1.Import namespace
2.XNamespace Class represents an XML namespace.
3.Combines an XNamespace object with a local name to create an XName.
4.Returns a value indicating whether two instances of XNamespace are equal.
5.XNamespace.Equals determines whether the specified XNamespace is equal to the current XNamespace.
6.XNamespace.Get gets an XNamespace for the specified Uniform Resource Identifier (URI).
7.XNamespace.GetName returns an XName object created from this XNamespace and the specified local name.
8.XNamespace.Inequality Operator
9.XNamespace.NamespaceName Property gets the Uniform Resource Identifier (URI) of this namespace.
10.XNamespace.None Property gets the XNamespace object that corresponds to no namespace.
11.XNamespace.ToString returns the URI of this XNamespace.
12.XNamespace.Xml Property gets the XNamespace object that corresponds to the XML URI (http://www.w3.org/XML/1998/namespace).
13.XNamespace.Xmlns Property gets the XNamespace object that corresponds to the xmlns URI (http://www.w3.org/2000/xmlns/).
14.XNamespace Implicit Conversion (String to XNamespace)
15.Selects an XElement using a XPath expression, resolving namespace prefixes using the specified IXmlNamespaceResolver.
16.Extensions.XPathSelectElement selects XElement using a XPath expression, resolving namespace prefixes using the specified IXmlNamespaceResolver.
17.XElement with namespace
18.XElement.GetDefaultNamespace gets the default XNamespace of this XElement.
19.XElement.GetNamespaceOfPrefix gets the namespace associated with a particular prefix for this XElement.
20.XElement.GetPrefixOfNamespace gets the prefix associated with a namespace for this XElement.
21.Imports namespace for XElement
22.Check for namespace for XElement
23.Add namespace to XElement
24.Reference namespace in XElement
25.IEnumerable with namespace