本文整理了Java中org.geotools.xml.Parser.<init>()
方法的一些代码示例,展示了Parser.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.<init>()
方法的具体详情如下:
包路径:org.geotools.xml.Parser
类名称:Parser
方法名:<init>
[英]Creats a new instance of the parser.
[中]创建解析器的新实例。
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser( xml );
return p.parse( input );
}
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser(xml);
return p.parse(input);
}
代码示例来源:origin: stackoverflow.com
Parser parser = new Parser();
while (...) {
parser.parse(sentence);
}
代码示例来源:origin: stackoverflow.com
String[] exampleDates = {
"2015-10-10",
"2015/10/10",
"2015-10-30 15:30"
};
Parser parser = new Parser();
for (String dateString : exampleDates) {
List<DateGroup> dates = parser.parse(dateString);
Date date = dates.get(0).getDates().get(0);
System.out.println(date);
}
代码示例来源:origin: stackoverflow.com
Parser prs = new Parser();
EditText et = (EditText)findViewById(R.id.edittext);
String expr = et.getText().toString();
String result = prs.parse(expr);
代码示例来源:origin: stackoverflow.com
String data = "word1 AND ((word2 AND word3) AND word4) AND word5";
Parser p = new Parser();
for (String s : p.parse(data))
System.out.println(s);
代码示例来源:origin: stackoverflow.com
Scanner scanner = new Scanner(fileName);
Parser parser = new Parser(scanner);
Module module = parser.parse();
代码示例来源:origin: stackoverflow.com
Parser parser = new Parser(getClass().getResourceAsStream("resource.xlsx"));
List<DataRow> data = parser.parse().findAllWhere("FLAG", "Y");
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser(configuration);
FeatureCollectionType fct = (FeatureCollectionType) p.parse(input);
return decode(fct);
}
代码示例来源:origin: stackoverflow.com
final Parser parser = new Parser();
final StringWriter writer = new StringWriter();
parser.setContentHandler(new XMLWriter(writer));
parser.parse(new InputSource(
new URL("http://oregonstate.edu/instruct/phl302/texts/hobbes/leviathan-c.html")
.openConnection().getInputStream()));
System.out.println(writer.toString());
代码示例来源:origin: stackoverflow.com
public Pet parsePet(String petStr, ValidationErrors errors) {
try {
Parser parser = new Parser();
pet = parser.parse(petStr, Pet.class);
} catch(Exception e) {
errors.addError("Parsing pet failed: " + e.getMessage());
return null;
}
return pet;
}
代码示例来源:origin: stackoverflow.com
String uaString = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3";
Parser uaParser = new Parser();
Client c = uaParser.parse(uaString);
System.out.println(c.userAgent.family);
// => "Mobile Safari"
System.out.println(c.userAgent.major);
// => "5"
System.out.println(c.userAgent.minor);
// => "1"
System.out.println(c.os.family);
// => "iOS"
System.out.println(c.os.major);
// => "5"
System.out.println(c.os.minor);
// => "1"
System.out.println(c.device.family);
// => "iPhone
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public Object decode(Object input) throws Exception {
Parser p = new Parser(sldConfiguration);
// extract the first style in the first sld
StyledLayerDescriptor sld = (StyledLayerDescriptor) p.parse(new StringReader((String) input));
NamedLayer styledLayer = (NamedLayer) sld.getStyledLayers()[0];
return styledLayer.getStyles()[0];
}
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser(sldConfiguration);
// extract the first style in the first sld
StyledLayerDescriptor sld = (StyledLayerDescriptor) p.parse(input);
NamedLayer styledLayer = (NamedLayer) sld.getStyledLayers()[0];
return styledLayer.getStyles()[0];
}
代码示例来源:origin: stackoverflow.com
Parser p = new Parser();
SAX2DOM sax2dom = new SAX2DOM();
URL url = new URL("http://stackoverflow.com");
p.setContentHandler(sax2dom);
p.parse(new InputSource(new InputStreamReader(url.openStream())));
org.w3c.dom.Node doc = sax2dom.getDOM();
代码示例来源:origin: stackoverflow.com
import org.htmlparser.Parser;
import org.htmlparser.util.NodeList;
import org.htmlparser.util.ParserException;
...
String html; /* read your HTML into variable 'html' */
String result=null;
....
try {
Parser p = new Parser(html);
NodeList nodes = p.parse(null);
result = nodes.asString();
} catch (ParserException e) {
e.printStackTrace();
}
代码示例来源:origin: stackoverflow.com
Parser parser = new Parser("http://stackoverflow.com/questions/7293729/parsing-using-htmlparser/");
parser.setEncoding("UTF-8");
NodeList nl = parser.parse(null);
NodeList div = nl.extractAllNodesThatMatch(new TagNameFilter("div"),true);
System.out.println(div.toString());
代码示例来源:origin: org.geoserver.extension/gs-wps-core
/**
* Used to decode external XML documents for use as process inputs
*
* @param stream
*/
public Object decode(InputStream stream) {
Object decoded = null;
Configuration config = null;
try {
config = (Configuration) (this.getXMLConfiguration().getConstructor().newInstance());
} catch (Exception e) {
throw new WPSException("NoApplicableCode", "Failed to initialize XMLConfiguration");
}
org.geotools.xml.Parser parser = new org.geotools.xml.Parser(config);
try {
decoded = (Geometry) parser.parse(stream);
} catch (Exception e) {
throw new WPSException("NoApplicableCode", "Parsing error " + e);
}
return decoded;
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws Exception {
Parser parser = new Parser("file:test.html");
CssSelectorNodeFilter cssFilter = new CssSelectorNodeFilter("td[class=\"xx\"]");
NodeList nodes = parser.parse(cssFilter);
String[][] resultSet = new String[nodes.size()][2];
for (int i=0;i<nodes.size();i++) {
Node n = nodes.elementAt(i);
System.out.println(n); // DEBUG remove me!
resultSet[i][0]=n.toPlainTextString().trim();
resultSet[i][1]=null;
Node c = n.getFirstChild();
while( c!=null ) {
if( c instanceof LinkTag ) {
resultSet[i][1] = ((LinkTag) c).getLink();
break;
}
c = c.getNextSibling();
}
System.out.println(i+" text :"+resultSet[i][0]); // DEBUG remove me!
System.out.println(i+" link :"+resultSet[i][1]); // DEBUG remove me!
}
}
代码示例来源:origin: stackoverflow.com
Parser parser = new Parser("http://www.yahoo.com/");
NodeList list = parser.parse(new TagNameFilter("IMG"));
for ( SimpleNodeIterator iterator = list.elements(); iterator.hasMoreNodes(); ) {
Tag tag = (Tag) iterator.nextNode();
System.out.println(tag.getAttribute("src"));
}
内容来源于网络,如有侵权,请联系作者删除!