Skip to content

Commit 0ebde81

Browse files
authored
Merge pull request #522 from areaDetector/512-NDattributes.xsd-macro-characters
Support macro characters in attributes XML files
2 parents d27d71f + 7667643 commit 0ebde81

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

XML_schema/NDAttributes.xsd

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@
179179
</xs:simpleType>
180180

181181
<xs:simpleType name="type_source">
182+
<xs:union memberTypes="type_EPICS_PV_source type_PARAM_source"/>
183+
</xs:simpleType>
184+
185+
<xs:simpleType name="type_EPICS_PV_source">
182186
<!-- EPICS PV name rules
183187
see: http://www.aps.anl.gov/epics/wiki/index.php/RRM_3-14_Concepts#Database_Addresses
184188
The record name can be a mix of the following:
@@ -189,13 +193,11 @@
189193
BUT, cannot express "<" in XML, must use &lt; but that won't parse!
190194
So, use use a reduced (but very likely) subset of rules.
191195
Do not allow these symbols: []<>
196+
197+
To support macro expansion, support these symbols: $ ( )
192198
-->
193-
<xs:union memberTypes="type_EPICS_PV_source type_PARAM_source"/>
194-
</xs:simpleType>
195-
196-
<xs:simpleType name="type_EPICS_PV_source">
197-
<xs:restriction base="xs:NMTOKEN">
198-
<xs:pattern value="[\w_\-:.;]+([.][A-Z0-9]+)?"/>
199+
<xs:restriction base="xs:string">
200+
<xs:pattern value="[\w_\-:.;\$\(\)]+([.][A-Z0-9]+)?"/>
199201
</xs:restriction>
200202
</xs:simpleType>
201203

XML_schema/example_attributes.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" standalone="no" ?>
2+
<!-- Attributes -->
3+
<Attributes
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="https://github.com/areaDetector/ADCore/blob/master/iocBoot/NDAttributes.xsd"
6+
>
7+
<Attribute name="AcquireTime" type="EPICS_PV" source="13SIM1:cam1:AcquireTime" dbrtype="DBR_NATIVE" description="Camera acquire time"/>
8+
<Attribute name="ImageCounter" type="PARAM" source="ARRAY_COUNTER" datatype="INT" description="Image counter"/>
9+
<Attribute name="calc1_val" type="EPICS_PV" source="$(P)userCalc1.VAL" dbrtype="DBR_NATIVE" description="some calculation result"/>
10+
<Attribute name="calc2_val" type="EPICS_PV" source="$(P)userCalc2.VAL" dbrtype="DBR_NATIVE" description="another calculation result"/>
11+
<Attribute name="MaxSizeX" type="PARAM" source="MAX_SIZE_X" datatype="INT" description="Detector X size"/>
12+
<Attribute name="MaxSizeY" type="PARAM" source="MAX_SIZE_Y" datatype="INT" description="Detector Y size"/>
13+
<Attribute name="CameraModel" type="PARAM" source="MODEL" datatype="STRING" description="Camera model"/>
14+
<Attribute name="CameraManufacturer" type="PARAM" source="MANUFACTURER" datatype="STRING" description="Camera manufacturer"/>
15+
</Attributes>

0 commit comments

Comments
 (0)