Specific ITemplateParser for my processor

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Specific ITemplateParser for my processor

Guillaume DROUET
Hi,

I'm working on a thymeleaf support for my open source project and I'm facing a design issue.

In my dialect, I have an element processor which reads the children of the element as a configuration structure for my library described in XML. It looks like this :

<myDialect:myProcessor>
  <myConfig>
      ...
  </myConfig>
</myDialect:myProcessor>

I already have other configuration features which map the <myConfig> tag with JAXB to a POJO. Then this POJO is read to configure the library internally.

In my processor, I receive an element parsed by Thymeleaf. To save CPU cycles, I don't want to map this Element to my POJO. It would be faster to directly parse the raw template content into the desired POJO.

I don't really know what is possible or what is the best solution. Specifying my own ITemplateParser ? Using a particular syntax to just receive a text node as element and then parse its string representation inside my processor ?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Specific ITemplateParser for my processor

Thibault Duchateau
Hi,

I faced a similar issue recently. I ended up using the DOMUtils class (getXmlFor(final Node node)). Some other methods may be of your interest in the same class.

I'm not sure if it really fits your needs however. :-/

Regards,
Thibault
Reply | Threaded
Open this post in threaded view
|

Re: Specific ITemplateParser for my processor

Guillaume DROUET
Well I'll use this method if there is no solution. It's a good helper to save code but not to save CPU cycles ("XML => Node => XML => MyPojo" instead of "XML => MyPojo").

Thanks !

Regards