aspose file tools*
The moose likes XML and Related Technologies and the fly likes is this XML??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "is this XML???" Watch "is this XML???" New topic
Author

is this XML???

Sri Sar
Ranch Hand

Joined: Mar 25, 2004
Posts: 44
Hi,
using HTML/JS, i have created a new window that contains thet contents as given below:

<desc>
<name>sam</name>
<age>23</name>
</desc>

in my form, i had a set of select tags with options. once the user has made his selections, i use a function named change() with the pseudo code as given below:


the result of executing this function is the set of tags as given above.
now my questions are:
(1) can i say that i have created a XML file???
(2) if it is a XML file, without using a parser, can i extract the value of the name and age tags using servlets or JSP?
thanks in advance
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
(1) can i say that i have created a XML file???

No, but you can say that you have created an XML document...

(2) if it is a XML file, without using a parser, can i extract the value of the name and age tags using servlets or JSP?
No, you can't, since the window you created with JavaScript gets created completely on the client-side -- the server doesn't know that the browser has executed the JavaScript function.

If you want to send the XML document for processing on the server-side, you should turn to our HTML/JavaScript forum for help in doing that.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sri Sar
Ranch Hand

Joined: Mar 25, 2004
Posts: 44
Hi,
thank u very much for the reply. can u give me the difference between a XML document and a XML file??
thanks in advance
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Sri Sar:
can u give me the difference between a XML document and a XML file??

An XML document is "any" instance of an XML tree while an XML file is a file containing an XML document.

For example,
String foo = "<?xml version='1.0'?><foo><bar/></foo>";
can be called an "XML document" but it's not an "XML file" until you've physically written that XML data into a file in the file system.
Sri Sar
Ranch Hand

Joined: Mar 25, 2004
Posts: 44
Hi lasse,
thank u very much for explaining the difference between an XML file and an XML document,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: is this XML???