Hi :
In the xml I uploaded, I want to get the valuse under the element DataArray,
but I am not sure the type , so I use the following codes to judge:
--------------------------
   ObservationCollectionDocument
ocd=ObservationCollectionDocument.Factory.parse(new File("DataArray.xml"));
   ObservationPropertyType
xb_memeber=ocd.getObservationCollection().getMemberArray(0);
   XmlObject xb_result=xb_memeber.getObservation().getResult();
   if(xb_result instanceof net.opengis.swe.x00.DataArrayType) {
    System.out.println("00");
   } else if(xb_result instanceof net.opengis.swe.x10.DataArrayType) {
    System.out.println("100");
   }
   else if(xb_result instanceof net.opengis.swe.x101.DataArrayType) {
    System.out.println("101");
   } else {
    System.out.println("null");
   }-
--------------------------------------
However the output is null, it seems that it belongs to none of the three
types.
In face, from the file(in the attach) we can easily get the version of the
DataArrayType is 1.0.1, but why the output is so strange?
<?xml version="1.0" encoding="UTF-8"?>
<om:ObservationCollection xmlns:om="http://www.opengis.net/om/1.0"; xmlns:gml="http://www.opengis.net/gml"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:swe="http://www.opengis.net/swe/1.0.1"; gml:id="oc38" xsi:schemaLocation="http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/om.xsd http://www.opengis.net/sampling/1.0 http://schemas.opengis.net/sampling/1.0.0/sampling.xsd";>
  <gml:boundedBy>
    <gml:Envelope>
      <gml:lowerCorner>20.0 20.0</gml:lowerCorner>
      <gml:upperCorner>30.0 30.0</gml:upperCorner>
    </gml:Envelope>
  </gml:boundedBy>
  <om:member>
    <om:Observation>
      <om:samplingTime>
        <gml:TimePeriod xsi:type="gml:TimePeriodType">
          <gml:beginPosition>2009-09-05T10:15:00+08:00</gml:beginPosition>
          <gml:endPosition>2009-09-06T10:15:00+08:00</gml:endPosition>
        </gml:TimePeriod>
      </om:samplingTime>
      <om:procedure xlink:href="urn:ogc:object:feature:Sensor:modis"/>
      <om:observedProperty>
        <swe:CompositePhenomenon gml:id="cpid0" dimension="1">
          <gml:name>resultComponents</gml:name>
          <swe:component xlink:href="urn:ogc:data:time:iso8601"/>
          <swe:component xlink:href="urn:ogc:def:phenomenon:image"/>
        </swe:CompositePhenomenon>
      </om:observedProperty>
      <om:featureOfInterest>
        <gml:FeatureCollection>
          <gml:featureMember>
            <gml:_Feature gml:id="China">
              <gml:name>China</gml:name>
            </gml:_Feature>
          </gml:featureMember>
        </gml:FeatureCollection>
      </om:featureOfInterest>
      <om:result>
        <swe:DataArray>
          <swe:elementCount>
            <swe:Count>
              <swe:value>2</swe:value>
            </swe:Count>
          </swe:elementCount>
          <swe:elementType name="Components">
            <swe:SimpleDataRecord>
              <swe:field name="Time">
                <swe:Time definition="urn:ogc:data:time:iso8601"/>
              </swe:field>
              <swe:field name="feature">
                <swe:Text definition="urn:ogc:data:feature"/>
              </swe:field>
              <swe:field name="urn:ogc:def:phenomenon:image">
                <swe:Category definition="urn:ogc:def:phenomenon:image"/>
              </swe:field>
            </swe:SimpleDataRecord>
          </swe:elementType>
          <swe:encoding>
            <swe:TextBlock decimalSeparator="." tokenSeparator="," blockSeparator="@@"/>
          </swe:encoding>
          <swe:values>2009-09-05T10:15:00+08,US,http://192.168.2.60:8080/SOS/data/ele.tif@@2009-09-06T10:15:00+08,US,http://192.168.2.60:8080/SOS/data/ele.tif@@</swe:values>
        </swe:DataArray>
      </om:result>
    </om:Observation>
  </om:member>
</om:ObservationCollection>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to