Thank you for the reply. The schema that I am using is not my own, I have
included an excerpt below. Would you be able to tell me if / why this is
too strict? Before I started setting objects like XmlBoolean, XmlString,
XmlDouble, etc... Inside the element, the xsi:type attribute did show up
however now that I am setting one of these objects, it is no longer showing.
...
<complexType name="ObservationType">
<annotation>
<documentation>Observation event.
carries a generic "result" properties of type
"anyType".</documentation>
</annotation>
<complexContent>
<extension base="om:AbstractObservationType">
<sequence>
<element name="result" type="anyType" nillable="true">
<annotation>
<documentation>an xsi:type attribute may appear
in the instance to indicate the type of the result</documentation>
</annotation>
</element>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="AbstractObservationType">
<annotation>
<documentation>Base type for Observations.
Concrete Observation types must extend this type with a
"result" of the appropriate type.
The following properties are inherited from EventType:
<!-- from AbstractGMLType
<group ref="gml:StandardObjectProperties"/> -->
<!-- or
<element ref="gml:metaDataProperty" minOccurs="0"
maxOccurs="unbounded"/>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0"
maxOccurs="unbounded"/> -->
<!-- from AbstractFeatureType
<element ref="gml:boundedBy" minOccurs="0"/> -->
<!-- from EventType
<element name="eventTime" type="om:TimeObjectPropertyType"
nillable="true"/>
<element name="eventLocation"
type="om:LocationPropertyType" nillable="true"/>
<element name="precedingEvent" type="gml:StringOrRefType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="followingEvent" type="gml:StringOrRefType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="responsible" type="meta:PartyPropertyType"
minOccurs="0" maxOccurs="unbounded"/> -->
</documentation>
</annotation>
<complexContent>
<extension base="om:EventType">
<sequence>
<element name="procedure"
type="om:AbstractSensorSystemPropertyType"/>
<element name="observedProperty"
type="swe:PhenomenonDefinitionPropertyType">
<annotation>
<documentation>Link to a description of the
property or phenomenon whose value is being described or estimated through
observation
for example "wavelength", "grass-species",
"power", "intensity in the waveband x-y", etc.
It is this feature-property that provides the
(semantic) type of the observation.
Note that the description of the phenomenon may
be quite specific and constrained.
In general the precise details of the
constraints describing the observe properties require attention to the
procedure used in making the observation:
e.g. an optical sensor typically has a
wavelength-dependent response.
This property may be provided for client
convenience, to allow comparison between and aggregation of observations of
the same property made using different procedures.</documentation>
</annotation>
</element>
<element name="quality" type="meta:QualityPropertyType"
minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>Allow multiple quality measures
if required.</documentation>
</annotation>
</element>
<element name="target" type="gml:FeaturePropertyType">
<annotation>
<documentation>the Feature or location
regarding which the observations are being made,
sometimes called the subject of the observation, such as a
specimen, station, tract, mountain, pixel, etc.</documentation>
</annotation>
</element>
<!--
<element name="result" type="anyType">
<annotation>
<documentation>This is a placeholder - concrete
types must replace (restrict) this with a "result" property of the correct
type. </documentation>
</annotation>
</element>
-->
</sequence>
</extension>
</complexContent>
</complexType>
Thank you for any other help you can offer.
Doug
On 8/18/05 5:15 AM, "Jean-Christophe Pazzaglia"
Post by Jean-Christophe Pazzagliawell,
as far as I understood,
the xsi:type usually appears when the type is not stricly defined
(for example to enable subtyping of elements), I suspect that your
schema is too strict. In my case, xsi:type appears correctly;
./...
<complexType name="ContentType" mixed="false">
<sequence>
<element name="Attribute" type="xac:AbstractAttributeType" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="AbstractAttributeType" abstract="true" mixed="false">
<annotation>
<documentation>A very simple attribute, inheritance root for all
attributes</documentation>
</annotation>
<sequence>
./....
</sequence>
</complexType>
<complexType name="AttributeType">
<annotation>
<documentation>Its first descendant</documentation>
</annotation>
<complexContent>
<extension base="xac:AbstractAttributeType"/>
</complexContent>
</complexType>
./....
Hope this may help you
jc
I am really hoping that this a pretty simple question. I am new to
XmlBeans, this is the first project that I have used it on so far.
Anyway, what I would like to see in the resulting xml is something
<om:result xsi:type=²xsi:boolean²>false</om:result>
The om:result element is an instance of XmlComplexContentImpl, I have
tried to use the XmlComplexContentImpl.set(boolean booleanValue) but I
boolean boolResult = Boolean.getBoolean(measure.getResult());
XmlBoolean xmlBoolean = XmlBoolean.Factory.newInstance();
xmlBoolean.setBooleanValue(boolResult);
complexContent.set(xmlBoolean);
complexContent.changeType(XmlBoolean.type);
This code will set the value to a boolean value, however the xsi:type
attribute will not appear therefore I get the following xml
<om:result>false</om:result>
Could anyone please tell me if it is possible to force the xsi:type
attribute to appear?
Thank you very much,
Doug