Je bloque sur cette histoire de namespace , je pense !!
Je voudrais lire un fichier XML qui contient du balisage SVG.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.2" width="149.2mm" height="211.7mm" viewBox="0 0 14920 21170" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve">
<defs>...</svg>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.2" width="149.2mm" height="211.7mm" viewBox="0 0 14920 21170" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve">
<defs>...</svg>
$oXML = ObjCreate('Msxml2.DOMDocument.6.0')
; Setting File IN/OUT
$Fichierin="e:\in.svg"
$Fichierout= StringReplace($Fichierin,".","-maj.")
; Calling XML File
$oXML.load($Fichierin)
$oXML.setProperty("SelectionLanguage", "XPath")
$strNameSpc = "xmlns:svg='http://www.w3.org/2000/svg'"
$oXML.setProperty("SelectionNamespaces", $strNameSpc)
$oRoot = $oXML.selectSingleNode("//svg:defs")
ConsoleWrite("$oRoot.xml=[" & $oRoot.xml & "]" & @CRLF)
; Setting File IN/OUT
$Fichierin="e:\in.svg"
$Fichierout= StringReplace($Fichierin,".","-maj.")
; Calling XML File
$oXML.load($Fichierin)
$oXML.setProperty("SelectionLanguage", "XPath")
$strNameSpc = "xmlns:svg='http://www.w3.org/2000/svg'"
$oXML.setProperty("SelectionNamespaces", $strNameSpc)
$oRoot = $oXML.selectSingleNode("//svg:defs")
ConsoleWrite("$oRoot.xml=[" & $oRoot.xml & "]" & @CRLF)
Par contre, si je supprime l’entête du fichier SVG comme ceci:
<svg version="1.2" width="149.2mm" height="211.7mm" viewBox="0 0 14920 21170" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve">
<defs>... </svg>
<defs>... </svg>
C'est ok j'ai bien le fichier XML qui peut être utilisé dans Autoit.
Auriez-vous des pistes de recherche ?
Merci par avance
