I am very new to web development.i have heard about xmls in web deployment.Pls explain me why so mainy xmls like server.xml,config.xml,web.xml,context.xml are required.can not we combine them together in one.Why do we need them at first place.Do web servers contain parsers in them to parse xmls.Pls explain whole mechanism or provide some link to understand it.
Thanks in advance

Recommended Answers

All 2 Replies

>Why do we need them at first place.
It is better solution as you can jump to requered element of the document faster then with conventional text files that have to be first read and only after that searched. It is realy the structure of the file

<config>
   <parameter_1>
      <variable_1>
         <value>true</value>
      </variable_1>
      <variable_2>
         <value>false</value>
      </variable_2>
      <variable_3>
         <value>true</value>
      </variable_3>
   </parameter_1>
   <parameter_2>
      <variable_1>
         <value>false</value>
      </variable_1>
      <variable_2>
         <value>true</value>
      </variable_2>
      <variable_3>
         <value>false</value>
      </variable_3>
   </parameter_2>
   <parameter_3>
      <variable_1>
         <value>false</value>
      </variable_1>
      <variable_2>
         <value>true</value>
      </variable_2>
      <variable_3>
         <value>true</value>
      </variable_3>
   </parameter_3>
</config>

I order to find value of variable_2 of parameter_3 application will check for the child parameter_3 of config parent. It will reject any other chiles till it reach the one is looking or find none(this will result in error if not taken care of). Same process will repeat with variable_2 of parameter_3. This mean that application doesn't have to visit each child/node of the XML tree, therefore it become faster.

>why so mainy xmls
If you put everything in one document it will take time to read it, perfect example is WURFL xml that hold data on various mobile phone dating few years back and still adding new. Idea was great but right now (or last I try to check on file) it is/was nearly 7MB in size, which is far to much. Secondly most of the above mentioned files are server configuration files that are related to various categories of functionality which are easier to manage/edit in smaller sizes then with thousands of lines. What do you think, how quickly you find error in file with some 130 lines where most of it are notes/comments in comparing to 2500 lines?

>Do web servers contain parsers in them to parse xmls.Pls explain whole mechanism or provide some link to understand it.

Yes, they do have parsers which are generaly same. To more understand XML you may want to have look at w3schools tutorials on this topic

Ya i have understood it...
thanks for replying peter....
will ask some more as i read more...

shobhit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.