hi there, I tried setting this property:
parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion" ,false); But it gives me SAXNotSupportedException. I am using Xercers-j 2.4. Any ideas why? -Shital Joshi MFG Systems -----Original Message----- From: Doug Helton [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 21, 2003 10:42 AM To: [EMAIL PROTECTED] Subject: RE: XML parser Shital, If you are trying to get this just to debug, you can get the line number of the error from the exception, which usually puts you at the end of the element that has the error. If you are trying to display the name for users you will probably have to follow Ragunath's suggestion or what you planned would work as well. Doug -----Original Message----- From: Ragunath Marudhachalam [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 21, 2003 10:28 AM To: [EMAIL PROTECTED] Subject: RE: XML parser 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-el ement-node"); 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
