svn-gvsig-desktop / branches / v02_desarrollo / libraries / sld / temp / org.gvsig.sldsupport.lib.impl / src / main / java / org / gvsig / sldsupport / impl / sld1_0_0 / parsing / filteroperator / comparison / IsLikeComparisonElement.java @ 40794
History | View | Annotate | Download (2.01 KB)
1 |
package org.gvsig.sldsupport.impl.sld1_0_0.parsing.filteroperator.comparison; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import org.gvsig.sldsupport.exception.SLDReadException; |
6 |
import org.gvsig.sldsupport.impl.sld1_0_0.parsing.filteroperator.spatial.EnvelopeElement; |
7 |
import org.gvsig.sldsupport.impl.util.SLDUtils; |
8 |
import org.gvsig.sldsupport.sld.filter.FilterTags; |
9 |
import org.gvsig.sldsupport.sld.filter.expression.operator.SLDLiteral; |
10 |
import org.gvsig.sldsupport.sld.filter.operator.comparison.SLDIsLikeOperator; |
11 |
import org.gvsig.sldsupport.sld.filter.operator.spatial.GMLEnvelope; |
12 |
import org.gvsig.sldsupport.sld.filter.operator.spatial.SLDBBoxOperator; |
13 |
import org.kxml2.io.KXmlParser; |
14 |
import org.xmlpull.v1.XmlPullParser; |
15 |
import org.xmlpull.v1.XmlPullParserException; |
16 |
|
17 |
public class IsLikeComparisonElement { |
18 |
|
19 |
public static SLDIsLikeOperator parse(XmlPullParser parser , String version) |
20 |
throws XmlPullParserException, IOException, SLDReadException { |
21 |
|
22 |
parser.require(KXmlParser.START_TAG, null, FilterTags.PROPERTYISLIKE);
|
23 |
int tag = 0; |
24 |
|
25 |
SLDIsLikeOperator resp = new SLDIsLikeOperator();
|
26 |
|
27 |
tag = parser.next(); |
28 |
String name = parser.getName();
|
29 |
|
30 |
String att = parser.getAttributeValue(null, "wildCard"); |
31 |
resp.setWildCard(att); |
32 |
att = parser.getAttributeValue(null, "singleChar"); |
33 |
resp.setSingleChar(att); |
34 |
att = parser.getAttributeValue(null, "escapeChar"); |
35 |
resp.setEscapeChar(att); |
36 |
|
37 |
String txt = null; |
38 |
while (!(SLDUtils.isStr(name, FilterTags.PROPERTYISLIKE)
|
39 |
&& tag == KXmlParser.END_TAG)) { |
40 |
|
41 |
switch (tag) {
|
42 |
case KXmlParser.START_TAG:
|
43 |
if (SLDUtils.isStr(name, FilterTags.PROPERTYNAME)) {
|
44 |
txt = parser.nextText(); |
45 |
resp.setPropertyName(txt); |
46 |
break;
|
47 |
} |
48 |
if (SLDUtils.isStr(name, FilterTags.LITERAL)) {
|
49 |
txt = parser.nextText(); |
50 |
resp.setLiteral(txt); |
51 |
break;
|
52 |
} |
53 |
break;
|
54 |
case KXmlParser.END_TAG:
|
55 |
break;
|
56 |
case KXmlParser.TEXT:
|
57 |
break;
|
58 |
} |
59 |
tag = parser.next(); |
60 |
} |
61 |
|
62 |
parser.next(); |
63 |
return resp;
|
64 |
} |
65 |
} |