How to Integrate XML and JavaScript in Web Development?

  • Comp Sci
  • Thread starter shivajikobardan
  • Start date
  • Tags
    xml
In summary, XML and JavaScript can be used together to create dynamic and interactive websites. XML (Extensible Markup Language) is a markup language used for storing and transporting data, while JavaScript is a programming language used for adding functionality and interactivity to web pages. By using the two together, web developers can easily create websites that can display and manipulate data, respond to user interactions, and provide a more engaging and personalized experience for users. XML can also be used to easily organize and structure website content, making it easier for developers to manage and update their websites. Overall, XML and JavaScript are powerful tools that can greatly enhance the functionality and user experience of a website.
  • #1
shivajikobardan
674
54
Homework Statement
How XML and JS are used together to develop client side web applications-10 marks
Relevant Equations
None
4. HTTP and the Web Services [8 hours]
4.1. HTTP, Web Servers and Web Access
4.2. Universal naming with URLs
4.3. WWW Technology: HTML, DHTML, WML, XML
4.4. Tools: WYS/WYG Authoring Tools
4.5. Helper applications: CGI; PERL, JAVA, JAVA SRIPTS, PHP, ASP, .NET Applications
4.6. Introduction to AJAX (Programming)
4.7. browser as a rendering engine: text, HTML, gif and jpeg
This is the part of our whole syllabus. As you can guess from it, the goal of syllabus is not to make us program website using these technologies, rather to just learn what are they (I find this syllabus is pretty useless as it is fully overloaded with contents, and at the end you learn nth)

Here's full syllabus-:
http://ioesyllabus.blogspot.com/2015/05/internet-and-intranet-ct-754-syllabus.html
I am confused what this question above is trying to ask?
1) Is it asking to write about AJAX? Cause AJAX uses javascript and AJAX does use xmlhttprequest object. So is it asking to write about it?
2) Is it asking to write how to create a website using xml and javascript. And what kind of website to design for 10 marks in exam?
And https://stackoverflow.com/questions/384639/how-to-include-javascript-in-xml-document
this SO answers indicate it isn't possible to use javascript inside xml due to some reasons.

I am really confused. The teacher of this course is not available now. I am inclining more towards this being a "write short notes on AJAX" type of question. I want to know your views.
 
Physics news on Phys.org
  • #2
Do you understand what XML and JS are, @shivajikobardan, and what they are typically used for in computing? That will assist form your answer to the question.

Also, why have you singled out AJAX for this question? Is it because it is mentioned as Item 4.6 in the list of topics?
 
  • #3
Melbourne Guy said:
Do you understand what XML and JS are, @shivajikobardan, and what they are typically used for in computing? That will assist form your answer to the question.

Also, why have you singled out AJAX for this question? Is it because it is mentioned as Item 4.6 in the list of topics?
yeah xml for storing and communicating data, js for dom handling(access,modify).
i singled out that, because i think it's not possible to create a website of xml and js. as xml isn't made to present data rather store it.
plus the marks is 10 marks which is huge. you either write a full fledged xml+js webpage there or you write 3-4 pages about AJAX. i am not 100% sure, but i am getting the vibes as ajax. i want to learn others logic viewpoint about it.
 
  • #4
Off the top of my head, after a quick scan of the syllabus link you provided, I would say that if I had to write a site which had to interact with XML, I would do it this way:
  • Write a front-end using HTML and JS, or use a Wysiwyg tool or framework to help in accomplishing this;
  • Use JS/AJAX to communicate with a backend on the server, maybe also sending POST/GET parameters with the AJAX request;
  • Write the backend using anyone or combination of languages, including PHP (my favorite), Perl, Node.js, whatever, which would open and parse a XML document (you'll need an XML parser), extract data from it, probably format the resultant data-set as JSON, return that to the calling JS script;
  • The calling JS script then manipulates the HTML document DOM to present the data as table, chart, whatever.
As always, YMMV, but that's the basics. I've made a ton of sites this way, using XML, GPX, CSV/TSV data files, as well as accessing data from databases. HTH...
 
  • Informative
Likes shivajikobardan
  • #5
sciFax said:
Off the top of my head, after a quick scan of the syllabus link you provided, I would say that if I had to write a site which had to interact with XML, I would do it this way:
  • Write a front-end using HTML and JS, or use a Wysiwyg tool or framework to help in accomplishing this;
  • Use JS/AJAX to communicate with a backend, maybe also sending POST/GET parameters with the AJAX request;
  • Write the backend using anyone or combination of languages, including PHP (my favorite), Perl, Node.js, whatever, which would open and parse a XML document (you'll need an XML parser), extract data from it, probably format the resultant data-set as JSON, return that to the calling JS script;
  • The calling JS script then manipulates the HTML document DOM to present the data as table, chart, whatever.
As always, YMMV, but that's the basics. I've made a ton of sites this way, using XML, GPX, CSV/TSV data files, as well as accessing data from databases. HTH...
this is extremely intelligent reply. thanks for your great response.
 
  • #6
shivajikobardan said:
thanks for your great response
You're welcome - I hope it helps.
 
  • #7
shivajikobardan said:
yeah xml for storing and communicating data...
shivajikobardan said:
i singled out that, because i think it's not possible to create a website of xml and js. as xml isn't made to present data rather store it.
Is it possible that "XML" is being used as shorthand for XST, @shivajikobardan?

shivajikobardan said:
4 pages about AJAX. i am not 100% sure, but i am getting the vibes as ajax. i want to learn others logic viewpoint about it.
AJAX is not a scripting language like JS, it is a framework that extends server-side and was developed after JS. You can write web pages without it, so I'd be careful about assuming that's the expectation of this question.
 
  • Like
Likes shivajikobardan
  • #8
Melbourne Guy said:
Is it possible that "XML" is being used as shorthand for XST, @shivajikobardan?AJAX is not a scripting language like JS, it is a framework that extends server-side and was developed after JS. You can write web pages without it, so I'd be careful about assuming that's the expectation of this question.
now after reading reply by sciFox i think they are seriously expecting us to write a working website with frontend and backend. it makes more sense.
 
  • #9
shivajikobardan said:
i think they are seriously expecting us to write a working website with frontend and backend. it makes more sense.
Possibly - or, as you speculated above, just describe in some detail how this would be done. That would be (a lot!) easier than actually writing a working website. In any case, it would be best to discuss this with your lecturer(s) to ascertain what exactly is required of you. After all, we have yet to see the actual question here...
 
  • Like
Likes FactChecker and shivajikobardan
  • #10
shivajikobardan said:
i think they are seriously expecting us to write a working website with frontend and backend. it makes more sense
I'm not sure about that, @shivajikobardan. From your post of the question:

"How XML and JS are used together to develop client side web applications"

This seems descriptive only rather than a working example, and it clearly demarcates the problem to "client side", so why do you feel that backend needs to be included?
 
  • #11
sciFax said:
it would be best to discuss this with your lecturer(s) to ascertain what exactly is required of you
I agree with @sciFax, but from your OP, have you left that too late for this assignment? Is the due date such that you cannot discuss the question?
 
  • #12
If the page/app is to be front-end only, then a JS-based XML parser would help - I've personally never used one. Try e.g. this for starters from StackOverflow:

https://stackoverflow.com/questions/17604071/parse-xml-using-javascript

I'm guessing in such a case that the XML file would be directly accessible by residing on the client machine (unlikely) or on a network drive accessible to the the client machine (more likely, especially given the "Intranet" focus in some of the course material). Been there, done that...

I'm intrigued by the hint given by @Klesun in that SO thread that jQuery can directly access fields in the XML without a parser. Live and learn...
 
Last edited:
  • #13
Melbourne Guy said:
I'm not sure about that, @shivajikobardan. From your post of the question:

"How XML and JS are used together to develop client side web applications"

This seems descriptive only rather than a working example, and it clearly demarcates the problem to "client side", so why do you feel that backend needs to be included?
hmm that's a good point. it is very confusing on what it wants. it probably wants short notes on xml, javascript and ajax haha.
 
  • #14
Melbourne Guy said:
I agree with @sciFax, but from your OP, have you left that too late for this assignment? Is the due date such that you cannot discuss the question?
it is not assignment. i am studying for its exam. i am solving past year papers. this question has appeared once in 15 questions(2 questions are asked each year from this chapter 5+10). this has good chance of being repeated again. there is no teacher for this subject atm. he has done his job 80% and left his job. the position is vacant.
 
  • #15
shivajikobardan said:
it is not assignment. i am studying for its exam.
I see, I am assuming there are no study notes for last year's exam, @shivajikobardan? Do you know any students from the year above who sat that exam? Is there a different teacher who might be able to assist?

Not having a teacher to guide students preparing for an exam would certainly be frustrating, and makes it difficult to suggest a concrete course of action to you.
 
  • Like
Likes shivajikobardan
  • #16
Melbourne Guy said:
I see, I am assuming there are no study notes for last year's exam, @shivajikobardan? Do you know any students from the year above who sat that exam? Is there a different teacher who might be able to assist?

Not having a teacher to guide students preparing for an exam would certainly be frustrating, and makes it difficult to suggest a concrete course of action to you.
Luckily i have seniors who have made all the notes they had have available to us for free(I know it is academic dishonesty in USA, but this is pretty much important to do so in Nepal,), Seniors have collected slides of various teachers from various colleges.





The content here doesn't mention anything in combination.
But there are no answers for previous year's questions. Well there is a book which claims to do so. But even they haven't written anything about it. It is just a repeat of whatever is written in those 2 slides with some copying and pasting from wikipedia.
 
  • #17
shivajikobardan said:
Seniors have collected slides of various teachers from various colleges.
I'd say there are answers to the exam question in those notes, @shivajikobardan, certainly there is enough to show the direction that the teacher is expecting students to head 👍
 
  • #18
shivajikobardan said:
Homework Statement:: How XML and JS are used together to develop client side web applications-10 marks
I am confused what this question above is trying to ask?
1) Is it asking to write about AJAX? Cause AJAX uses javascript and AJAX does use xmlhttprequest object. So is it asking to write about it?
Yes, given that two of the three meaningful letters in AJAX stand for Javascript and XML of course AJAX is part of the answer. But only part of it.

shivajikobardan said:
2) Is it asking to write how to create a website using xml and javascript. And what kind of website to design for 10 marks in exam?
Of course it is not asking you to create a website. How would you do that in an exam? How would it be marked? If you had a question "how do petrol and air combine in an internal combustion engine to propel a car" would you answer that by building an engine?

shivajikobardan said:
And https://stackoverflow.com/questions/384639/how-to-include-javascript-in-xml-document
this SO answers indicate it isn't possible to use javascript inside xml due to some reasons.
That link is completely irrelevent, as is the idea of "using javascript inside xml" (whatever that means).

shivajikobardan said:
I am really confused. The teacher of this course is not available now. I am inclining more towards this being a "write short notes on AJAX" type of question. I want to know your views.
For 10 marks? AJAX is only a small part of the answer.
 
  • Like
Likes sciFax
  • #19
sciFax said:
I'm intrigued by the hint given by @Klesun in that SO thread that jQuery can directly access fields in the XML without a parser. Live and learn...
That thread is 8 years old, and jQuery is essentially obsolete. Modern browsers can parse XML directly using the DOM parser.
 
  • Like
Likes sciFax
  • #20
pbuk said:
For 10 marks? AJAX is only a small part of the answer.
interesting perspective. how many pages should i fill for 10 marks(full marks of subject is 80 and time is 3 hrs)? i will write about traditional web app model vs ajax web app model architecture then make their timing diagram that's 80% of what i will be writing for 10 marks. won't that be enough? that's all information available abut ajax online(introductory).
 
  • #21
pbuk said:
For 10 marks? AJAX is only a small part of the answer.
interesting perspective. how many pages should i fill for 10 marks(full marks of subject is 80 and time is 3 hrs)? i will write about traditional web app model vs ajax web app model architecture then make their timing diagram that's 80% of what i will be writing for 10 marks. won't that be enough? that's all information available abut ajax online(introductory).
 
  • #22
You need to learn how to answer questions: it is not about picking one aspect and writing all you know about it, you have to address the whole scope of the question. There might be 2 marks available for talking about AJAX so if that is all you talk about that is all you will get.

Other points I would expect to pick up marks for include the following
  • The server sends a web page to the user's browser including HTML and CSS comprising the presentation layer and a Javascript client application (1 mark)
  • In response to user input the Javascript running on the client requests data from the server using a GET XMLHttpRequest and sends data to the server using POST or PUT XMLHttpRequests (1 mark)
  • XMLHttpRequests are sent asynchronously: explain the implications and contrast to traditional HTML requests (1 mark)
  • The server parses and acts on the request and sends a response to the client application as an XML document (2 marks)
  • Explain what XML is and its the strengths and weaknesses (1 mark)
  • The client Javascript application parses the XML document and updates its internal state and the presentation layer (2 marks)
  • Explain what Javascript is and its strengths and weaknesses in this context (1 mark)
  • Plus if you have time to mop up any extra marks:
    • talk about security
    • talk about how Gmail revolutionised user experience and expectations for web apps
    • talk about how JSON is replacing XML as the message layer
 
  • Like
Likes sciFax, Melbourne Guy and shivajikobardan
  • #23
pbuk said:
You need to learn how to answer questions: it is not about picking one aspect and writing all you know about it, you have to address the whole scope of the question. There might be 2 marks available for talking about AJAX so if that is all you talk about that is all you will get.

Other points I would expect to pick up marks for include the following
  • The server sends a web page to the user's browser including HTML and CSS comprising the presentation layer and a Javascript client application (1 mark)
  • In response to user input the Javascript running on the client requests data from the server using a GET XMLHttpRequest and sends data to the server using POST or PUT XMLHttpRequests (1 mark)
  • XMLHttpRequests are sent asynchronously: explain the implications and contrast to traditional HTML requests (1 mark)
  • The server parses and acts on the request and sends a response to the client application as an XML document (2 marks)
  • Explain what XML is and its the strengths and weaknesses (1 mark)
  • The client Javascript application parses the XML document and updates its internal state and the presentation layer (2 marks)
  • Explain what Javascript is and its strengths and weaknesses in this context (1 mark)
  • Plus if you have time to mop up any extra marks:
    • talk about security
    • talk about how Gmail revolutionised user experience and expectations for web apps
    • talk about how JSON is replacing XML as the message layer
thanks this is incredibly helpful. i had no idea about all these things. lots of professors that i am getting contact with have been advising these kinds of things to me these day(i am actively seeking answers as i am getting good marks in places where there is mathematics to solve, or solve using algorithm but i am ending up with extremely bad marks in places where i need to write essays about concepts.
 

FAQ: How to Integrate XML and JavaScript in Web Development?

What is XML and how is it used in website development?

XML stands for Extensible Markup Language and it is a markup language used for storing and transporting data. It is commonly used in website development to structure and organize data in a hierarchical format, making it easier to manage and manipulate.

How is JavaScript used with XML in website development?

JavaScript is used to manipulate and interact with the data stored in XML. It allows for dynamic and interactive elements on a website, such as updating data without reloading the page or creating animations.

What are the benefits of using XML and JavaScript in website development?

Using XML and JavaScript allows for more efficient and organized data management, as well as creating a more dynamic and interactive user experience. It also allows for easier integration with other systems and technologies.

Are there any drawbacks to using XML and JavaScript in website development?

One potential drawback is that using XML and JavaScript can make a website more complex and require more resources to maintain. Additionally, not all browsers may support the use of JavaScript, which could limit the functionality of the website for some users.

Can XML and JavaScript be used to create responsive websites?

Yes, XML and JavaScript can be used to create responsive websites by using CSS media queries to adjust the layout and design of the website based on the size and orientation of the device it is being viewed on.

Back
Top