Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SelectSingleNode returns nothing
Message
De
17/12/2008 12:03:20
 
 
À
16/12/2008 16:16:58
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01367955
Message ID:
01368181
Vues:
9
This message has been marked as the solution to the initial question of the thread.
>I have an xml file as follows:
><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gbs="http://schemas.google.com/books/2008" xmlns:dc="http://purl.org/dc/terms" xmlns:gd="http://schemas.google.com/g/2005">
>  <id>http://www.google.com/books/feeds/volumes</id>
>  <updated>2008-12-16T20:16:35.000Z</updated>
>  <entry>
>    <title type="text">Beginning SQL Server 2000 Programming</title>
>    <gbs:embeddability value="http://schemas.google.com/books/2008#not_embeddable" />
>    <gbs:openAccess value="http://schemas.google.com/books/2008#disabled" />
>    <dc:creator>Robin Dewson</dc:creator>
>    <dc:date>2003-08-27</dc:date>
>    <dc:description>By the end of this book, youll have a firm grasp of the most important SQL Serverfeatures and be able to develop your own effective database solutions.</dc:description>
>    <dc:format>792 pages</dc:format>
>    <dc:identifier>ISBN:1590592522</dc:identifier>
>    <dc:identifier>ISBN:9781590592526</dc:identifier>
>    <dc:title>Beginning SQL Server 2000 Programming</dc:title>
>  </entry>
></feed>
>
>
Hi,

Don't use String.Empty - see changes:

>and the following code
        Dim xd As New XmlDocument
        xd.Load(MapPath("") + "/xml.xml")
        Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xd.NameTable)
        nsmgr.AddNamespace("xx", "http://www.w3.org/2005/Atom")
        nsmgr.AddNamespace("openSearch", "http://a9.com/-/spec/opensearchrss/1.0/")
        nsmgr.AddNamespace("gbs", "http://schemas.google.com/books/2008")
        nsmgr.AddNamespace("dc", "http://purl.org/dc/terms")
        nsmgr.AddNamespace("gd", "http://schemas.google.com/g/2005")
       Dim oroot As XmlNode = xd.FirstChild
       Dim oEntry As XmlNode = oroot.SelectSingleNode("xx:entry",nsMgr)
>
>oEntry is null
>
>Please help I don't seem to know what I am doing any more!!!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform