I can not write XML document (and neither XSL) in variable - JavaScript and jQuery

2

First time asking a question, then sorry if I'm not following some standard, but I need to know how I do it urgently:

I have an XML document and 3 XSL and I'm putting together a small CV that can show the recorded XML data in 3 different views (each XSL is a view). In the JavaScript code it is giving error when saving the variable xmlDoc the XML document. What do I do?

var xmlDoc, xslComplete, xslPub, xslOr, docComp, docPub, docOr, xsltProcessorComplete, xsltProcessorPub, xsltProcessorOr;

function start(){
    xmlDoc=document.implementation.createDocument("","",null);
    xslComplete=document.implementation.createDocument("","",null);
    xslPub=document.implementation.createDocument("","",null);
    xslOr=document.implementation.createDocument("","",null);
    xmlDoc.async = false;
    xslComplete.async = false;
    xslPub.async = false;
    xslOr.async = false;
    xmlDoc.load("curriculo.xml");
    xslComplete.load("completo.xsl");
    xslPub.load("publicacoes.xsl");
    xslOr.load("orientacoes.xsl");
    xsltProcessorComplete=new XSLTProcessor();
    xsltProcessorPub=new XSLTProcessor();
    xsltProcessorOr=new XSLTProcessor();
    xsltProcessorComplete.importStylesheet(xslComplete);
    xsltProcessorPub.importStylesheet(xslPub);
    xsltProcessorOr.importStylesheet(xslOr);
    docComp = xsltProcessorComplete.transformToFragment(xmlDoc,document);   
    document.getElementById("htmlStart").appendChild(docComp);
}

function loadComplete(){
    var mainDiv = document.getElementById("htmlStart");
    mainDiv.innerHTML = ""
    docComp = xsltProcessorComplete.transformToFragment(xmlDoc,document);
    document.getElementById("htmlStart").appendChild(docComp);
}

function loadPub(){
    var mainDiv = document.getElementById("htmlStart");
    mainDiv.innerHTML = ""
    docPub = xsltProcessorPub.transformToFragment(xmlDoc,document);
    document.getElementById("htmlStart").appendChild(docPub);
}

function loadOr(){
    var mainDiv = document.getElementById("htmlStart");
    mainDiv.innerHTML = ""
    docOr = xsltProcessorOr.transformToFragment(xmlDoc,document);
    document.getElementById("htmlStart").appendChild(docOr);
}

When I debug Chrome, it gives an error on this line (and stops executing):

xmlDoc.load("curriculo.xml"); 

The error is that xmlDoc is not a function, so you can not use load.

    
asked by anonymous 02.12.2015 / 00:09

0 answers