Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
Leggere un file xml ed utilizzo di XmlNameSpaceManager
venerdì 26 aprile 2013 - 10.28
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
Elenco Tags
C#
|
.NET 4.0
svipla
Profilo
| Senior Member
361
messaggi | Data Invio:
ven 26 apr 2013 - 10:28
Ciao a tutti
devo leggere il file xml di youtube con tutte le categorie dei video.
Il file ha questa struttura:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<app:categories xmlns:app=\"
http://www.w3.org/2007/app
\" xmlns:atom=\"
http://www.w3.org/2005/Atom
\" xmlns:yt=\"
http://gdata.youtube.com/schemas/2007
\" fixed=\"yes\" scheme=\"
http://gdata.youtube.com/schemas/2007/categories.cat
\">
<atom:category term=\"Film\" label=\"Film e animazione\" xml:lang=\"it-IT\">
<yt:assignable />
<yt:browsable regions=\"AE AR AT AU BD BE BG BH BR CA CH CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO JP KE KR KW LT LV MA MX MY NG NL NO NZ OM PE PH PK PL PT QA RO RS RU SA SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE ZA\" />
</atom:category>
...
</app:categories>
Fino ad oggi per leggere un file xml ho utilizzato questo codice:
WebRequest myRequest = WebRequest.Create(urlCategoryList);
WebResponse myResponse = myRequest.GetResponse();
Stream stream = myResponse.GetResponseStream();
XmlDocument doc = new XmlDocument();
doc.Load(stream);
XmlNodeList items = doc.SelectNodes("app:categories/atom:category");
foreach (XmlNode item in items)
{
tipoYouTubeCategory categoria = new tipoYouTubeCategory();
categoria.Term = item.Attributes["term"].ToString();
categoria.Label = item.Attributes["label"].ToString();
categorie.Add(categoria);
}
ma ora ricevo questo errore:
Richiesto gestore dello spazio dei nomi o XsltContext. Query con prefisso, variabile o funzione definita dall'utente.
Ho trovato in rete una possibile soluzione che suggerisce di utilizzare la classe XmlNameSpaceManager , ma non ci ho capito molto.
Grazie mille
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !