Example usage for org.w3c.dom Element getNodeName

List of usage examples for org.w3c.dom Element getNodeName

Introduction

In this page you can find the example usage for org.w3c.dom Element getNodeName.

Prototype

public String getNodeName();

Source Link

Document

The name of this node, depending on its type; see the table above.

Usage

From source file:eu.stratosphere.nephele.configuration.GlobalConfiguration.java

/**
 * Loads an XML document of key-values pairs.
 * /* w  w  w.  ja v a2 s  .c  om*/
 * @param file
 *        the XML document file
 */
private void loadResource(final File file) {

    final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    // Ignore comments in the XML file
    docBuilderFactory.setIgnoringComments(true);
    docBuilderFactory.setNamespaceAware(true);

    // TODO: Trying to set this option causes an exception. What do we need it for? (DW)
    /*
     * try {
     * docBuilderFactory.setXIncludeAware(true);
     * } catch (UnsupportedOperationException e) {
     * LOG.error("Failed to set setXIncludeAware(true) for parser " + docBuilderFactory + ":" + e, e);
     * }
     */

    try {

        final DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
        Document doc = null;
        Element root = null;

        doc = builder.parse(file);

        if (doc == null) {
            LOG.warn("Cannot load configuration: doc is null");
            return;
        }

        root = doc.getDocumentElement();
        if (root == null) {
            LOG.warn("Cannot load configuration: root is null");
            return;
        }

        if (!"configuration".equals(root.getNodeName())) {
            LOG.warn("Cannot load configuration: unknown element " + root.getNodeName());
            return;
        }

        final NodeList props = root.getChildNodes();
        int propNumber = -1;

        synchronized (this.confData) {

            for (int i = 0; i < props.getLength(); i++) {

                final Node propNode = props.item(i);
                String key = null;
                String value = null;

                // Ignore text at this point
                if (propNode instanceof Text) {
                    continue;
                }

                if (!(propNode instanceof Element)) {
                    LOG.warn("Error while reading configuration: " + propNode.getNodeName()
                            + " is not of type element");
                    continue;
                }

                Element property = (Element) propNode;
                if (!"property".equals(property.getNodeName())) {
                    LOG.warn("Error while reading configuration: unknown element " + property.getNodeName());
                    continue;
                }

                propNumber++;
                final NodeList propChildren = property.getChildNodes();
                if (propChildren == null) {
                    LOG.warn("Error while reading configuration: property has no children, skipping...");
                    continue;
                }

                for (int j = 0; j < propChildren.getLength(); j++) {

                    final Node propChild = propChildren.item(j);
                    if (propChild instanceof Element) {
                        if ("key".equals(propChild.getNodeName())) {
                            if (propChild.getChildNodes() != null) {
                                if (propChild.getChildNodes().getLength() == 1) {
                                    if (propChild.getChildNodes().item(0) instanceof Text) {
                                        final Text t = (Text) propChild.getChildNodes().item(0);
                                        key = t.getTextContent();
                                    }
                                }
                            }
                        }

                        if ("value".equals(propChild.getNodeName())) {
                            if (propChild.getChildNodes() != null) {
                                if (propChild.getChildNodes().getLength() == 1) {
                                    if (propChild.getChildNodes().item(0) instanceof Text) {
                                        final Text t = (Text) propChild.getChildNodes().item(0);
                                        value = t.getTextContent();
                                    }
                                }
                            }
                        }
                    }
                }

                if (key != null && value != null) {
                    // Put key, value pair into the map
                    LOG.debug("Loading configuration property: " + key + ", " + value);
                    this.confData.put(key, value);
                } else {
                    LOG.warn("Error while reading configuration: Cannot read property " + propNumber);
                    continue;
                }
            }
        }

    } catch (ParserConfigurationException e) {
        LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
    } catch (IOException e) {
        LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
    } catch (SAXException e) {
        LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
    }
}

From source file:com.inbravo.scribe.rest.service.crm.ms.MSCRMMessageFormatUtils.java

/**
 * This method is to support custom fields in CRM objects
 * /*from  ww  w.  ja  v  a 2 s.  c o  m*/
 * @param account
 * @param accountId
 * @param cADbject
 * @return
 * @throws Exception
 */
public static final Entity createV5CRMObject(final ScribeObject cADbject, final String crmFieldIntraSeparator,
        final String permittedDateFormats) throws Exception {

    /* Create xml beans object */
    final Entity entity = Entity.Factory.newInstance();

    /* Set target name */
    entity.setLogicalName(cADbject.getObjectType().trim());

    /* Step 2: get all node attributes */
    final AttributeCollection attCol = entity.addNewAttributes();

    /* Iterate on the Element list and create SOAP object */
    for (final Element element : cADbject.getXmlContent()) {

        /* Avoid if its local purpose regardingobjectid node */
        if (element.getNodeName().equalsIgnoreCase(regardingObjectidConst)) {

            /* Ignore this element */
            continue;
        } else {

            /* Get element name */
            final String crmField = element.getNodeName();

            /* Break the field name using field/type seperator */
            if (crmField.contains(crmFieldIntraSeparator)) {

                /* Get field name */
                final String crmFieldName = crmField.split(crmFieldIntraSeparator)[0];

                /* Get field type */
                final String crmFieldtype = crmField.split(crmFieldIntraSeparator)[1];

                if (logger.isDebugEnabled()) {
                    logger.debug("----Inside createV5CRMObject: crmFieldName: '" + crmFieldName
                            + "' & crmFieldtype : '" + crmFieldtype + "'");
                }

                /* Add new key value pair */
                final KeyValuePairOfstringanyType kvpsat = attCol.addNewKeyValuePairOfstringanyType();

                /* Set CRM field name */
                kvpsat.setKey(crmFieldName);

                /* If type is OptionSet; map it to boolean */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.OPTION_SET)
                        || crmFieldtype.equalsIgnoreCase(MSV5DataTypes.TWO_OPTIONS)) {

                    /* Create new string value */
                    final XmlBoolean xb = org.apache.xmlbeans.XmlBoolean.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xb.setStringValue(element.getTextContent());
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xb);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(
                                ScribeResponseCodes._1003 + "Following CRM field value is not valid: "
                                        + element.getTextContent() + ": type should be : "
                                        + MSV5DataTypes.OPTION_SET + " or " + MSV5DataTypes.TWO_OPTIONS);
                    }
                } else
                /* If type is datetime */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.DATE_TIME)) {

                    /* Create new date value */
                    final XmlDateTime xdt = org.apache.xmlbeans.XmlDateTime.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xdt.setDateValue(validateDate(element.getTextContent(), permittedDateFormats));
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xdt);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(ScribeResponseCodes._1003
                                + "Following CRM field value is not valid: " + element.getTextContent()
                                + ": type should be : " + MSV5DataTypes.DATE_TIME);
                    }

                } else
                /* If type is number/whole number */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.NUMBER)
                        || crmFieldtype.equalsIgnoreCase(MSV5DataTypes.WHOLE_NUMBER)) {

                    /* Create new string value */
                    final XmlInt xi = org.apache.xmlbeans.XmlInt.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xi.setStringValue(element.getTextContent());
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xi);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(
                                ScribeResponseCodes._1003 + "Following CRM field value is not valid: "
                                        + element.getTextContent() + ": type should be : "
                                        + MSV5DataTypes.NUMBER + " or " + MSV5DataTypes.WHOLE_NUMBER);
                    }

                } else
                /* If type is text */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.TEXT)) {

                    /* Create new string value */
                    final XmlString xs = org.apache.xmlbeans.XmlString.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xs.setStringValue(element.getTextContent());
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xs);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(ScribeResponseCodes._1003
                                + "Following CRM field value is not valid: " + element.getTextContent()
                                + ": type should be : " + MSV5DataTypes.TEXT);
                    }

                } else
                /* If type is float */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.FLOATING_POINT)) {

                    /* Create new float value */
                    final XmlFloat xf = org.apache.xmlbeans.XmlFloat.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xf.setStringValue(element.getTextContent());
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xf);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(ScribeResponseCodes._1003
                                + "Following CRM field value is not valid: " + element.getTextContent()
                                + ": type should be : " + MSV5DataTypes.FLOATING_POINT);
                    }

                } else
                /* If type is multiple list */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.MULTIPLE_LIST)) {

                    /* Create new string value */
                    final XmlString xs = org.apache.xmlbeans.XmlString.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xs.setStringValue(element.getTextContent());
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xs);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(ScribeResponseCodes._1003
                                + "Following CRM field value is not valid: " + element.getTextContent()
                                + ": type should be : " + MSV5DataTypes.MULTIPLE_LIST);
                    }

                } else
                /* If type is currency */
                if (crmFieldtype.equalsIgnoreCase(MSV5DataTypes.CURRENCY)) {

                    /* Create new string value */
                    final XmlString xs = org.apache.xmlbeans.XmlString.Factory.newInstance();

                    try {

                        if (element.getTextContent() != null) {

                            /* Set node value */
                            xs.setStringValue(element.getTextContent());
                        }

                        /* Set CRM field value */
                        kvpsat.setValue(xs);

                    } catch (final XmlValueOutOfRangeException e) {

                        /* Throw user error */
                        throw new ScribeException(ScribeResponseCodes._1003
                                + "Following CRM field value is not valid: " + element.getTextContent()
                                + ": type should be : " + MSV5DataTypes.CURRENCY);
                    }

                } else {

                    /* Throw user error */
                    throw new ScribeException(ScribeResponseCodes._1003
                            + "Following MS CRM field type is not supported: " + crmFieldtype);

                }
            } else {

                /* Throw user error */
                throw new ScribeException(ScribeResponseCodes._1003 + "Following CRM field name is not valid: "
                        + element.getTextContent() + ": It should contain type information seperated by: "
                        + crmFieldIntraSeparator);
            }
        }
    }

    return entity;
}

From source file:com.alfaariss.oa.util.saml2.profile.metadata.AbstractMetadataProfile.java

/**
 * Performs a deep clone of the supplied object. 
 * @param object The XML object to be cloned.
 * @return A deep clone of the supplied object.
 * @throws OAException If marshalling fails
 *///w w  w .  j  a v a 2  s  .co  m
protected XMLObject cloneXMLObject(XMLObject object) throws OAException {
    Element eClone = null;
    try {
        Element eSource = object.getDOM();
        if (eSource == null) {
            Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(object);
            if (marshaller == null) {
                _logger.error("No marshaller registered for " + object.getElementQName()
                        + ", unable to marshall metadata");
                throw new OAException(SystemErrors.ERROR_INTERNAL);
            }
            eSource = marshaller.marshall(object);
        }

        eClone = (Element) eSource.cloneNode(true);

        Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(eClone);
        if (unmarshaller == null) {
            _logger.error("No unmarshaller registered for " + eClone.getNodeName()
                    + ", unable to unmarshall metadata");
            throw new OAException(SystemErrors.ERROR_INTERNAL);
        }

        return unmarshaller.unmarshall(eClone);
    } catch (MarshallingException e) {
        _logger.debug("Could not marshall object: " + object.getElementQName(), e);
        throw new OAException(SystemErrors.ERROR_INTERNAL);
    } catch (UnmarshallingException e) {
        _logger.debug("Could not unmarshall object: " + eClone.getNodeName(), e);
        throw new OAException(SystemErrors.ERROR_INTERNAL);
    } catch (OAException e) {
        throw e;
    } catch (Exception e) {
        _logger.warn("Internal Error while cloning object: " + object.getElementQName(), e);
        throw new OAException(SystemErrors.ERROR_INTERNAL);
    }
}

From source file:com.netspective.sparx.util.xml.XmlSource.java

/**
 * Given an element, see if the element is a <templates> element. If it is, then catalog all of
 * the elements as templates that can be re-used at a later point.
 *//*  w ww.j  a va 2s.c  o m*/
public void catalogElement(Element elem) {
    if (!"templates".equals(elem.getNodeName()))
        return;

    String pkgName = elem.getAttribute("package");

    NodeList children = elem.getChildNodes();
    for (int c = 0; c < children.getLength(); c++) {
        Node child = children.item(c);
        if (child.getNodeType() != Node.ELEMENT_NODE)
            continue;

        Element childElem = (Element) child;
        String templateName = childElem.getAttribute("id");
        if (templateName.length() == 0)
            templateName = childElem.getAttribute("name");

        templates.put(pkgName.length() > 0 ? (pkgName + "." + templateName) : templateName, childElem);
    }
}

From source file:eu.stratosphere.configuration.GlobalConfiguration.java

/**
 * Loads an XML document of key-values pairs.
 * //w  w  w  . j av  a  2s . c o m
 * @param file
 *        the XML document file
 */
private void loadXMLResource(final File file) {

    final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    // Ignore comments in the XML file
    docBuilderFactory.setIgnoringComments(true);
    docBuilderFactory.setNamespaceAware(true);

    try {

        final DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
        Document doc = null;
        Element root = null;

        doc = builder.parse(file);

        if (doc == null) {
            LOG.warn("Cannot load configuration: doc is null");
            return;
        }

        root = doc.getDocumentElement();
        if (root == null) {
            LOG.warn("Cannot load configuration: root is null");
            return;
        }

        if (!"configuration".equals(root.getNodeName())) {
            LOG.warn("Cannot load configuration: unknown element " + root.getNodeName());
            return;
        }

        final NodeList props = root.getChildNodes();
        int propNumber = -1;

        synchronized (this.confData) {

            for (int i = 0; i < props.getLength(); i++) {

                final Node propNode = props.item(i);
                String key = null;
                String value = null;

                // Ignore text at this point
                if (propNode instanceof Text) {
                    continue;
                }

                if (!(propNode instanceof Element)) {
                    LOG.warn("Error while reading configuration: " + propNode.getNodeName()
                            + " is not of type element");
                    continue;
                }

                Element property = (Element) propNode;
                if (!"property".equals(property.getNodeName())) {
                    LOG.warn("Error while reading configuration: unknown element " + property.getNodeName());
                    continue;
                }

                propNumber++;
                final NodeList propChildren = property.getChildNodes();
                if (propChildren == null) {
                    LOG.warn("Error while reading configuration: property has no children, skipping...");
                    continue;
                }

                for (int j = 0; j < propChildren.getLength(); j++) {

                    final Node propChild = propChildren.item(j);
                    if (propChild instanceof Element) {
                        if ("key".equals(propChild.getNodeName())) {
                            if (propChild.getChildNodes() != null) {
                                if (propChild.getChildNodes().getLength() == 1) {
                                    if (propChild.getChildNodes().item(0) instanceof Text) {
                                        final Text t = (Text) propChild.getChildNodes().item(0);
                                        key = t.getTextContent();
                                    }
                                }
                            }
                        }

                        if ("value".equals(propChild.getNodeName())) {
                            if (propChild.getChildNodes() != null) {
                                if (propChild.getChildNodes().getLength() == 1) {
                                    if (propChild.getChildNodes().item(0) instanceof Text) {
                                        final Text t = (Text) propChild.getChildNodes().item(0);
                                        value = t.getTextContent();
                                    }
                                }
                            }
                        }
                    }
                }

                if (key != null && value != null) {
                    // Put key, value pair into the map
                    LOG.debug("Loading configuration property: " + key + ", " + value);
                    this.confData.put(key, value);
                } else {
                    LOG.warn("Error while reading configuration: Cannot read property " + propNumber);
                    continue;
                }
            }
        }

    } catch (ParserConfigurationException e) {
        LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
    } catch (IOException e) {
        LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
    } catch (SAXException e) {
        LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
    }
}

From source file:com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.java

public void loadPackages() throws ConfigurationException {
    List<Element> reloads = new ArrayList<Element>();
    verifyPackageStructure();//w ww .  java  2 s. c om

    for (Document doc : documents) {
        Element rootElement = doc.getDocumentElement();
        NodeList children = rootElement.getChildNodes();
        int childSize = children.getLength();

        for (int i = 0; i < childSize; i++) {
            Node childNode = children.item(i);

            if (childNode instanceof Element) {
                Element child = (Element) childNode;

                final String nodeName = child.getNodeName();

                if ("package".equals(nodeName)) {
                    PackageConfig cfg = addPackage(child);
                    if (cfg.isNeedsRefresh()) {
                        reloads.add(child);
                    }
                }
            }
        }
        loadExtraConfiguration(doc);
    }

    if (reloads.size() > 0) {
        reloadRequiredPackages(reloads);
    }

    for (Document doc : documents) {
        loadExtraConfiguration(doc);
    }

    documents.clear();
    declaredPackages.clear();
    configuration = null;
}

From source file:com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.java

private void verifyPackageStructure() {
    DirectedGraph<String> graph = new DirectedGraph<String>();

    for (Document doc : documents) {
        Element rootElement = doc.getDocumentElement();
        NodeList children = rootElement.getChildNodes();
        int childSize = children.getLength();
        for (int i = 0; i < childSize; i++) {
            Node childNode = children.item(i);
            if (childNode instanceof Element) {
                Element child = (Element) childNode;

                final String nodeName = child.getNodeName();

                if ("package".equals(nodeName)) {
                    String packageName = child.getAttribute("name");
                    declaredPackages.put(packageName, child);
                    graph.addNode(packageName);

                    String extendsAttribute = child.getAttribute("extends");
                    List<String> parents = ConfigurationUtil.buildParentListFromString(extendsAttribute);
                    for (String parent : parents) {
                        graph.addNode(parent);
                        graph.addEdge(packageName, parent);
                    }//from ww w.j  a  va2  s .co m
                }
            }
        }
    }

    CycleDetector<String> detector = new CycleDetector<String>(graph);
    if (detector.containsCycle()) {
        StringBuilder builder = new StringBuilder("The following packages participate in cycles:");
        for (String packageName : detector.getVerticesInCycles()) {
            builder.append(" ");
            builder.append(packageName);
        }
        throw new ConfigurationException(builder.toString());
    }
}

From source file:org.alfresco.web.config.forms.FormConfigRuntime.java

/**
 * @param condition/* www  .  j a  v  a  2  s .c om*/
 * @param formId
 * @return
 */
public List<FieldVisibilityInstructionCustom> getFieldVisibilityInstructions(String configType,
        String contentType, String formId) {
    String formIdPath = formId.equals("default") ? "[not(@id)]" : "[@id='" + formId + "']";
    Element elem = XmlUtils.findFirstElement("config[@evaluator='" + configType + "' and @condition='"
            + contentType + "']/forms/form" + formIdPath + "/field-visibility",
            (Element) configDocument.getFirstChild());
    ArrayList<FieldVisibilityInstructionCustom> fieldVisibilityInstructions = new ArrayList<FieldVisibilityInstructionCustom>();
    if (elem != null) {
        for (Element fieldVisibilityElem : XmlUtils.findElements("show|hide", elem)) {
            fieldVisibilityInstructions.add(new FieldVisibilityInstructionCustom(
                    fieldVisibilityElem.getNodeName(), fieldVisibilityElem.getAttribute("id"),
                    fieldVisibilityElem.getAttribute("for-mode"), fieldVisibilityElem.getAttribute("force")));
        }
        return fieldVisibilityInstructions;
    } else {
        return null;
    }
}

From source file:com.github.fcannizzaro.resourcer.Resourcer.java

/**
 * Parse values xml files/*from ww w. j a va2 s .co  m*/
 */
private static void findValues() {

    values = new HashMap<>();

    File dir = new File(PATH_BASE + VALUES_DIR);

    if (!dir.isDirectory())
        return;

    File[] files = dir.listFiles();

    if (files == null)
        return;

    for (File file : files)

        // only *.xml files
        if (file.getName().matches(".*\\.xml$")) {

            Document doc = FileUtils.readXML(file.getAbsolutePath());

            if (doc == null)
                return;

            Element ele = doc.getDocumentElement();

            for (String element : elements) {

                NodeList list = ele.getElementsByTagName(element);

                if (values.get(element) == null)
                    values.put(element, new HashMap<>());

                for (int j = 0; j < list.getLength(); j++) {

                    Element node = (Element) list.item(j);
                    String value = node.getFirstChild().getNodeValue();
                    Object valueDefined = value;

                    switch (element) {
                    case INTEGER:
                        valueDefined = Integer.valueOf(value);
                        break;
                    case DOUBLE:
                        valueDefined = Double.valueOf(value);
                        break;
                    case FLOAT:
                        valueDefined = Float.valueOf(value);
                        break;
                    case BOOLEAN:
                        valueDefined = Boolean.valueOf(value);
                        break;
                    case LONG:
                        valueDefined = Long.valueOf(value);
                        break;
                    case COLOR:

                        if (value.matches("@color/.*")) {

                            try {
                                Class<?> c = Class.forName("com.github.fcannizzaro.material.Colors");
                                Object colors = c.getDeclaredField(value.replace("@color/", "")).get(c);
                                Method asColor = c.getMethod("asColor");
                                valueDefined = asColor.invoke(colors);

                            } catch (Exception e) {
                                System.out.println("ERROR Resourcer - Cannot bind " + value);
                            }

                        } else
                            valueDefined = Color.decode(value);
                        break;
                    }

                    values.get(node.getNodeName()).put(node.getAttribute("name"), valueDefined);

                }

            }
        }
}

From source file:com.draagon.meta.loader.xml.XMLFileMetaDataLoader.java

/**
 * Loads the specified group types/*  www .j  av  a 2 s.co  m*/
 */
protected synchronized void loadAllTypes(Element el) throws MetaException, SAXException {

    // Get all elements that have <type> elements
    for (Element e : getElementsWithType(el)) {

        String name = e.getNodeName();

        // Get the MetaDataTypes with the specified element name
        MetaDataTypes mdts = typesMap.get(name);

        // If it doesn't exist, then create it and check for the "class" attribute
        if (mdts == null) {

            // Get the base class for the given element
            String clazz = e.getAttribute("class");
            if (clazz == null || clazz.isEmpty()) {
                throw new MetaException("Element section [" + name + "] has no 'class' attribute specified");
            }

            try {
                Class<? extends MetaData> baseClass = (Class<? extends MetaData>) Class.forName(clazz);

                // Create a new MetaDataTypes and add to the mapping
                mdts = new MetaDataTypes(baseClass);
                typesMap.put(name, mdts);
            } catch (ClassNotFoundException ex) {
                throw new MetaException(
                        "Element section [" + name + "] has an invalid 'class' attribute: " + ex.getMessage(),
                        ex);
            }
        }

        // Load all the types for the specific element type
        loadTypes(e, mdts);
    }
}