Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Oxygen general issues.
-
- Posts: 32
- Joined: Mon Apr 10, 2017 8:56 pm
Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Hello,
I am working with a custom document and having issues using oxy_add.
I have created a basic document type, basicDocument.bd and the html framework to use the schema at: ${framework}/basicDocument.xsd.
The header of basicDocument.bd is
Within the schema, I have included (not imported) sub-schemas to keep things neat and organized. One of the schemas is for a section, estimatedCosts. estimatedCosts.xsd has variables that contain integer and decimal values. All values default to 0.
estimatedCosts.xsd (included in basicDocument.xsd):
(I realize that it may have been better to make the item costs and quantities elements instead of attributes - but that will be for a later update).
A basicDocument looks something like:
(itemCost1, itemCost2, itemQuantity1 and itemQuantity2 can be updated- but were set to 0 by default because oxy_add did not work properly when there was no default value).
When I use hard-coded numbers, oxy_add(10,5, 'number'), the function works perfectly.
When I use variables, oxy_add(attr(itemCost1), attr(itemCost2), 'number'), the function does not work - and only blank spaces are output. (I also only ever attempt to add attributes of the same type).
If I add an xsi:noNamespaceSchemaLocation to basicDocument.bd:
I can use variables without an issue.
I have verified that all of my schema and sub-schema files have identical header information - so I am confused as to why everything works except this one section - unless I add the noNamespaceSchemaLocation... especially because the noNamespaceSchemaLocation points to the same schema as the framework.
Is there a way to omit the noNamespaceSchemaLocation declaration from basicDocument.bd and have everything handled through the framework?
Any assistance would be appreciated!
Thanks!
I am working with a custom document and having issues using oxy_add.
I have created a basic document type, basicDocument.bd and the html framework to use the schema at: ${framework}/basicDocument.xsd.
The header of basicDocument.bd is
Code: Select all
<basicDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
estimatedCosts.xsd (included in basicDocument.xsd):
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xerces="http://xerces.apache.org"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified"
attributeFormDefault="unqualified" vc:minVersion="1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xs:include schemaLocation="sharedAttributes.xsd"/>
<xs:element name="estimatedCost">
<xs:complexType>
<xs:attribute name="itemCost1" type="xs:decimal" default="0"/>
<xs:attribute name="itemCost2" type="xs:decimal" default="0"/>
<xs:attribute name="itemQuantity1" type="xs:integer" default="0"/>
<xs:attribute name="itemQuantity1" type="xs:integer" default="0"/>
</xs:complexType>
</xs:element>
</xs:schema>
A basicDocument looks something like:
Code: Select all
<basicDocument>
<...>
<estimatedCosts itemCost1="0" itemCost2="0" itemQuantity1="0" itemQuantity2="0" />
</...>
</basicDocument>
When I use hard-coded numbers, oxy_add(10,5, 'number'), the function works perfectly.
When I use variables, oxy_add(attr(itemCost1), attr(itemCost2), 'number'), the function does not work - and only blank spaces are output. (I also only ever attempt to add attributes of the same type).
If I add an xsi:noNamespaceSchemaLocation to basicDocument.bd:
Code: Select all
<basicDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../basicDocument.xsd">
I have verified that all of my schema and sub-schema files have identical header information - so I am confused as to why everything works except this one section - unless I add the noNamespaceSchemaLocation... especially because the noNamespaceSchemaLocation points to the same schema as the framework.
Is there a way to omit the noNamespaceSchemaLocation declaration from basicDocument.bd and have everything handled through the framework?
Any assistance would be appreciated!
Thanks!
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Post by cristi_talau »
Hello,
I tried to reproduce your problem with the following sample:
https://gist.github.com/ctalau/022b86a0 ... dda4e24270
The result can be viewed here:
https://www.oxygenxml.com/webapp-demo-a ... xy_add.xml
The attribute values are properly added in my sample.
It would help if you could provide a more specific sample on which the problem manifests.
Best,
Cristian
I tried to reproduce your problem with the following sample:
https://gist.github.com/ctalau/022b86a0 ... dda4e24270
The result can be viewed here:
https://www.oxygenxml.com/webapp-demo-a ... xy_add.xml
The attribute values are properly added in my sample.
It would help if you could provide a more specific sample on which the problem manifests.
Best,
Cristian
-
- Posts: 32
- Joined: Mon Apr 10, 2017 8:56 pm
Re: Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Hi Christian,
Thank you for your response.
I have done more troubleshooting and I believe I have isolated the issue. I forgot to include my css in my last post - so I am including it now.
Per my previous post, the attribute values for itemCost1, itemCost2, itemQuantity1 and itemQuantity2 are set to 0 in the schema.
I have determined that as long as there are values for the attributes (even 0), the section displays properly - the labels are displayed and the math functions work.However, this does not take into account the case where a user deletes all the values. If the values are deleted, the display on the screen shows the values going back to zero. However, on save and refresh, the element has been updated to have no values for the attributes at all.Maybe a better question would be - is there a way to force those values to default back to zero if the user deletes them?
I have tried setting the attributes to required - however, because they have a default value, I cannot also set the attributes to be required.
Any assistance would be greatly appreciated!
Thank you!
John
Thank you for your response.
I have done more troubleshooting and I believe I have isolated the issue. I forgot to include my css in my last post - so I am including it now.
Code: Select all
estimatedCost{
content:
oxy_label(text, "Cost of Item 1: ", width, 20%)
oxy_textfield(edit, "@itemCost1", width, 15%)
oxy_label(text, " ", width, 5%)
oxy_label(text, "Cost of Item 2: ", width, 20%)
oxy_textfield(edit, "@itemCost2", width, 15%)"\A\A"
oxy_label(text, "Quantity of Item 1: ", width, 20%)
oxy_textfield(edit, "@itemQuantity1", width, 15%)
oxy_label(text, " ", width, 5%)
oxy_label(text, "Qauntity of Item 2: ", width, 20%)
oxy_textfield(edit, "@itemQuantity2", width, 15%)"\A\A"
oxy_label(text, "Cost of Item 1 + Cost of Item 2: ")
oxy_add(attr(itemCost1), attr(itemCost2), 'number')"\A\A"
...
I have determined that as long as there are values for the attributes (even 0), the section displays properly - the labels are displayed and the math functions work.
Code: Select all
<estimatedCosts itemCost1="0" itemCost2="0" itemQuantity1="0" itemQuantity2="0" />
Code: Select all
<estimatedCosts />
I have tried setting the attributes to required - however, because they have a default value, I cannot also set the attributes to be required.
Any assistance would be greatly appreciated!
Thank you!
John
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Hi John,
The only problem that I see in your samples is that there is a difference between the name of the element used in the xml and the one declared in your schema (and css): estimatedCosts vs estimatedCost.
If I change your sample schema to use estimatedCosts element name everithing works as you expect: the default values are displayed even if the attributes are removed from the element.
Please let us know if this solves your problem or if you need further assistance.
Best Regards,
Mihaela
The only problem that I see in your samples is that there is a difference between the name of the element used in the xml and the one declared in your schema (and css): estimatedCosts vs estimatedCost.
If I change your sample schema to use estimatedCosts element name everithing works as you expect: the default values are displayed even if the attributes are removed from the element.
Please let us know if this solves your problem or if you need further assistance.
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 32
- Joined: Mon Apr 10, 2017 8:56 pm
Re: Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Hello Mihaela,
Thank you for your response. I was trying to simplify the code (we are building a complex document) and there was a typo in the code I posted to the forum. The names match exactly in the code I've written for the project.
I'm afraid I'm not describing the situation very well, so I have created a YouTube video to demonstrate the issue: https://www.youtube.com/watch?v=6w1tz0L ... e=youtu.be
I start in xml view and you will notice that when the video starts (default) the element has attributes with the default value of 0 or 0.0.I switch to author view and move from field to field, deleting the attribute values. You will notice that on the display, they fields get the default values of 0 or 0.0. However, upon viewing the XML again you will notice that the element has no attributes. Switching back to the author view, everything looks OK. However, upon refreshing the document, the section will no longer display (it is just a big white area).
Please let me know if this helps describe the issue better - and if there is a way to ensure that those attribute values always have the default value of 0 or a number.
Thanks!
John
Thank you for your response. I was trying to simplify the code (we are building a complex document) and there was a typo in the code I posted to the forum. The names match exactly in the code I've written for the project.
I'm afraid I'm not describing the situation very well, so I have created a YouTube video to demonstrate the issue: https://www.youtube.com/watch?v=6w1tz0L ... e=youtu.be
I start in xml view and you will notice that when the video starts (default) the element has attributes with the default value of 0 or 0.0.
Code: Select all
<estimatedModCost attributeVal01="0" attributeVal02="0" attributeVal03="0" ... />
Code: Select all
<estimatedModCost />
Please let me know if this helps describe the issue better - and if there is a way to ensure that those attribute values always have the default value of 0 or a number.
Thanks!
John
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: Issues Using oxy_add With Attribute Values Without Declaring A noNamespaceSchemaLocation
Hi John,
Thank you for the video and the detailed explanation.
In the last part of the video, after refreshing the document, the "Service Bulletin" toolbar does not appear anymore. This means that the framework is not loaded, so your schema is not associated anymore with the document (this is why your empty elements are not rendered in editor).
Do you use the default refresh action (F5)? Can you please send us your framework and a small sample on our support email address (support@oxygenxml.com) to help us reproduce this sittuation?
Best Regards,
Mihaela
Thank you for the video and the detailed explanation.
In the last part of the video, after refreshing the document, the "Service Bulletin" toolbar does not appear anymore. This means that the framework is not loaded, so your schema is not associated anymore with the document (this is why your empty elements are not rendered in editor).
Do you use the default refresh action (F5)? Can you please send us your framework and a small sample on our support email address (support@oxygenxml.com) to help us reproduce this sittuation?
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
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