-- | get the 'Encoding' for a 'NetworkObject' if it has one
encoding :: NetworkObject -> NMLReader (Maybe Encoding)
encoding n = case n of
            (Single Link _)                 -> q n
            (Single Port _)                 -> q n
            (Group LinkGroup _)             -> q n
            (Group PortGroup _)             -> q n
            (Service Switch _)              -> q n
            _                               -> return Nothing
    where
        q = queryAttrib "nml:encoding" Encoding
encoding :: NetworkObject -> NMLReader (Maybe Encoding)
encoding n = case n of
            (Single Link _)                 -> q n
            (Single Port _)                 -> q n
            (Group LinkGroup _)             -> q n
            (Group PortGroup _)             -> q n
            (Service Switch _)              -> q n
            _                               -> return Nothing
    where
        q = queryAttrib "nml:encoding" Encoding
encoding n = case n of
            (Single Link _)                 -> q n
            (Single Port _)                 -> q n
            (Group LinkGroup _)             -> q n
            (Group PortGroup _)             -> q n
            (Service Switch _)              -> q n
            _                               -> return Nothing
    where
        q = queryAttrib "nml:encoding" Encoding