View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.xml.rule;
5   
6   import net.sourceforge.pmd.lang.LanguageRegistry;
7   import net.sourceforge.pmd.lang.ParserOptions;
8   import net.sourceforge.pmd.lang.rule.XPathRule;
9   import net.sourceforge.pmd.lang.rule.properties.BooleanProperty;
10  import net.sourceforge.pmd.lang.xml.XmlLanguageModule;
11  import net.sourceforge.pmd.lang.xml.XmlParserOptions;
12  
13  public class XmlXPathRule extends XPathRule {
14  
15      public static final BooleanProperty COALESCING_DESCRIPTOR = XmlParserOptions.COALESCING_DESCRIPTOR;
16      public static final BooleanProperty EXPAND_ENTITY_REFERENCES_DESCRIPTOR = XmlParserOptions.EXPAND_ENTITY_REFERENCES_DESCRIPTOR;
17      public static final BooleanProperty IGNORING_COMMENTS_DESCRIPTOR = XmlParserOptions.IGNORING_COMMENTS_DESCRIPTOR;
18      public static final BooleanProperty IGNORING_ELEMENT_CONTENT_WHITESPACE_DESCRIPTOR = XmlParserOptions.IGNORING_ELEMENT_CONTENT_WHITESPACE_DESCRIPTOR;
19      public static final BooleanProperty NAMESPACE_AWARE_DESCRIPTOR = XmlParserOptions.NAMESPACE_AWARE_DESCRIPTOR;
20      public static final BooleanProperty VALIDATING_DESCRIPTOR = XmlParserOptions.VALIDATING_DESCRIPTOR;
21      public static final BooleanProperty XINCLUDE_AWARE_DESCRIPTOR = XmlParserOptions.XINCLUDE_AWARE_DESCRIPTOR;
22  
23      public XmlXPathRule() {
24  	super.setLanguage(LanguageRegistry.getLanguage(XmlLanguageModule.NAME));
25  	definePropertyDescriptor(COALESCING_DESCRIPTOR);
26  	definePropertyDescriptor(EXPAND_ENTITY_REFERENCES_DESCRIPTOR);
27  	definePropertyDescriptor(IGNORING_COMMENTS_DESCRIPTOR);
28  	definePropertyDescriptor(IGNORING_ELEMENT_CONTENT_WHITESPACE_DESCRIPTOR);
29  	definePropertyDescriptor(NAMESPACE_AWARE_DESCRIPTOR);
30  	definePropertyDescriptor(VALIDATING_DESCRIPTOR);
31  	definePropertyDescriptor(XINCLUDE_AWARE_DESCRIPTOR);
32      }
33  
34      @Override
35      public ParserOptions getParserOptions() {
36  	return new XmlParserOptions(this);
37      }
38  }