public Document getDocument(String xmlFilename) throws CmsXmlException {

        // try to get it from the cache
        Document document = m_cache.get(xmlFilename);

        if (document == null) {
            try {
                document = CmsXmlUtils.unmarshalHelper(
                    new InputSource(new FileReader(getFile(xmlFilename))),
                    NO_ENTITY_RESOLVER);
            } catch (FileNotFoundException e) {
                LOG.error("Could not read file " + xmlFilename, e);
                throw new CmsXmlException(new CmsMessageContainer(null, e.toString()));

            } catch (Exception e) {
                LOG.error("Could not parse file " + xmlFilename, e);
                throw new CmsXmlException(
                    Messages.get().container(Messages.ERR_XML_COULD_NOT_PARSE_FILE_1, xmlFilename),
                    e);
            }
            // cache the doc
            m_cache.put(xmlFilename, document);
        }
        return document;
    }
public Document getDocument ( String xmlFilename ) throws CmsXmlException { Document document = m_cache . get ( xmlFilename ) ; if ( document == null ) { try { document = CmsXmlUtils . unmarshalHelper ( new InputSource ( new FileReader ( getFile ( xmlFilename ) ) ) , NO_ENTITY_RESOLVER ) ; } catch ( FileNotFoundException e ) { LOG . error ( "Could not read file " + xmlFilename , e ) ; throw new CmsXmlException ( new CmsMessageContainer ( null , e . toString ( ) ) ) ; } catch ( Exception e ) { LOG . error ( "Could not parse file " + xmlFilename , e ) ; throw new CmsXmlException ( Messages . get ( ) . container ( Messages . ERR_XML_COULD_NOT_PARSE_FILE_1 , xmlFilename ) , e ) ; } m_cache . put ( xmlFilename , document ) ; } return document ; }
Returns the document for the given filename.<p>
It can be new read or come from the document cache.<p>

@param xmlFilename the filename to read

@return the document for the given filename

@throws CmsXmlException if something goes wrong while reading