@staticmethod<EOL><INDENT>def from_elements(link_elements):<DEDENT>
<EOL>links = []<EOL>for link_element in link_elements:<EOL><INDENT>matrix_set_elements = link_element.findall(_TILE_MATRIX_SET_TAG)<EOL>if len(matrix_set_elements) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>' % link_element)<EOL><DEDENT>elif len(matrix_set_elements) > <NUM_LIT:1>:<EOL><INDENT>set_limits_elements = link_element.findall(<EOL>_TILE_MATRIX_SET_LIMITS_TAG)<EOL>if set_limits_elements:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>link_element)<EOL><DEDENT>for matrix_set_element in matrix_set_elements:<EOL><INDENT>uri = matrix_set_element.text.strip()<EOL>links.append(TileMatrixSetLink(uri))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>uri = matrix_set_elements[<NUM_LIT:0>].text.strip()<EOL>tilematrixlimits = {}<EOL>path = '<STR_LIT>' % (_TILE_MATRIX_SET_LIMITS_TAG,<EOL>_TILE_MATRIX_LIMITS_TAG)<EOL>for limits_element in link_element.findall(path):<EOL><INDENT>tml = TileMatrixLimits(limits_element)<EOL>if tml.tilematrix:<EOL><INDENT>if tml.tilematrix in tilematrixlimits:<EOL><INDENT>msg = ('<STR_LIT>'<EOL>'<STR_LIT>' % tml.tilematrix)<EOL>raise KeyError(msg)<EOL><DEDENT>tilematrixlimits[tml.tilematrix] = tml<EOL><DEDENT><DEDENT>links.append(TileMatrixSetLink(uri, tilematrixlimits))<EOL><DEDENT><DEDENT>return links<EOL>
Return a list of TileMatrixSetLink instances derived from the
given list of <TileMatrixSetLink> XML elements.