Hi Rahul, Ron, Venu, Thank you all for your kind help. I set the feature, and using that property, i am able to get the whole tree structure. This is a long time problem i had and its been fixed now. Once again thank u guys for ur time and help.
Ragu CircuitVision -----Original Message----- From: K. Venugopal [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 14, 2003 6:19 AM To: [EMAIL PROTECTED] Subject: Re: How to get the full parent child path on schema validation. Hi Ragu, In addition to what rahul mentioned i think you need to set the following feature to false . parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion" ,false); Regards venu Rahul Srivastava wrote: > > Ragunath Marudhachalam wrote... > > > > Hi Rahul, > > > > Thanks for the tip. I'm using DOM Parser. I went thru the link u gave me, > > but i didnt get to know how to use it. I mean to set the > > property, and how to get the element name. > >If you have read the docs, you will notice that the property >current-element-node is readonly. You cannot set this property. To use this >property, register an ErrorHandler with the DOM parser. Within the callback >of the registered ErrorHandler, you need to do something like this: >Element node = >(Element)parser.getProperty("http://apache.org/xml/properties/dom/current-e l >ement-node"); >if (node != null) { > // now you have the node from where you can > // traverse all the way back to the root > System.out.println(node.getNodeName()); > System.out.println(node.getParentNode().getNodeName()); >} > >Hope that helps. > >Cheers, >Rahul. > > > > > If you dont mind, could u plz help me > > as how to use > > it or give me a small sample of how to use it, coz so far i have > > only used > > setting features. I am very thankful for your time and help. > > > > Ragu > > CircuitVision > > > > > > > > -----Original Message----- > > From: Rahul Srivastava [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, May 13, 2003 2:14 AM > > To: [EMAIL PROTECTED] > > Subject: RE: How to get the full parent child path on schema validation. > > > > > > Hi Ragu, > > > > You did not mention which parsing are you using viz. SAX/DOM parsing!. > > > > In case you are using DOM parsing, you can try using the property > > dom/current-element-node, which will give you the current node. > > You can then > > traverse back from that node and get the full tree. > > See: > > http://xml.apache.org/xerces2-j/properties.html#dom.current-element-node > > for more details. > > > > Cheers, > > Rahul. > > > > > > > > > Ragunath Marudhachalam wrote... > > > > > > Hello All, > > > > > > I have been able to validate a xml document with a schema. I > > do have the > > > handler class and i'm able to print the error messages and > > also the line > > > number where the error has occured. For some reasons i need > > to have the > > > whole tree structure of the element where the error has occured. For > > > example, if the xml document is like this, > > > > > > <a> > > > <b> > > > <c> > > > <d> > > > </d> > > > > > > </c> > > > > > > </b> > > > > > > </a> > > > > > > and the error is at the element <d>, then i need to get the whole tree > > > structure from the root element, like a/b/c/d.... is it possible > > > to get that > > > in someway.. As far as i know, i havent found a direct method to do > > > that...It would be a real help if anybody could suggest me > > some method or > > > with some sample code.... > > > > > > Thanks > > > > > > Ragu > > > CircuitVision > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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]
