com.sun.syndication.feed.module.georss.GMLParser Maven / Gradle / Ivy
/*
* Copyright 2006 Marc Wick, geonames.org
*
* 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.sun.syndication.feed.module.georss;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.georss.geometries.LineString;
import com.sun.syndication.feed.module.georss.geometries.LinearRing;
import com.sun.syndication.feed.module.georss.geometries.Point;
import com.sun.syndication.feed.module.georss.geometries.Polygon;
import com.sun.syndication.feed.module.georss.geometries.Envelope;
import com.sun.syndication.feed.module.georss.geometries.Position;
import com.sun.syndication.feed.module.georss.geometries.PositionList;
import com.sun.syndication.io.ModuleParser;
import java.util.*;
/**
* GMLParser is a parser for the GML georss format.
*
* @author Marc Wick
* @version $Id: GMLParser.java,v 1.2 2007/06/05 20:44:53 marcwick Exp $
*
*/
public class GMLParser implements ModuleParser {
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_GEORSS_URI;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom.Element)
*/
public Module parse(Element element) {
Module geoRssModule = parseGML(element);
return geoRssModule;
}
private static PositionList parsePosList(Element element) {
String coordinates = element.getText();
String[] coord = GeoRSSUtils.trimWhitespace(coordinates).split(" ");
PositionList posList = new PositionList();
for (int i=0; i