> Ragunath Marudhachalam wrote...
 > 
 > You have to set
 > 
 > parser.setFeature( 
 > "http://apache.org/xml/features/dom/defer-node-expansion";
 > ,false);
 > 
 > and in the errorhandler's callback function,
 > 
 > Element node = 
 > (Element)parser.getProperty("http://apache.org/xml/properties
 > /dom/current-element-node");

That's correct, but it will work only when DOM parsing. Setting these
features/properties on a SAX parser would not hesitate to throw
SAXNotRecognizedException.

-Rahul.


 > 
 >      if (node != null)
 >                 System.out.println(node.getNodeName());
 > 
 > 
 > Ragu
 > CircuitVision
 > 
 > 
 > 
 > -----Original Message-----
 > From: Shital Joshi [mailto:[EMAIL PROTECTED]
 > Sent: Wednesday, May 21, 2003 10:19 AM
 > To: [EMAIL PROTECTED]
 > Subject: RE: XML parser
 > 
 > 
 > hi there,
 > 
 > If I am using SAX Parser + schema to validate the XML 
 > document, can I still get the name of element where schema 
 > validation failed? I guess I have to implement 
 > startElement() method and in the errorHandler I can get the 
 > current element name from the startElement() method. Is this 
 > a correct approach?
 > 
 > -Shital Joshi
 > MFG Systems
 > 
 > 
 > 
 > -----Original Message-----
 > From: K. Venugopal [mailto:[EMAIL PROTECTED]
 > Sent: Tuesday, May 20, 2003 5:26 AM
 > To: [EMAIL PROTECTED]
 > Subject: Re: XML parser
 > 
 > 
 > Hi Utsav ,
 > 
 > With  xerces you could get the location where error has 
 > occured . For this you need to set a error handler and query 
 > the current node in the error handler as shown below .
 > 
 > eg:
 >        Element node = 
 > (Element)parser.getProperty("http://apache.org/xml/properties
 > /dom/current-el
 > ement-node");
 > 
 > For more information refer to 
 > http://xml.apache.org/xerces2-j/properties.html
 > 
 > Hope this helps .
 > 
 > Regards
 > venu
 > 
 > >Hi,
 > >    Presently I am working on a project whose aim is to validify an 
 > >invalid XML document. For it, I need a XML validating 
 > parser, to which 
 > >I call from my Java program giving it the root of the DOM 
 > tree of the 
 > >XML document and it should return to the program , the 
 > pointer to the 
 > >node which contains the error (if the document is invalid) 
 > and NULL (if 
 > >the document is valid). Does any such parser exits ? or, is 
 > there any 
 > >parser available to which I can easily modify to get the desired 
 > >ersult.
 > >
 > >Utsav
 > >
 > >
 > >
 > >------------------------------------------------------------
 > ---------
 > >To unsubscribe, e-mail: [EMAIL PROTECTED]
 > >For additional commands, e-mail: [EMAIL PROTECTED]
 > >
 > >
 > >
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]
 > 
 > 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to