File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes How to get an id of a node? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to get an id of a node?" Watch "How to get an id of a node?" New topic

How to get an id of a node?

Jeya Balaji
Ranch Hand

Joined: Jan 02, 2003
Posts: 40
I am using tomcat 4.1 and jdk 1.3
While validating custom tag lib, the validate method of TagLibraryValidator accepts pagedata (an xml doc) and returns ValidationMessage array.
The api describe the constructor of ValidationMessage like this :
public ValidationMessage(java.lang.String�id, java.lang.String�message)
Create a ValidationMessage. The message String should be non-null. The value of id may be null, if the message is not specific to any XML element, or if no jsp:id attributes were passed on. If non-null, the value of id must be the value of a jsp:id attribute for the PageData passed into the validate() method.
id - Either null, or the value of a jsp:id attribute.
message - A localized validation message.

I am not very clear about the jsp:id. Should I pass a string (like "<mytag:foo>") which will indicate the tag causing the problem?
What is the meaning of "If non-null, the value of id must be the value of a jsp:id attribute for the PageData" ?
This id param is used while displaying the problem, like :
id : the problem description
Earlier, I posted this question in jsp forum and couldn't get an answer there.
This issue is not a major one in my project - but just a small hitch. I would like to fix it by understanding the id field or pass null.

Regards,<br />Balaji
It is sorta covered in the JavaRanch Style Guide.
subject: How to get an id of a node?
Similar Threads
what is id in ValidationMessage?
A few clarifications needed please...
disable submit button help
AJAX 'POST' xml request to server
Passing parameters/ attributes to a custom validator