SchemaΒΆ

# Oxygen Ethernet Receiver Configuration
#
# Relax NG compact syntax specification (http://www.relaxng.org/compact-tutorial-20030326.html)
#
# XSD schema can be generated from this file using the free Trang schema converter:
# java -jar trang.jar -I rnc -O xsd receiver.rnc receiver_generated.xsd

default namespace = "http://xml.dewetron.com/receiver"

grammar
{

    boolean = "true" | "false"

    anyElement =
        element * {
            (attribute * { text }
            | text
            | anyElement)*
        }

    anyContent = mixed { anyElement* }
    ToDo = anyElement*

    unsigned_hex_or_dec = xsd:integer | xsd:string { pattern='0[xX][0-9a-fA-F]+' }

    accept_from = element AcceptFrom
    {
        attribute host { text }
    }

    udp_source = element UDPSource
    {
        attribute address { text }? # IP address of the network device to listen on
        &
        attribute port { unsigned_hex_or_dec } # UDP port
        &
        accept_from*
    }

    source = udp_source

    display_range = element DisplayRange
    {
        attribute min { xsd:double } # Default range for instruments
        &
        attribute max { xsd:double } # Default range for instruments
        &
        attribute resolution { xsd:integer }? # Number of decimal places to display
    }

    numeric_value = element NumericValue
    {
        attribute byte_offset { unsigned_hex_or_dec }?
        &
        attribute bit_offset { unsigned_hex_or_dec }?
        &
        attribute bit_length { unsigned_hex_or_dec }
        &
        attribute type { "unsigned" | "signed" | "float" }
        &
        attribute byte_order { "msb_first" | "lsb_first" }?
        &
        attribute bit_order { "msb_0" | "lsb_0" }?
    }

    block_terminator = element BlockTerminator
    {
        attribute alignment { text }?
        &
        attribute value { text }
    }

    byte_block_value = element ByteBlockValue
    {
        attribute byte_offset { unsigned_hex_or_dec }
        &
        attribute byte_length { unsigned_hex_or_dec }
    }

    scaling = element LinearScaling
    {
        attribute scale { xsd:double }
        &
        attribute offset { xsd:double }
    }

    numeric_chain = numeric_value , scaling?

    sample = element Sample
    {
        attribute valid_if { text }?
        &
        (
            numeric_chain
            |
            ( byte_block_value )
        )
    }

    channel = element Channel
    {
        attribute name { text }
        &
        attribute short_name { text }?
        &
        attribute type { "double" | "nmea" | "utf8" }
        &
        attribute unit { text }?
        &
        attribute description { text }?
        &
        display_range?
        &
        sample
    }

    selector_value = element SelectorValue
    {
        attribute name { text }
        ,
        numeric_chain
    }

    variable_length = element VariableLength
    {
        numeric_chain
    }

    fixed_packet_byte = element FixedPacketByte
    {
        attribute offset { unsigned_hex_or_dec }
        &
        attribute value { unsigned_hex_or_dec }
    }

    packet_definition = element PacketDefinition
    {
        attribute length { xsd:unsignedInt }?
        &
        attribute max_length { xsd:unsignedInt }?
        &
        variable_length?
        &
        fixed_packet_byte*
    }

    relative_timestamp_channel = element RelativeTimestampChannel
    {
        attribute base { "midnight" }
        &
        attribute unit { "ms" }
        &
        attribute offset { xsd:unsignedInt }?
        &
        sample
    }

    synchronization = element Synchronization
    {
        relative_timestamp_channel
    }

    data_stream = element DataStream
    {
        source
        ,
        packet_definition?
        ,
        element Channels {
            channel*
            &
            selector_value*
        }
    }

    channel_ref = element ChannelRef
    {
        attribute channel_name { text }
    }

    channel_group = element ChannelGroup
    {
        attribute name { text }
        &
        channel_ref*
        &
        channel_group*
    }

    channel_topology = element ChannelTopology
    {
        channel_group+
    }

    # Root element
    start = element Receiver
    {
        data_stream+
        ,
        channel_topology?
    }

}