# Filter xml template

**URL:** https://discourse.paraview.org/t/filter-xml-template/3220
**Category:** Development
**Created:** [December 20, 2019, 9:19am UTC](https://discourse.paraview.org/t/filter-xml-template/3220 "2019-12-20T09:19:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SimonFuet](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/e95f7d/32.png) [@SimonFuet](https://discourse.paraview.org/u/SimonFuet)
#### Post date: [December 20, 2019, 9:19am UTC](https://discourse.paraview.org/t/filter-xml-template/3220/1 "2019-12-20T09:19:26Z")

</div>

Hi all,

I’m creating a new filter along with its Paraview (xml) interface.  
In this filter I have a lot of parameters. A parameter is composed of 3 components:

- a boolean that specifies whether the parameter is given as a constant value or a grid property
- a constant value (if the previous boolean is false)
- a grid property (if the previous boolean is true)

I managed to do it for one parameter (cf xml code below), but now I have to do it for many other parameters (only the label and the commands change from one parameter to another).  
Is there a way to create a kind of template that I could define once then use any number of times. Maybe there is already one somewhere?

Thank you for your time

Simon

XML code for 1 parameter:

```
  <IntVectorProperty
        name="UseProperty"
        label="Use property"
        command="SetUseProperty"
        number_of_elements="1"
        default_values="0">
	  <BooleanDomain name="bool"/>
  </IntVectorProperty>

 <DoubleVectorProperty 
    name="Constant" 
    label="Constant" 
    command="SetConstant" 
    number_of_elements="1"
    default_values="0">
    <Hints>
        <PropertyWidgetDecorator type="ShowWidgetDecorator">
            <Property name="UseProperty" function="boolean_invert" />
        </PropertyWidgetDecorator>
    </Hints>
 </DoubleVectorProperty>

 <StringVectorProperty name="Property"
                        label="Property"
                        command="SetProperty"
                        number_of_elements="1"
                        animateable="0">
    <ArrayListDomain name="array_list"
                     attribute_type="Scalars"
                     input_domain_name="inputs_array">
      <RequiredProperties>
        <Property name="Input"
                  function="Input" />
      </RequiredProperties>
    </ArrayListDomain>
    
    <Hints>
        <PropertyWidgetDecorator type="ShowWidgetDecorator">
            <Property name="UseProperty" function="boolean" />
        </PropertyWidgetDecorator>
    </Hints>
  </StringVectorProperty>
```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 20, 2019, 12:28pm UTC](https://discourse.paraview.org/t/filter-xml-template/3220/2 "2019-12-20T12:28:40Z")

</div>

There is no built-in template in ParaView for that.

---

<div class="post-metadata">

### Author: ![SimonFuet](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/e95f7d/32.png) [@SimonFuet](https://discourse.paraview.org/u/SimonFuet)
#### Post date: [December 20, 2019, 12:32pm UTC](https://discourse.paraview.org/t/filter-xml-template/3220/3 "2019-12-20T12:32:23Z")

</div>

And is there a way to create one?  
Also is there any documentation about what’s possible to do in XML files? All I’ve found is the “Plugin How To” wiki page and example XMLs on the Gitlab.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 20, 2019, 12:50pm UTC](https://discourse.paraview.org/t/filter-xml-template/3220/4 "2019-12-20T12:50:56Z")

</div>

I don’t think it would be wise to add a template generating multiple properties. @utkarsh.ayachit may want to chime in.

Here is the full documentation of what is possible in XML files :

- [https://www.paraview.org/Wiki/ParaView/Plugin\_HowTo](https://www.paraview.org/Wiki/ParaView/Plugin_HowTo)
- [https://kitware.github.io/paraview-docs/latest/cxx/classvtkSMProxy.html](https://kitware.github.io/paraview-docs/latest/cxx/classvtkSMProxy.html)
- [https://kitware.github.io/paraview-docs/latest/cxx/classvtkSMProperty.html](https://kitware.github.io/paraview-docs/latest/cxx/classvtkSMProperty.html)
- ParaView Guide, Chapters 18, 19 and 21 : [https://www.paraview.org/paraview-guide/](https://www.paraview.org/paraview-guide/)
- [https://www.paraview.org/Wiki/ServerManager\_XML\_Hints](https://www.paraview.org/Wiki/ServerManager_XML_Hints)
- Within the ParaView source :
  - Examples/Plugins/ – starter examples
  - Plugins/

---

<div class="post-metadata">

### Author: ![SimonFuet](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/e95f7d/32.png) [@SimonFuet](https://discourse.paraview.org/u/SimonFuet)
#### Post date: [December 20, 2019, 1:01pm UTC](https://discourse.paraview.org/t/filter-xml-template/3220/5 "2019-12-20T13:01:24Z")

</div>

Thank you very much as usual

Simon
