How to add additional element to htmlparser generator

☆樱花仙子☆ 提交于 2019-12-06 06:45:30

问题


I want to rewrite links in attributes of span tags with sling rewrite pipeline. The htmlparser generator only calls "a, link, script, img, form, body" elements. How can I add additional element like span to my transformer? An example configuration would be great!

I read that a generator-htmlparser node should be created with the includeTags property, but it doesn't work! I tried to create this node under /apps/MY_APP/config/rewriter.

There is also an other generatorType (html-generator), which works, but it calls on every html elements, which is not good for performance.

I use AEM 5.6.1.

Thanks in advance!


回答1:


Solution:

Add a child node under your rewriter node, which generatorType is generator-htmlparser:

<generator-htmlparser jcr:primaryType="nt:unstructured" includeTags="[SPAN,/SPAN]"/>

It will work only span tags with this configuration. The tag names must be capital letters!



来源:https://stackoverflow.com/questions/23673616/how-to-add-additional-element-to-htmlparser-generator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!