From: Stéphanie LOPERA (stephanie.lopera@lafon.fr)
Date: 05/04/2002 - 10:26
Quand tu télécharge une ressource sur le Web, il faut mettre
oXmlData.async = true
puis attendre l'évènement qui t'indique que le document est chargé.
Extrait de la doc :
"When set to True, the load method returns control to the caller before the
download is finished. You can then use the readyState property to check the
status of the download. You can also attach an onreadystatechange handler or
connect to the onreadystatechange event to be notified when the ready state
changes so that you know when the download is complete."
Autre extrait (pour télécharger une ressource Web):
<script>
var xmldoc;
function Load(){
xmldoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmldoc.onreadystatechange = CheckState;
xmldoc.load(URL.value);
}
function CheckState(){
var state = xmldoc.readyState;
RESULTS.innerHTML += "readyState = " + state + "<BR>"
if (state == 4){
var err = xmldoc.parseError;
if (err.errorCode != 0)
RESULTS.innerHTML += err.reason + "<BR>"
else RESULTS.innerHTML += "Success" + "<BR>"
}
}
</script>
URL: <input type=text size=60 id=URL><input type=button value=LOAD
onclick=jscript:Load()>
<div id=RESULTS style="color:red; font-weight:bold;"></div></script>
J'espère t'avoir aidé.
Stéphanie LOPERA
Bureau d'Etudes Informatique
LAFON SA - BASSENS (33)
"Gregoor, Van Der Eyken" a écrit :
> bonjour
>
> un exemple de transformation tres simple du fichier menu.xml :
>
> http://msdn.microsoft.com/menu.xml
>
> fonctionne en local, qd je ramene ce fichier Xml
>
> en revanche la transformation echoue lorque j'utilise directement l'url
>
> pourquoi ?
>
> <%
> dim sUrlData
> dim sUrlFormat
> sUrlData="menus.xml"
> 'sUrlData="http://msdn.microsoft.com/menu.xml"
> sUrlFormat= "menus.xsl"
>
> Set oXmlData=Server.CreateObject("Msxml2.DOMdocument.3.0")
> Set oXmlFormat=Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
> Set oXmlTemp=Server.CreateObject("MSXML2.XSLTemplate.3.0")
>
> Dim oXmlProc
>
> oXmlData.async=false
> 'oXmlData.load(sUrlData)
> oXmlData.load(Server.MapPath(sUrlData))
>
> oXmlFormat.async=false
> oXmlFormat.load(Server.MapPath(sUrlFormat))
> Set oXmlTemp.stylesheet=oXmlFormat
> Set oXmlProc=oXmlTemp.createProcessor()
> 'response.write(oXmlData.xml)
> 'response.end
> oXmlProc.input=oXmlData
> oXmlProc.output=RESPONSE
>
> 'oXmlProc.addParameter "PARAMVALUE",PARAMVALUE
> oXmlProc.transform
>
> %>
>
> merci
> greg
> --
> Devenez redacteur <XML>fr et contribuez au developpement du
> xml francophone (http://xmlfr.org/infos/redacteurs/) !
>
> Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
>
> Cette liste est a votre disposition pour discuter en francais de
> tout sujet technique lie a XML.
>
> Pour resilier votre abonnement, envoyez un message contenant
> la commande "unsubscribe" a xml-tech-request@xmlfr.org
> (mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|