Doug Fischer wrote:
>Are you saying that I should be able to do something like the code below, or
>am I missing something?
>
>XmlComplexContentImpl complexContent = (XmlComplexContentImpl)result;
>boolean blnResult = Boolean.getBoolean("true");
>complexContent.changeType(XmlBoolean.type);
>complexContent.set(blnResult);
>
>
I mean smg like
ObservationType observationElt = ObservationType.Factory.newInstance();
XmlBoolean xmlBoolean = XmlBoolean.Factory.newInstance();
xmlBoolean.setBooleanValue(boolResult);
observationElt.setResult(xmlBoolean);
But I do not have time to compile and test ....
sorry
jc
>I actually did try this at one point, but when I set the boolean value, I
>received an exception of
>org.apache.xmlbeans.impl.values.XmlValueNotSupportedException.
>
>Have you ever seen this exception? Do you know, why I am getting it since
>it appears to me that the element in the XSD will accept anyType, and also
>how I might be able to fix it?
>
>Thank you again,
>Doug
>
>
>On 8/18/05 9:24 AM, "Jean-Christophe Pazzaglia"
><[EMAIL PROTECTED]> wrote:
>
>
>
>>Doug Fischer wrote:
>>
>>
>>
>>>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.
>>>
>>>...
>>>
>>>
>>>
>>>
>>nop,
>>
>>humm did you try to use the AbstractObservationType
>>factory, change the type, and set the result *content* (ie boolean)
>> instead of setting the full tree ?
>>
>>I suspect that it may be a bug/feature of set to not add extra
>>typing attributes while using set(XmlObject)
>>
>>sorry
>>jc
>>
>>
>>
>>><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"
>>><[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>well,
>>>>
>>>>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;
>>>>here is an extract of the schema I am using:
>>>>./...
>>>>
>>>><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
>>>>>like the following:
>>>>>
>>>>><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
>>>>>get an exception every time. I then attempted the following code:
>>>>>
>>>>>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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
Jean-Christophe Pazzaglia, PhD <[EMAIL PROTECTED]>
Corporate communications
Tel: (+33) 4-93-00-26-78
PGP Key available : http://www.eurecom.fr/~pazzagli/publickey.pgp
--
Institut Eurécom - Office 029
http://www.eurecom.fr/
2229 Route des Crêtes
BP 193
06904 Sophia Antipolis, France
Fax: (+33) 4-93-00-26-27
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]