j'ai besoin de parser le fichier install.rdf qui se trouve dans les extensions Mozilla afin de récupérer son id
Le fichier install.rdf est un fichier XML et je souhaite récupérer ce qui est en rouge gras.
J'ai bien essayé d'utiliser le parser XML de cette page http://www.autoitscript.com/forum/topic ... apper-com/ mais sans vraiment comprendre comment ça fonctionne
Si vous avez une solution, je suis preneur
Contenu du fichier install.rdf
Code : Tout sélectionner
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[b][color=#FF0000]{972ce4c6-7e08-4474-a285-3208198ce6fd}[/color][/b]</em:id>
<em:version>9.0.1</em:version>
<!-- Target Application this theme can install into,
with minimum and maximum supported versions. -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>9.0.1</em:minVersion>
<em:maxVersion>9.0.1</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Default</em:name>
<em:description>The default theme.</em:description>
<!-- Front End Integration Hooks (used by Theme Manager)-->
<em:creator>Mozilla</em:creator>
<em:contributor>Mozilla Contributors</em:contributor>
<!-- Allow lightweight themes to apply to this theme -->
<em:skinnable>true</em:skinnable>
<em:internalName>classic/1.0</em:internalName>
</Description>
</RDF>
Solution
Code : Tout sélectionner
#include <_XMLDOMWrapper.au3>
msgbox(0,"install.rdf id",_ParseRDF("install.rdf"))
Func _ParseRDF($file)
$xmlFile = FileRead($file)
$xmlFile = StringReplace($xmlFile,'xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"',"")
$xmlNamespace = 'xmlns:em="http://www.mozilla.org/2004/em-rdf#"'
If _XMLLoadXML($xmlFile, $xmlNamespace) Then
$ret = _XMLGetValue("/RDF/Description/em:id")
If UBound($ret)<>2 Then Return False
Return $ret[1]
EndIf
Return False
EndFunc



