• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

exception handling using xslt

 
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
xslt is tranforming xml to new file

on transformation if there is any exception, my calling java code should know exception


may i know if you have any ideas for this.

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My idea would be to catch the TransformerException which is thrown by the transform() method of the Transformer class.

Or did you already have this rather obvious idea and you wanted something more detailed? Your post didn't have much information to base an answer on.
 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XSLT Exceptions Handling

Transformer class is having transform() method to apply XSLT on XML to do transformation, during transformation process if any fatalErrors, errors or warnings, to handle these following are steps.

· Write an XSLTErrorAdaptor which Implement ErrorListener

· Provide a implementation to error(), fatalError() and warning().

· Implement these methods to build error message using StringBuffer and set Boolean flag to true.

· Register XSLTErrorAdaptor to the Transformer class in Client application before calling transform()

transformer. setErrorListener(adaptor);

transformer. transform(Source xmlSource, Result outputTarget)



· Check value of flag defined in adaptor, if flag is true call a rollback() method to clean up the process and return a error message in StringBuffer.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic