public Element getElementWithCanonicalName ( String canonicalName ) { if ( canonicalName == null || canonicalName . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( "A canonical name must be specified." ) ; } // canonical names start with a leading slash, so add this if it's missing if ( ! canonicalName . startsWith ( "/" ) ) { canonicalName = "/" + canonicalName ; } for ( Element element : getElements ( ) ) { if ( element . getCanonicalName ( ) . equals ( canonicalName ) ) { return element ; } } return null ; }
Gets the element with the specified canonical name .