Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

Features

Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

XML Interviews Question page20

                         

  1. When should I use the default XML namespace instead of prefixes?
    This is purely a matter of choice, although your choice may affect the readability of the document. When elements whose names all belong to a single XML namespace are grouped together, using a default XML namespace might make the document more readable. 
    For example:
    <!-- A, B, C, and G are in the http://www.google.org/ namespace. -->
    <A xmlns="http://www.google.org/">
    <B>abcd</B>
    <C>efgh</C>
    <!-- D, E, and F are in the http://www.bar.org/ namespace. -->
    <D xmlns="http://www.bar.org/">
    <E>1234</E>
    <F>5678</F>
    </D>
    <!-- Remember! G is in the http://www.google.org/ namespace. -->
    <G>ijkl</G>
    </A>
                                                     
    When elements whose names are in multiple XML namespaces are interspersed, default XML namespaces definitely make a document more difficult to read and prefixes should be used instead. 
    For example:
    <A xmlns="http://www.google.org/">
    <B xmlns="http://www.bar.org/">abcd</B>
    <C xmlns="http://www.google.org/">efgh</C>
    <D xmlns="http://www.bar.org/">
    <E xmlns="http://www.google.org/">1234</E>
    <F xmlns="http://www.bar.org/">5678</F>
    </D>
    <G xmlns="http://www.google.org/">ijkl</G>
    </A>
    In some cases, default namespaces can be processed faster than namespace prefixes, but the difference is certain to be negligible in comparison to total processing time.
                                                                 
  2. What is the scope of an XML namespace declaration?
    The scope of an XML namespace declaration is that part of an XML document to which the declaration applies. An XML namespace declaration remains in scope for the element on which it is declared and all of its descendants, unless it is overridden or undeclared on one of those descendants.
    For example, in the following, the scope of the declaration of the http://www.google.org/ namespace is the element A and its descendants (B and C). The scope of the declaration of the http://www.bar.org/ namespace is only the element C.
    <google:A xmlns:google="http://www.google.org/">
    <google:B>
    <bar:C xmlns:bar="http://www.bar.org/" />
    </google:B>
    </google:A>
                                   
  3. Does the scope of an XML namespace declaration include the element it is declared on?
    Yes.
    For example, in the following, the names B and C are in the http://www.bar.org/ namespace, not the http://www.google.org/ namespace. This is because the declaration that associates the google prefix with the http://www.bar.org/ namespace occurs on the B element, overriding the declaration on the A element that associates it with the http://www.google.org/ namespace.
    <google:A xmlns:google="http://www.google.org/">
    <google:B xmlns:google="http://www.bar.org/">
    <google:C>abcd</google:C>
    </google:B>
    </google:A>
    Similarly, in the following, the names B and C are in the http://www.bar.org/ namespace, not the http://www.google.org/ namespace because the declaration declaring http://www.bar.org/ as the default XML namespace occurs on the B element, overriding the declaration on the A element.
    <A xmlns="http://www.google.org/">
    <B xmlns="http://www.bar.org/">
    <C>abcd</C>
    </B>
    </A>
    A final example is that, in the following, the attribute name D is in the http://www.bar.org/ namespace.
    <google:A xmlns:google="http://www.google.org/">
    <google:B google:D="In http://www.bar.org/ namespace"
    xmlns:google="http://www.bar.org/">
    <C>abcd</C>
    </google:B>
    </google:A>
    One consequence of XML namespace declarations applying to the elements they occur on is that they actually apply before they appear. Because of this, software that processes qualified names should be particularly careful to scan the attributes of an element for XML namespace declarations before deciding what XML namespace (if any) an element type or attribute name belongs to.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.