begin process at 2012 02 13 22:33:29
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Archive Visual Basic & VB.NET

 > 

Archives Visual Basic

 > 

J'AI BESOIN D'AIDE !!!! :)

 > 

fichier xml: lire les attributs


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

fichier xml: lire les attributs

vendredi 19 septembre 2003 à 09:00:56 | fichier xml: lire les attributs

chris21

bonjour à tous j'ai un fichier xml de ce type:[blue]<rutas>
<ruta tipo="central" url="/imagenes/home/home/directorio_gg/sansebastian03_gg.swf"
enlace="/edicion/cm/bin/"/>
<ruta tipo="central" url="/imagenes/home/home/directorio_mm/abajoelamor_mm.swf"
enlace="/edicion/cm/bin/"/>
<ruta tipo="central" url="/imagenes/home/home/directorio_mm/seanconnery_mm.swf"
enlace="/edicion/cm/bin/"/>
<ruta tipo="central" url="/imagenes/home/home/directorio_mm/soldadosdesalamina_mm.swf"
enlace="/edicion/cm/bin/"/>
<ruta tipo="central" url="/imagenes/home/home/directorio_mm/lascarasderipley_mm.swf"
enlace="/edicion/cm/bin"/>
<ruta tipo="promocion" url="/imagenes/home/home/directorio_g/cartelera_g.swf"/>
</rutas>
[blue]
En fait j'aimerais pouvoir lire les attributs de mes nodes et je n'y arrive pas.. Qu'elle est la syntaxe??
Merci
vendredi 19 septembre 2003 à 09:26:01 | Re : fichier xml: lire les attributs

Renfield

Administrateur CodeS-SourceS
as tu ajouté une reference a 'Microsoft XML' ?

ca te donnes acces a tout un tas de fonctions qui viendraient a bout de ton probleme.

By Renfield

mailto:thomas_reynald@msn.com

Aucune touche n'a été blessée lors de la saisie de ce texte..........


-------------------------------
Réponse au message :
-------------------------------

> bonjour à tous j'ai un fichier xml de ce type:[blue]<rutas>
> <ruta tipo="central" url="/imagenes/home/home/directorio_gg/sansebastian03_gg.swf"
> enlace="/edicion/cm/bin/"/>
> <ruta tipo="central" url="/imagenes/home/home/directorio_mm/abajoelamor_mm.swf"
> enlace="/edicion/cm/bin/"/>
> <ruta tipo="central" url="/imagenes/home/home/directorio_mm/seanconnery_mm.swf"
> enlace="/edicion/cm/bin/"/>
> <ruta tipo="central" url="/imagenes/home/home/directorio_mm/soldadosdesalamina_mm.swf"
> enlace="/edicion/cm/bin/"/>
> <ruta tipo="central" url="/imagenes/home/home/directorio_mm/lascarasderipley_mm.swf"
> enlace="/edicion/cm/bin"/>
> <ruta tipo="promocion" url="/imagenes/home/home/directorio_g/cartelera_g.swf"/>
> </rutas>
> [blue]
> En fait j'aimerais pouvoir lire les attributs de mes nodes et je n'y arrive pas.. Qu'elle est la syntaxe??
> Merci
vendredi 19 septembre 2003 à 09:31:32 | Re : fichier xml: lire les attributs

chris21



oui bien sûr, j'arrive à lire le xml, mais pas à séparer les éléments. j'arrive à compter le nombre de nodes, etc... mais je trouve l'aide pas très claire.

-------------------------------
Réponse au message :
-------------------------------

> as tu ajouté une reference a 'Microsoft XML' ?
>
> ca te donnes acces a tout un tas de fonctions qui viendraient a bout de ton probleme.
>
> By Renfield
>
> mailto:thomas_reynald@msn.com
>
> Aucune touche n'a été blessée lors de la saisie de ce texte..........
>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > bonjour à tous j'ai un fichier xml de ce type:[blue]<rutas>
> > <ruta tipo="central" url="/imagenes/home/home/directorio_gg/sansebastian03_gg.swf"
> > enlace="/edicion/cm/bin/"/>
> > <ruta tipo="central" url="/imagenes/home/home/directorio_mm/abajoelamor_mm.swf"
> > enlace="/edicion/cm/bin/"/>
> > <ruta tipo="central" url="/imagenes/home/home/directorio_mm/seanconnery_mm.swf"
> > enlace="/edicion/cm/bin/"/>
> > <ruta tipo="central" url="/imagenes/home/home/directorio_mm/soldadosdesalamina_mm.swf"
> > enlace="/edicion/cm/bin/"/>
> > <ruta tipo="central" url="/imagenes/home/home/directorio_mm/lascarasderipley_mm.swf"
> > enlace="/edicion/cm/bin"/>
> > <ruta tipo="promocion" url="/imagenes/home/home/directorio_g/cartelera_g.swf"/>
> > </rutas>
> > [blue]
> > En fait j'aimerais pouvoir lire les attributs de mes nodes et je n'y arrive pas.. Qu'elle est la syntaxe??
> > Merci
>
vendredi 19 septembre 2003 à 10:11:22 | Re : fichier xml: lire les attributs

Renfield

Administrateur CodeS-SourceS
J'ai mis ton fichier dans un fichier.xml, et j'ai fais ca :


Private Sub Form_Load()
Dim XML As New DOMDocument30
XML.Load App.Path & "\Fil.xml"

Dim Rutas As IXMLDOMNode
Set Rutas = XML.firstChild

Dim Node As IXMLDOMNode

For Each Node In Rutas.childNodes
Debug.Print "Ruta", "tipo = " & NodeAttribute(Node, "tipo"), "url = " & NodeAttribute(Node, "url"), "enlace = " & NodeAttribute(Node, "enlace")
Next Node
End
End Sub

Function NodeAttribute(lNode As IXMLDOMNode, AttributeName As String) As String
Dim NodeAtt As IXMLDOMAttribute
For Each NodeAtt In lNode.Attributes
If NodeAtt.Name = AttributeName Then
NodeAttribute = NodeAtt.Text
Exit Function
End If
Next NodeAtt
Set NodeAtt = Nothing
End Function


By Renfield

mailto:thomas_reynald@msn.com

Aucune touche n'a été blessée lors de la saisie de ce texte..........
vendredi 19 septembre 2003 à 10:28:06 | Re : fichier xml: lire les attributs

chris21

ça ne marche pas chez moi, t'as mis quoi comme référence? j'ai ajouté microsoft ado et microsoft xml 2.0.
merci pour ton aide



-------------------------------
Réponse au message :
-------------------------------

> J'ai mis ton fichier dans un fichier.xml, et j'ai fais ca :
>
>

> Private Sub Form_Load()
> Dim XML As New DOMDocument30
> XML.Load App.Path & "\Fil.xml"
>
> Dim Rutas As IXMLDOMNode
> Set Rutas = XML.firstChild
>
> Dim Node As IXMLDOMNode
>
> For Each Node In Rutas.childNodes
> Debug.Print "Ruta", "tipo = " & NodeAttribute(Node, "tipo"), "url = " & NodeAttribute(Node, "url"), "enlace = " & NodeAttribute(Node, "enlace")
> Next Node
> End
> End Sub
>
> Function NodeAttribute(lNode As IXMLDOMNode, AttributeName As String) As String
> Dim NodeAtt As IXMLDOMAttribute
> For Each NodeAtt In lNode.Attributes
> If NodeAtt.Name = AttributeName Then
> NodeAttribute = NodeAtt.Text
> Exit Function
> End If
> Next NodeAtt
> Set NodeAtt = Nothing
> End Function
>

>
> By Renfield
>
> mailto:thomas_reynald@msn.com
>
> Aucune touche n'a été blessée lors de la saisie de ce texte..........
>
vendredi 19 septembre 2003 à 11:22:27 | Re : fichier xml: lire les attributs

chris21

j'ai trouvé, par exemple pour afficher les url dans un msgbox, voici mon code:
Function chargement(fichero)
Dim numerorutas As Integer
Dim i As Integer
Dim objxml As New MSXML.DOMDocument
Dim xmllist As MSXML.IXMLDOMNodeList
Dim xmlnode As MSXML.IXMLDOMNode
Dim argumentos As MSXML.IXMLDOMAttribute
objxml.validateOnParse = False
objxml.async = False
If objxml.Load(Dir1.Path & "\" & fichero) Then
'MsgBox ("objxml.Text " & objxml.Text)
Set xmllist = objxml.selectNodes("//rutas/ruta")
'MsgBox argumentos
numerorutas = xmllist.length
MsgBox ("xmllist.lenght " & numerorutas)
For Each xmlnode In xmllist
Set argumentos = xmlnode.Attributes(1)
MsgBox argumentos.Text
'MsgBox ("xmlnode.Text " & xmlnode.Text)
i = i + 1
Next
MsgBox ("numero de attributos " & i)
On Error GoTo ErrorHandler
objxml.validateOnParse = True
Else
MsgBox "res"
End If
Set objxml = Nothing
Exit Function
ErrorHandler:
MsgBox Err.Description
Set objxml = Nothing
End Function




Cette discussion est classée dans : fichier, lire, xml, blue, attributs


Répondre à ce message

Sujets en rapport avec ce message

Lire une donnée dans un fichier XML [ par Jielde ] Bonjour à tous,Je cherche a pouvoir lire une donnée particulier dans un fichier XML :            <save file="c:\tes Je cherche a lire un fichier XML...en VB [ par emouchet ] Je sais qu'il y en a qui l'on surement dejà fait mais bon ...Voici un exemple de fichier XML que j'ai a traiter.<br Lire les attributs d'un fichier video, image .. [ par htixier ] Comment lire les attributs d'un fichier video, image, en particulier : Dimensions et modele d'appareil photo ...Merci d'avance aide lire fichier xml [ par sm2r91 ] salut super ce site je voudrais un peu d'aide mais beaucoup je pense je suis debutant en prog.j'utilise visual basic 6je voudrais creer un exe qui pou lire du xml [ par snarkpit29 ] Bonjours je n'arrive plus a lire un fichier xml auparavant j'utilisé ce code la la version du xml était mais maintenant la version a changé vb m lire un fichier Xml en c++ [ par Hullabaloo ] Comment lire un fichier xml en c++? quel librairie?(mon application est multiplateforme)merci lire fichier xml [ par simon0000 ] salut,j'ai un fichier xml dans mon site :site1site2comment je peux faire en vb pour Lire.Ecrire des fichiers .xml en C++ [ par marsaimo ] Bonjour, J'aimerais savoir s'il y'a un .h dans la librairie C++ qui permet de lire (parser) un fichier XML et surtout de le creer. je voudrais par e Lire fichier xml [ par pinje ] Bonjour a tous!je lis un fichier xml en utilisant Xpath du genre:Xpath="//Isis2dInputFile/Property/Beta"Myxnode = xtd.SelectSingleNode(MyXpath)Beta = [vb6] Probleme lire fichier xml [ par dirickles ] slt a ts,j ai un gros probleme pour extraire des données d un fichier xml que je créais.voici mon fichier xml : ?            0</REPONS


Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,733 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales