Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* ModuleParser.java
*
* Created on April 27, 2006, 10:37 PM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rometools.modules.sle.io;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.jdom2.Element;
import org.jdom2.Namespace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.modules.sle.SimpleListExtension;
import com.rometools.modules.sle.SimpleListExtensionImpl;
import com.rometools.modules.sle.types.Group;
import com.rometools.modules.sle.types.Sort;
import com.rometools.rome.feed.module.Module;
/**
*
* @author Robert "kebernet" Cooper
*/
public class ModuleParser implements com.rometools.rome.io.ModuleParser {
private static final Logger LOG = LoggerFactory.getLogger(ModuleParser.class);
static final Namespace NS = Namespace.getNamespace("cf", SimpleListExtension.URI);
public static final Namespace TEMP = Namespace.getNamespace("rome-sle", "urn:rome:sle");
/** Creates a new instance of ModuleParser */
public ModuleParser() {
super();
}
/**
* Returns the namespace URI this parser handles.
*
*
* @return the namespace URI.
*/
@Override
public String getNamespaceUri() {
return SimpleListExtension.URI;
}
/**
* Parses the XML node (JDOM element) extracting module information.
*
*
* @param element the XML node (JDOM element) to extract module information from.
* @return a module instance, null if the element did not have module information.
*/
@Override
public Module parse(final Element element, final Locale locale) {
if (element.getChild("treatAs", NS) == null) {
return null;
}
final SimpleListExtension sle = new SimpleListExtensionImpl();
sle.setTreatAs(element.getChildText("treatAs", NS));
final Element listInfo = element.getChild("listinfo", NS);
ArrayList