Search in sources :

Example 1 with Attribute

use of com.liferay.portal.kernel.xml.Attribute in project liferay-ide by liferay.

the class MediaWikiImporter method readSpecialNamespaces.

protected List<String> readSpecialNamespaces(Element root) throws ImportFilesException {
    List<String> namespaces = new ArrayList<String>();
    Element siteinfoElement = root.element("siteinfo");
    if (siteinfoElement == null) {
        throw new ImportFilesException("Invalid pages XML file");
    }
    Element namespacesElement = siteinfoElement.element("namespaces");
    List<Element> namespaceElements = namespacesElement.elements("namespace");
    for (Element namespaceElement : namespaceElements) {
        Attribute attribute = namespaceElement.attribute("key");
        String value = attribute.getValue();
        if (!value.equals("0")) {
            namespaces.add(namespaceElement.getText());
        }
    }
    return namespaces;
}
Also used : Attribute(com.liferay.portal.kernel.xml.Attribute) ImportFilesException(com.liferay.portlet.wiki.ImportFilesException) Element(com.liferay.portal.kernel.xml.Element) ArrayList(java.util.ArrayList)

Aggregations

Attribute (com.liferay.portal.kernel.xml.Attribute)1 Element (com.liferay.portal.kernel.xml.Element)1 ImportFilesException (com.liferay.portlet.wiki.ImportFilesException)1 ArrayList (java.util.ArrayList)1