Element Default Values
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 4
- Joined: Mon Jun 27, 2005 5:22 pm
- Location: USA
- Contact:
Element Default Values
Post by integragreg »
Hi,
I want to be able to automatically assign a default value for an element whenever I create a new xml document that is based on a particular schema definition. Can anyone tell me how to specify this in my xsd?
Thanks!
Greg
I want to be able to automatically assign a default value for an element whenever I create a new xml document that is based on a particular schema definition. Can anyone tell me how to specify this in my xsd?
Thanks!
Greg
-
- Posts: 4
- Joined: Mon Jun 27, 2005 5:22 pm
- Location: USA
- Contact:
Clarification
Post by integragreg »
I should probably clarify my last post.
What I want to do is have the default values automatically appear in the xml document when Oxygen generates it from the schema. I don't intend to use the default or fixed attributes in the element declaration, because I want to be able to change the value if necessary. I merely want there to be suggested default values that appear when the document is generated.
What I want to do is have the default values automatically appear in the xml document when Oxygen generates it from the schema. I don't intend to use the default or fixed attributes in the element declaration, because I want to be able to change the value if necessary. I merely want there to be suggested default values that appear when the document is generated.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Clarification
Post by sorin_ristache »
Hello,
Regards,
Sorin
What is the default value that you expect if you don't use the default or fixed attribute in the declaration ?integragreg wrote:I don't intend to use the default or fixed attributes in the element declaration
Regards,
Sorin
-
- Posts: 4
- Joined: Mon Jun 27, 2005 5:22 pm
- Location: USA
- Contact:
Post by integragreg »
Thanks for the reply, Sorin.
The XML file that is derived from the schema is a configuration file for a software application. What I want to be able to do is generate the file from the schema and automatically insert specific element values when it's generated.
For example, let's say that my schema defines the following set of elements:
<xs:element name="serialportsettings" form="qualified">
<xs:complexType>
<xs:sequence>
<xs:element name="comport" form="qualified" type="xs:int"/>
<xs:element name="baudrate" form="qualified" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
When Oxygen generates the XML file from this schema, I'd like for the output to automatically contain the default values of 1 and 9600 for the comport and baudrate elements, like so:
<serialportsettings>
<comport>1</comport>
<baudrate>9600</baudrate>
</serialportsettings>
This way, the person who generates the xml file will be given default values that they can change if they choose to do so.
I'm beginning to think that this might be better accomplished using xslt, rather than trying to force this through the schema. Maybe the schema definition language was not intended to be used for what I am trying to accomplish.
The XML file that is derived from the schema is a configuration file for a software application. What I want to be able to do is generate the file from the schema and automatically insert specific element values when it's generated.
For example, let's say that my schema defines the following set of elements:
<xs:element name="serialportsettings" form="qualified">
<xs:complexType>
<xs:sequence>
<xs:element name="comport" form="qualified" type="xs:int"/>
<xs:element name="baudrate" form="qualified" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
When Oxygen generates the XML file from this schema, I'd like for the output to automatically contain the default values of 1 and 9600 for the comport and baudrate elements, like so:
<serialportsettings>
<comport>1</comport>
<baudrate>9600</baudrate>
</serialportsettings>
This way, the person who generates the xml file will be given default values that they can change if they choose to do so.
I'm beginning to think that this might be better accomplished using xslt, rather than trying to force this through the schema. Maybe the schema definition language was not intended to be used for what I am trying to accomplish.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
Generation of a sample document containing default values in the elements from a specified schema will be added in a future version of <oXygen/>. The current version can only generate empty elements when a new document is created based on a schema. When the feature will be added to <oXygen/> the value specified in the default attribute of xsd:element could be inserted as default element content.
Regards,
Sorin
Generation of a sample document containing default values in the elements from a specified schema will be added in a future version of <oXygen/>. The current version can only generate empty elements when a new document is created based on a schema. When the feature will be added to <oXygen/> the value specified in the default attribute of xsd:element could be inserted as default element content.
Regards,
Sorin
-
- Posts: 4
- Joined: Mon Jun 27, 2005 5:22 pm
- Location: USA
- Contact:
Post by integragreg »
Thanks. is there a projected schedule for when this feature will be released?
Cheers,
Greg
Greg
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
It is scheduled to be included in the next release of <oXygen/> so probably the next version will include it.
Regards,
Sorin
It is scheduled to be included in the next release of <oXygen/> so probably the next version will include it.
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service