java - Dom4j rule does not match all expected nodes -


I am using dom4j rules API to set fire to a task if the predefined pattern / authorizes the following Xml matches an element in the snippet.

  & lt; Role_required = "admin" & gt; & Lt; Node title = "node which only appears to the administrator" path = "" & gt; & Lt; Role_required = "admin" & gt; Authorize & Lt; Node title = "node which only appears to the administrator" path = "" /> & lt; / Authorize & gt; & Lt; Role_required = "admin" & gt; Authorize & Lt; Node title = "node which only appears to the administrator" path = "" & gt; & Lt; Role_required = "admin" & gt; Authorize & Lt; / Authorize & gt; & Lt; Node title = "node which only appears to the administrator" path = "" /> & lt; / Node & gt; & Lt; / Authorize & gt; & Lt; / Node & gt; & Lt; / Authorize & gt; & Lt; Role_deny = "admin" & gt; Authorize & Lt; Node title = "node which is not visible to administrator" path = "" /> & Lt; / Authorize & gt; Unfortunately, it seems that it does not work with nested elements, only elements at the first level are authorized, the action has only started twice, but 5 authorized elements Are there. Does anyone have an idea to solve this idea? thank you in advanced.  

I have tried to authorize tags with the following rule:

  Rule Authorization Rule = New Rule (); Authorization Rule.setPattern (DocumentHelper.createPattern ("// authorize")); Authorization rule.setAction (New Authority Rule) ()); This.stylesheet = new stylesheet (); This.stylesheet.addRule (authorizationRule); This.stylesheet.run (document);  

The rule matches the elements at twice the level of fists. I am checking the XPath pattern with the document. Selection node method and all five elements are received.

Is your rule this line?

stylesheet.applyTemplates (node);

Remember that your rules are controlled by clan in the deep elements.

It seems that the pattern is not used to select the elements, but to check that element when the tree. If the element matches the pattern, then your action has been called, but it is your responsibility to continue in the hair element. If you do not do this, then the hair element is released.

(Disclaimer: My understanding may be wrong, I do not use dom4j, and have just seen it).


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -