Skip to content

Commit

Permalink
Merge pull request #522 from areaDetector/512-NDattributes.xsd-macro-…
Browse files Browse the repository at this point in the history
…characters

Support macro characters in attributes XML files
  • Loading branch information
MarkRivers authored Jan 16, 2025
2 parents d27d71f + 7667643 commit 0ebde81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
14 changes: 8 additions & 6 deletions XML_schema/NDAttributes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@
</xs:simpleType>

<xs:simpleType name="type_source">
<xs:union memberTypes="type_EPICS_PV_source type_PARAM_source"/>
</xs:simpleType>

<xs:simpleType name="type_EPICS_PV_source">
<!-- EPICS PV name rules
see: http://www.aps.anl.gov/epics/wiki/index.php/RRM_3-14_Concepts#Database_Addresses
The record name can be a mix of the following:
Expand All @@ -189,13 +193,11 @@
BUT, cannot express "<" in XML, must use &lt; but that won't parse!
So, use use a reduced (but very likely) subset of rules.
Do not allow these symbols: []<>
To support macro expansion, support these symbols: $ ( )
-->
<xs:union memberTypes="type_EPICS_PV_source type_PARAM_source"/>
</xs:simpleType>

<xs:simpleType name="type_EPICS_PV_source">
<xs:restriction base="xs:NMTOKEN">
<xs:pattern value="[\w_\-:.;]+([.][A-Z0-9]+)?"/>
<xs:restriction base="xs:string">
<xs:pattern value="[\w_\-:.;\$\(\)]+([.][A-Z0-9]+)?"/>
</xs:restriction>
</xs:simpleType>

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

0 comments on commit 0ebde81

Please sign in to comment.