Varying schemas and autocomplete problems
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 2
- Joined: Wed Dec 06, 2006 8:53 pm
Varying schemas and autocomplete problems
I'm very new to oxygen, to it's quite possible that I'm simply misusing a feature, here.
When I use a Relax NG schema, oxygen doesn't properly add required attributes and elements with the autocomplete function. If I take that schema and make it into a W3C XML Schema (using Trang), then it properly autocompletes, but no longer validates content defined as xsd:integer and the like.
It's an unfortunate tradeoff to make, as I'd very much like to have both features so my engineers don't have to worry about their data being proper and complete.
Any advice or thoughts on the matter?
(A secondary question... is there an attribute-level equivalent of the "Go after Next Tag" shortcut?)
When I use a Relax NG schema, oxygen doesn't properly add required attributes and elements with the autocomplete function. If I take that schema and make it into a W3C XML Schema (using Trang), then it properly autocompletes, but no longer validates content defined as xsd:integer and the like.
It's an unfortunate tradeoff to make, as I'd very much like to have both features so my engineers don't have to worry about their data being proper and complete.
Any advice or thoughts on the matter?
(A secondary question... is there an attribute-level equivalent of the "Go after Next Tag" shortcut?)
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Varying schemas and autocomplete problems
Post by sorin_ristache »
Hello,
Regards,
Sorin
I think you want to insert automatically child elements and child attributes that are not defined as optional (the oneOrMore pattern, attributes that are not enclosed by the optional pattern, etc) when their parent element is inserted in the edited document by the content completion assistant. Yes, that is a difference between content completion based on an XML Schema vs. a Relax NG schema. It is an enhancement for content completion based on Relax NG schemas that we will consider for a future version of oXygen.napthali wrote:When I use a Relax NG schema, oxygen doesn't properly add required attributes and elements with the autocomplete function.
There is no such shortcut action. Using the Ctrl + left arrow / right arrow shortcut two or three times should move the cursor to the next attribute. A "Go after Next Attribute" action would do just that: move the cursor as you would move it two times or three times with the Ctrl + Arrow action.napthali wrote:is there an attribute-level equivalent of the "Go after Next Tag" shortcut?)
Regards,
Sorin
-
- Posts: 2
- Joined: Wed Dec 06, 2006 8:53 pm
Re: Varying schemas and autocomplete problems
Ah, good clarification. I guess I assumed that oXygen translated all schema types to some kind of universal internal representation. Good to know it's not a bug, but a "yet-to-be-implemented."sorin wrote:
I think you want to insert automatically child elements and child attributes that are not defined as optional (the oneOrMore pattern, attributes that are not enclosed by the optional pattern, etc) when their parent element is inserted in the edited document by the content completion assistant. Yes, that is a difference between content completion based on an XML Schema vs. a Relax NG schema. It is an enhancement for content completion based on Relax NG schemas that we will consider for a future version of oXygen.

Do W3C Schemas not allow type validation (i.e. xsd:integer)?
Thanks for your help!
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Varying schemas and autocomplete problems
Post by sorin_ristache »
Yes, W3C Schema allows type validation. If your XML document is validated against an XML Schema that specifies the xsd:integer type for the value of an element or attribute then that value is checked to be an integer.napthali wrote:Do W3C Schemas not allow type validation (i.e. xsd:integer)?
Regards,
Sorin
-
- Posts: 17
- Joined: Wed Oct 28, 2009 8:35 pm
Re: Varying schemas and autocomplete problems
We are also working with Relax NG schemas. That would be a great enhancement: when inserting a new element, we would like non-optional child elements and non-optional attributes to be inserted automatically. The content completion assistant is not very useful for the academics working on our project.napthali wrote: I think you want to insert automatically child elements and child attributes that are not defined as optional (the oneOrMore pattern, attributes that are not enclosed by the optional pattern, etc) when their parent element is inserted in the edited document by the content completion assistant. Yes, that is a difference between content completion based on an XML Schema vs. a Relax NG schema. It is an enhancement for content completion based on Relax NG schemas that we will consider for a future version of oXygen.
Has this enhancement been implemented? Thanks!
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Varying schemas and autocomplete problems
Post by sorin_ristache »
Hello,
That is supported in version 11.0 which you can download from the Download page. If a RELAX NG schema declares an element that is enclosed in oneOrMore or an attribute is not optional then the element or the attribute are generated by the New dialog in the initial XML document based on that RELAX NG schema.
Regards,
Sorin
That is supported in version 11.0 which you can download from the Download page. If a RELAX NG schema declares an element that is enclosed in oneOrMore or an attribute is not optional then the element or the attribute are generated by the New dialog in the initial XML document based on that RELAX NG schema.
Regards,
Sorin
-
- Posts: 17
- Joined: Wed Oct 28, 2009 8:35 pm
Re: Varying schemas and autocomplete problems
Hi Sorin,
Thanks for your time.
Here are two things that would be really nice to have, and which would be great additions to Oxygen's usability by content authors:
[*]Autocomplete to include required values: In the New dialog (initial XML document) it would be great if Oxygen also added automatically required values / fixed values to such non-optional attributes. When I create a new XML document using a RelaxNG schema, all required elements and attributes are added, but not required values. I have enabled first "add choice particle" in the content completion panel, but this doesn't seem to help.
[*]Autocomplete for new elements during edit: automatic content completion for editing a document; for example, when adding a new element <poem> which requires oneOrMore <verse>, Oxygen to automatically add a <verse> element.
Thanks for your time.
Here are two things that would be really nice to have, and which would be great additions to Oxygen's usability by content authors:
[*]Autocomplete to include required values: In the New dialog (initial XML document) it would be great if Oxygen also added automatically required values / fixed values to such non-optional attributes. When I create a new XML document using a RelaxNG schema, all required elements and attributes are added, but not required values. I have enabled first "add choice particle" in the content completion panel, but this doesn't seem to help.
[*]Autocomplete for new elements during edit: automatic content completion for editing a document; for example, when adding a new element <poem> which requires oneOrMore <verse>, Oxygen to automatically add a <verse> element.
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Varying schemas and autocomplete problems
1. Relax NG does not have a notion of default or fixed attribute value in the sense of DTD or XML Schema because it does not change the XML, it just provides validation. You can surely check the values of an attribute against a list if values.
Maybe what you want here is more like the XML instance generator that we have for XML Schema? See "Tools->Generate Sample XML Files".
2. If insert required content is enabled in options and poem contains one or more verse elements then oXygen will automatically insert one verse element when you insert poem. Just tried that with the schema below
Best Regards,
George
Maybe what you want here is more like the XML instance generator that we have for XML Schema? See "Tools->Generate Sample XML Files".
2. If insert required content is enabled in options and poem contains one or more verse elements then oXygen will automatically insert one verse element when you insert poem. Just tried that with the schema below
Code: Select all
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<start>
<element name="root">
<element name="poem">
<oneOrMore>
<element name="verse">
<text/>
</element>
</oneOrMore>
</element>
</element>
</start>
</grammar>
George
George Cristian Bina
-
- Posts: 17
- Joined: Wed Oct 28, 2009 8:35 pm
Re: Varying schemas and autocomplete problems
Thanks, I understand now. Then, should I expect the "add first choice particle" option to work? I thought that, given a list of possible values, Oxygen would pick the first choice in the list and insert it automatically.george wrote:1. Relax NG does not have a notion of default or fixed attribute value in the sense of DTD or XML Schema because it does not change the XML, it just provides validation. You can surely check the values of an attribute against a list if values.
Maybe what you want here is more like the XML instance generator that we have for XML Schema? See "Tools->Generate Sample XML Files".
About your question on whether what we need is something similar to the XML instance generator: if I understand correctly, what this does is creating a sample XML file based on an XML schema (W3C in this case), but what we need is support during the edit process.
For example: suppose there is an element <QUOTE> (which requires the non-optional attribute DIRECT and a value of either "Y" or "N"); during content creation (not during new XML file creation). From author mode, by inserting the element <QUOTE> I would automatically get:
Code: Select all
<QUOTE DIRECT="Y"></QUOTE>
Does such content insertion happens when creating a new XML document (not during content edit, which is what wee would need)? Please correct if I am wrong.george wrote:2. If insert required content is enabled in options and poem contains one or more verse elements then oXygen will automatically insert one verse element when you insert poem.
Thank you!
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Varying schemas and autocomplete problems
Looking more into this I found the a:defaultValue annotation in Relax NG that can be used to provide a default value to be inserted automatically in the document as you suggested, you can find details here
http://www.oasis-open.org/committees/re ... ault-value
The required element as in the example from my previous post is added by oXygen both when editing and when creating a new element based on that schema.
Best Regards,
George
http://www.oasis-open.org/committees/re ... ault-value
The required element as in the example from my previous post is added by oXygen both when editing and when creating a new element based on that schema.
Best Regards,
George
George Cristian Bina
-
- Posts: 1
- Joined: Tue Dec 11, 2012 1:26 pm
Re: Varying schemas and autocomplete problems
Hi George,
Sorry to answer to an old thread, but I'm not sure to understand why you answered "no" for forced values in attribute with Relax-NG. I can imagine that we have not exactly the same concepts that in DTDs, but some desired behaviors could be compared.
Imagine this real life Relax-NG pattern
<element name="availability">
<attribute name="status">
<value>restricted</value>
</attribute>
<ref name="p"/>
</element>
The generated content by Oxygen (14.1 2012101909) is
<availability status="">
<p></p>
</availability>
The generated content is not valid because the @status attribute value is forced to "restricted". Value is correctly suggested (after delete and rewrite a quote, I understand how tricky could be such events handling).
This is not the best XML practice we may like, but very common in specific profiles from generic schemas like TEI, docbook or EAD.
Sorry to answer to an old thread, but I'm not sure to understand why you answered "no" for forced values in attribute with Relax-NG. I can imagine that we have not exactly the same concepts that in DTDs, but some desired behaviors could be compared.
Imagine this real life Relax-NG pattern
<element name="availability">
<attribute name="status">
<value>restricted</value>
</attribute>
<ref name="p"/>
</element>
The generated content by Oxygen (14.1 2012101909) is
<availability status="">
<p></p>
</availability>
The generated content is not valid because the @status attribute value is forced to "restricted". Value is correctly suggested (after delete and rewrite a quote, I understand how tricky could be such events handling).
This is not the best XML practice we may like, but very common in specific profiles from generic schemas like TEI, docbook or EAD.
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Varying schemas and autocomplete problems
Hi,
In general there are more value patterns there... but indeed it will be interesting if we can detect the case with only one value pattern and use that like a fixed value for that attribute.
Please note that you do not need to delete the quote and type it again to trigger the content completion - you can trigger the content completion on request with CTRL+Space. There is also an additional action with configurable shortcut called "Start Content Completion) with the default shortcut "Alt+CTRL+/" or, for Mac, "Alt+CMD+/".
Hope this helps,
George
In general there are more value patterns there... but indeed it will be interesting if we can detect the case with only one value pattern and use that like a fixed value for that attribute.
Please note that you do not need to delete the quote and type it again to trigger the content completion - you can trigger the content completion on request with CTRL+Space. There is also an additional action with configurable shortcut called "Start Content Completion) with the default shortcut "Alt+CTRL+/" or, for Mac, "Alt+CMD+/".
Hope this helps,
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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