Hey alles, was ich habe den folgenden Code, den ich in Not bin, die Klasse zu finden in:Parsen von XML mit Klasse, die eindeutig nummeriert sind
Dim nodelist As System.Xml.XmlNodeList = Nothing
Dim doc As New System.Xml.XmlDocument()
doc.LoadXml(tmpData)
nodelist = doc.SelectNodes("//entry/content/sp_0:div/span/sp_0:span")
For Each node As System.Xml.XmlElement In nodelist
Debug.print(node("OrderID").InnerText)
Next
Und die XML sieht wie folgt aus:
<feed
xmlns:app="http://www.w3.org/2007/app"
xmlns:thr="http://purl.org/syndication/thread/1.0"
xmlns:fh="http://purl.org/syndication/history/1.0"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns="http://www.w3.org/2005/Atom">
<id>2006:feed</id>
<generator version="5.0.0.0" uri="http://www.ibm.com/xmlns/prod/sn">IBM Connections - Profiles</generator>
<title type="text">reporting chain for Bill Gates</title>
<opensearch:itemsPerPage>8</opensearch:itemsPerPage>
<fh:complete></fh:complete>
<link
href="http://..."
rel="self"
type="application/atom+xml"></link>
<entry>
<id>tag:profiles.ibm.com,2006</id>
<title type="text">Bill Gates</title>
<updated>2016-05-11T06:39:54.908Z</updated>
<category term="profile" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<contributor>
<name>Bill Gates</name>
<snx:userid>010101</snx:userid>
<email>[email protected]</email>
<snx:userState>active</snx:userState>
<snx:isExternal>false</snx:isExternal>
</contributor>
<link
href="http://..."
rel="http://www.ibm.com/xmlns/prod/sn/profile-type"
type="application/profile-type+xml"></link>
<thr:in-reply-to>
<app:accept>ref</app:accept>
<app:accept>tag:profiles.ibm.com,2006</app:accept>
</thr:in-reply-to>
<summary type="text">Profile information for Bill Gates</summary>
<content type="xhtml">
<sp_0:div
xmlns="http://www.w3.org/1999/xhtml"
xmlns:sp_0="http://www.w3.org/1999/xhtml">
<sp_0:span class="vcard">
<sp_0:div class="x-groupwareMail" style="display:none"></sp_0:div>
<sp_0:div class="org">
<sp_0:span class="organization-unit"></sp_0:span>
</sp_0:div>
<sp_0:div class="role"></sp_0:div>
<sp_0:div class="title">Applications Developer/Analyst</sp_0:div>
<sp_0:div class="uid">265418</sp_0:div>
<sp_0:div class="x-profile-uid">010101</sp_0:div>
<sp_0:div class="x-lconn-userid">265418</sp_0:div>
</sp_0:span>
</sp_0:div>
</content>
</entry>
<entry>
etc....
</entry>
</feed>
ich erhalte eine Fehlermeldung auf Nodelist = doc.SelectNodes ("// Eintrag/content/sp_0: div/span/sp_0: span") sagen:
Namespace-Manager oder XsltContext erforderlich. Diese Abfrage hat ein Präfix, eine Variable oder eine benutzerdefinierte Funktion.
Wie kann ich den internen Text von dieser Klasse bekommen?
Mögliches Duplikat von [Verwendung von XPath und VB.NET zum Parsen von XML mit Namespaces] (http://stackoverflow.com/questions/16949495/using-xpath-and-vb-net-to-parse-xml-containing- namespsaces) – DWRoelands
@DWRoelands ** nicht ** ein Duplikat aufgrund der besagten Frage unterschiedlicher Klassenwertnamen. – StealthRT