Code example for Document

Methods: getDocumentElement

0
        } 
    } 
 
    @Override 
    protected void xmlModelChanged(Document xmlDoc) {
        Element rootElement = xmlDoc.getDocumentElement();
        if (rootElement != null) {
            mRootTag = rootElement.getTagName();
        } 
 
        initUiRootNode(false /*force*/); 
 
        if (mRootTag != null
                && !mRootTag.equals(mUiRootNode.getDescriptor().getXmlLocalName())) {
            AndroidTargetData data = getTargetData();
            if (data != null) {
                ElementDescriptor descriptor =
                    data.getDrawableDescriptors().getElementDescriptor(mRootTag);
                // Replace top level node now that we know the actual type 
 
                // Disconnect from old 
                mUiRootNode.setEditor(null);
                mUiRootNode.setXmlDocument(null);
 
                // Create new 
                mUiRootNode = descriptor.createUiNode();
                mUiRootNode.setXmlDocument(xmlDoc);
                mUiRootNode.setEditor(this);
            } 
        } 
 
        if (mUiRootNode.getDescriptor() instanceof DocumentDescriptor) {
            mUiRootNode.loadFromXmlNode(xmlDoc);
        } else { 
            mUiRootNode.loadFromXmlNode(rootElement);
        } 
 
        super.xmlModelChanged(xmlDoc);
    } 
 
    @Override 
    protected void initUiRootNode(boolean force) {
        // The manifest UI node is always created, even if there's no corresponding XML node.