1+ package org .sofwerx .ogc .sos ;
2+
3+ import android .util .Log ;
4+
5+ import org .w3c .dom .Document ;
6+ import org .w3c .dom .Element ;
7+ import org .w3c .dom .NodeList ;
8+
9+ import java .util .ArrayList ;
10+
11+ /**
12+ * This is used for templates that involve text rather than quantity
13+ */
14+ public class SensorTextResultTemplateField extends SensorResultTemplateField {
15+ protected SensorTextResultTemplateField () {}
16+
17+ /**
18+ * Constructor for a sensor field
19+ * @param name name of the field
20+ * @param definition definition for this type of name
21+ */
22+ public SensorTextResultTemplateField (String name , String definition ) {
23+ setName (name );
24+ setQuantityDefinition (definition );
25+ }
26+
27+ @ Override
28+ public void addToElement (Document doc , Element element ) {
29+ if ((doc == null ) || (element == null )) {
30+ Log .e (SosIpcTransceiver .TAG ,"Neither doc nor element can be null in SensorResultTemplateField.addToElement()" );
31+ return ;
32+ }
33+ Element field = doc .createElement (TAG_NAME_FIELD );
34+ field .setAttribute (NAME_NAME ,getName ());
35+ element .appendChild (field );
36+ Element text = doc .createElement (TAG_NAME_TEXT );
37+ text .setAttribute (NAME_DEFINITION ,getQuantityDefinition ());
38+ field .appendChild (text );
39+ }
40+
41+ @ Override
42+ public void parse (Element field ) {
43+ if (field == null )
44+ return ;
45+ setName (field .getAttribute (NAME_NAME ));
46+ }
47+ }
0 commit comments