• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP with XML synatx

 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In JSP v 1.2 we can use XML synatx.
I dont understand why it is required.
I understand that it will be possible to parse using a XML parser. Why would any one do that.
If any one knows the reasons for this Please do reply to this post.
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Hi,
In JSP v 1.2 we can use XML synatx.
I dont understand why it is required.
I understand that it will be possible to parse using a XML parser. Why would any one do that.
If any one knows the reasons for this Please do reply to this post.

It's just an alternative for those who have creative ways to apply XML-related technologies to JSP. For instance, suppose that you want to generate JSP pages as the result of a chain of XSLT stylesheets. XSLT can produce non-XML, but that's tedious and ugly; XSLT is much better when it produces XML. Thus, it's important that JSP provides an XML-compliant syntax to complement its non-XML syntax. The XML syntax exists to ensure that XML-related technologies can produce JSP pages with a minimum of hassle.
On the other side of the coin, the XML view of a page -- that is, the XML equivalent for pages that are written using the non-XML syntax -- is useful in order to process JSP pages once they're written. The best current example of that is the TagLibraryValidator API, which gives a JSP 1.2 tag library the option to validate pages that import it; such tag libraries see an XML view, which they can parse and then validate using their chosen XML parsing technology, whether it be SAX, DOM, or an alternate mechanism.
Note that the XML syntax is not required, and many (probably the vast majority) of page authors simply ignore it. It's there to provide extra options for users of XML -- and tools that support XML.
Hope that helps,
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shawn,
I am wondering how heavily JSTL depends on XML syntax?
Thanks.
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Doug Wang:
Hi Shawn,
I am wondering how heavily JSTL depends on XML syntax?
Thanks.

Not at all. You need not even think about the XML syntax when using JSTL. (This is true for any tag library.)
Of course, like any JSP page, those that use JSTL may take advantage of the XML syntax if they'd like.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic