@Override
    protected void initDocument(Document document, String encoding, CmsXmlContentDefinition definition) {

        m_encoding = CmsEncoder.lookupEncoding(encoding, encoding);
        m_document = document;
        m_elementLocales = new HashMap<String, Set<Locale>>();
        m_elementNames = new HashMap<Locale, Set<String>>();
        m_locales = new HashSet<Locale>();

        // convert pre 5.3.6 XML page documents
        if (!NODE_PAGES.equals(m_document.getRootElement().getName())) {
            convertOldDocument();
        }

        // initialize the bookmarks
        clearBookmarks();
        Element pages = m_document.getRootElement();
        try {
            for (Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(pages, NODE_PAGE); i.hasNext();) {

                Element page = i.next();
                Locale locale = CmsLocaleManager.getLocale(page.attributeValue(ATTRIBUTE_LANGUAGE));
                for (Iterator<Element> j = CmsXmlGenericWrapper.elementIterator(page, NODE_ELEMENT); j.hasNext();) {

                    Element element = j.next();
                    String name = element.attributeValue(ATTRIBUTE_NAME);

                    String elementEnabled = element.attributeValue(ATTRIBUTE_ENABLED);
                    boolean enabled = (elementEnabled == null) ? true : Boolean.valueOf(elementEnabled).booleanValue();

                    // create an element type from the XML node
                    CmsXmlHtmlValue value = new CmsXmlHtmlValue(this, element, locale);
                    value.setContentDefinition(definition);

                    // add the element type bookmark
                    addBookmark(CmsXmlUtils.createXpathElement(name, 1), locale, enabled, value);
                }
                addLocale(locale);
            }
        } catch (NullPointerException e) {
            LOG.error(Messages.get().getBundle().key(Messages.ERR_XML_PAGE_INIT_BOOKMARKS_0), e);
        }
    }
@ Override protected void initDocument ( Document document , String encoding , CmsXmlContentDefinition definition ) { m_encoding = CmsEncoder . lookupEncoding ( encoding , encoding ) ; m_document = document ; m_elementLocales = new HashMap < String , Set < Locale > > ( ) ; m_elementNames = new HashMap < Locale , Set < String > > ( ) ; m_locales = new HashSet < Locale > ( ) ; if ( ! NODE_PAGES . equals ( m_document . getRootElement ( ) . getName ( ) ) ) { convertOldDocument ( ) ; } clearBookmarks ( ) ; Element pages = m_document . getRootElement ( ) ; try { for ( Iterator < Element > i = CmsXmlGenericWrapper . elementIterator ( pages , NODE_PAGE ) ; i . hasNext ( ) ; ) { Element page = i . next ( ) ; Locale locale = CmsLocaleManager . getLocale ( page . attributeValue ( ATTRIBUTE_LANGUAGE ) ) ; for ( Iterator < Element > j = CmsXmlGenericWrapper . elementIterator ( page , NODE_ELEMENT ) ; j . hasNext ( ) ; ) { Element element = j . next ( ) ; String name = element . attributeValue ( ATTRIBUTE_NAME ) ; String elementEnabled = element . attributeValue ( ATTRIBUTE_ENABLED ) ; boolean enabled = ( elementEnabled == null ) ? true : Boolean . valueOf ( elementEnabled ) . booleanValue ( ) ; CmsXmlHtmlValue value = new CmsXmlHtmlValue ( this , element , locale ) ; value . setContentDefinition ( definition ) ; addBookmark ( CmsXmlUtils . createXpathElement ( name , 1 ) , locale , enabled , value ) ; } addLocale ( locale ) ; } } catch ( NullPointerException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_XML_PAGE_INIT_BOOKMARKS_0 ) , e ) ; } }
@see org.opencms.xml.A_CmsXmlDocument#initDocument(org.dom4j.Document, java.lang.String, org.opencms.xml.CmsXmlContentDefinition)