Search code examples
javascriptxmlhtmlintel-xdkxmldom

I want to include the xml file inside the javascript file in my INTEL XDK Project


Im doing a hybrid application through INTEL XDK.

  • I have my file tree like this
    enter image description here
  • And the code inside the file is
    enter image description here
  • But i'm unable get file into my project . I will be pleased if someone help me out . Thanks in advance.

Solution

  • Within a Cordova app (which is what the XDK creates) you cannot use absolute paths to point to the location of the html file, it doesn't work as you might expect in a Cordova webview. You have to use relative paths to address any files. The www directory is the "root" of your project.

    Your index.html file is located at the top of the www directory, as shown in your directory tree snapshot, which I assume you got from the Brackets editor that is built into the XDK:

    www/index.html

    And your xml file is located here:

    www/js/Exact.xml

    So, given the above locations and conditions, we need a slight modification to @Jaromanda's answer:

    var xmlDoc = loadXMLDoc('js/Exact.xml')