Linking XML to HTML/JSP | SoloLearn: Learn to code for FREE!

+24

Linking XML to HTML/JSP

Assuming that I have a HTML/JSP file, and an XML file containing some information which I plan to call out in the HTML file, where should I place this XML file? According to code samples online, we initialize the XML DOM object and get the contents of the XML file through a request by invoking a method of the object. Is there a method to link the XML file to the HTML document offline? Assuming that this is not feasible and I have Xampp installed, same question: Where does the XML go?

5/6/2018 6:26:00 AM

Hatsy Rei

5 Answers

New Answer

+7

Daniel Healy I wrote the XML, which contains a bunch of information about books and articles. From what I understand, XML is basically a database in text format, so yes, you are correct that we need knowledge about its structure in order to use it. Anyway, I've successfully achieved what I originally intended. The JSP/JS XML parser will let you specify the XML file path, so where to place the XML on your local machine (when running it as a server) is not really important.

+3

Maybe i m not fully understand but you can put it where you like and use relative path for request it on your server like any other resouce (CSS, js, imgs etc)

+2

@Hatsy I also tried to find a code in the internet about getting/reading a XML/JSON file from a folder using only JavaScript. But there is no way JavaScript can access my files. (Because that will let hackers easily access and steal my data) So If you have a very simple php server thats enough. #Forgive me if I got your question wrong.

+1

Alguien que me ayude, quiero aprender mas sobre etiquetas svg y path

+1

Where did you get the XML from? XML is basically customized HTML for specific uses. It won't work if the system reading the XML does not know how to read it.