You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Peter Len <pe...@earthlink.net> on 2004/12/10 16:25:38 UTC
Help...... generic question
Hello,
In my schema I have an element:
<xs:element ref="title"/>
which maps to a type:
<xs:element name="title" type="TitleType">
and the type is defined as:
<xs:complexType name="TitleType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="ICISM:SecurityAttributesGroup"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
When trying to use the classes that XMLBeans generated from this schema
to populate it, I have the following code:
TitleType title = resource.addNewTitle();
title.setClassification(ClassificationType.Enum.forString("U")); //
This is used for the attribute group.
I can add a value to the "classification" attribute for this TitleType
but I cannot seem to find the way to add a value to the title
(represented by the "<xs:extension base="xs:string">". For example, I
want to create a title element to look like:
<title classification="U">My Title</title>
I just can't seem to find out how to take my TitleType object ("title")
and do something like ...... title.setValue("My Title").
I know I am missing something very easy here but I am new to XMLBeans
and am lost on this one.
Thoughts?
Thanks - Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: Help...... generic question
Posted by Peter Len <pe...@earthlink.net>.
As usually happens, I find the answer just after posting the question.
The TitleType is "...an atomic type that is a restriction of
org.apache.xmlbeans.XmlString". I found that I can set the value through:
title.setStringValue("The Title");
Thanks - Peter
Peter Len wrote:
> Hello,
>
> In my schema I have an element:
> <xs:element ref="title"/>
>
> which maps to a type:
>
> <xs:element name="title" type="TitleType">
>
> and the type is defined as:
>
> <xs:complexType name="TitleType">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attributeGroup ref="ICISM:SecurityAttributesGroup"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
>
> When trying to use the classes that XMLBeans generated from this
> schema to populate it, I have the following code:
>
> TitleType title = resource.addNewTitle();
> title.setClassification(ClassificationType.Enum.forString("U")); //
> This is used for the attribute group.
>
> I can add a value to the "classification" attribute for this TitleType
> but I cannot seem to find the way to add a value to the title
> (represented by the "<xs:extension base="xs:string">". For example, I
> want to create a title element to look like:
>
> <title classification="U">My Title</title>
>
> I just can't seem to find out how to take my TitleType object
> ("title") and do something like ...... title.setValue("My Title").
> I know I am missing something very easy here but I am new to XMLBeans
> and am lost on this one.
>
> Thoughts?
>
> Thanks - Peter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org