#### Error when creating an element specialization

Jonathan Hanna

Hi all,

I'm trying to learn specialization by following Eliot Kimber's online tutorial. I've been successful with most of the tutorials, but I'm running into issues with the element domain specialization tutorial. Specifically, I run into problems when I test the specialized element in a topic after adding the reference to the new domain in my DTD file. Oxygen recognizes the specialized element in my test topic since it shows up in the auto-complete list when I begin to enter an element. However, I get the following error after entering the element:
"Invalid format for "class" attribute. Class attribute not specified."

I'm confused by this error message since the class attribute for the specialized element shows up in the attributes window in Oxygen (in this case, "+ topic/keyword xml-d/xmlelem "). I have checked and double-checked my work and I am following everything in the tutorial as written. I know that the tutorial is a bit dated since it was written for DITA 1.2, so maybe there's something missing that changed with DITA 1.3?

Any ideas on why I am getting this error message and what I should be looking for to resolve it?

Thanks,
Jonathan

Hi Jonathan,

Strange, the Oxygen content completion and validation should use the same DTD.

If you can share the plugin contents and a sample file with us (support@...) maybe I can take a look at it.

Regards,

Radu Coravu
Oxygen XML Editor
On 5/18/20 7:05 AM, Jonathan Hanna wrote:

Hi all,

I'm trying to learn specialization by following Eliot Kimber's online tutorial. I've been successful with most of the tutorials, but I'm running into issues with the element domain specialization tutorial. Specifically, I run into problems when I test the specialized element in a topic after adding the reference to the new domain in my DTD file. Oxygen recognizes the specialized element in my test topic since it shows up in the auto-complete list when I begin to enter an element. However, I get the following error after entering the element:
"Invalid format for "class" attribute. Class attribute not specified."

I'm confused by this error message since the class attribute for the specialized element shows up in the attributes window in Oxygen (in this case, "+ topic/keyword xml-d/xmlelem "). I have checked and double-checked my work and I am following everything in the tutorial as written. I know that the tutorial is a bit dated since it was written for DITA 1.2, so maybe there's something missing that changed with DITA 1.3?

Any ideas on why I am getting this error message and what I should be looking for to resolve it?

Thanks,
Jonathan

Hi Jonathan,

I found specializations time-consuming and error-prone to do by hand, so I made a utility to automate it:

https://github.com/chrispy-snps/DITA-plugin-utilities

You can specialize attributes:

<attributedomain filename="paginateAttMod.rng" domain="paginate">
<specialize attribute="paginate" from="base" model="(keep-with-next|keep-with-previous|top-of-page|keep-together)*"/>
</attributedomain>

and elements:

<elementdomain filename="snpsDomain.rng" domain="snps-d">
<specialize elements="syntax-spec ex" from="fig">
<disallow elements="image"/>
</specialize>
<specialize elements="user-input" from="b"/>
<specialize elements="command variable message" from="codeph"/>
<specialize elements="infotip mini-toc" from="div"/>
</elementdomain>

and create constraint modules:

<constraint filename="snpsConstraint.rng" domain="snps-c">
<include_domains>topic hi-d snps-d snpsm-t indexing-d sw-d pr-d ui-d ut-d mathml-d deliveryTarget style xformat paginate snpsatt</include_domains>
<allow domain="hi-d" elements="sup sub"/>
<allow domain="sw-d" elements="filepath cmdname"/>
<allow domain="pr-d" elements="codeph"/>
<disallow elements="audience author bodydiv boolean brand category cmdname component copyrholder copyright copyryear created critdates data data-about div dl example featnum filepath gui-section index-base index-see index-see-also index-
sort-as indextermref itemgroup lines linkinfo linklist linkpool longdescref longquoteref lq mathmlref navtitle object param permissions platform prodinfo prodname prognum publisher q resourceid revised searchtitle section sectiondiv series
shortdesc simpletable sl sli source state stentry sthead strow titlealts tm vrm vrmlist"/>
<constrain elements="topic"><nesting model="(topic.element|module.element)*"/></constrain>
<!-- modify some content models -->
<constrain elements="term"><content model="(text | required-cleanup | \text | ph.element | sup | sub | user-defined | codeph.element)+"/></constrain>
<constrain elements="syntax-spec"><content model="(figgroup | titled-definition-list | definition-list | endnote | pre | fn | foreign | unknown | option-list | title)*"/></constrain>
</constraint>

and create document-type shells to use your modules:

<topicshell filename="snpsGlossaryShell.rng">
<title>Synopsys Glossary</title>
<root_element>glossgroup</root_element>
<include_domains>snps-c glossgroup glossentry</include_domains>
</topicshell>
<topicshell filename="snpsTopicShell.rng">
<title>Synopsys Topic</title>
<root_element>topic</root_element>
<include_domains>snps-c</include_domains>
</topicshell>

You just run make_dita_grammar.pl on the XML file containing these definitions, and it gives you a plugin directory ready to place in your DITA-OT. If you want to add/remove an element or tweak a content model, you edit the definition file and rerun. It takes a few seconds at most. Refreshing Oxygen to reload the new content models takes longer than to make them.

- Chris

Jonathan Hanna

Thank you for offering your support. When I was preparing the files to send to you, I found that the error disappeared! I copied all of the relevant files to a new directory. When I open my test topic file in the new directory, I no longer get the error (the error is still present in the original directory). Searching online, it appears that I am not the first person to experience this according to the following post:
https://www.oxygenxml.com/forum/topic20904.html

So it appears that this is an Oxygen issue as opposed to a DITA issue. I'll zip the original directory and send it to you to see if you can replicate the issue.

Thanks,
Jonathan

Jonathan Hanna

Hi Chris,

Thank you for sharing your utility. Looks like a very useful tool! For right now, I'm just trying to learn how specialization works, but I may make use of your tool in the future if my group wants to embrace specialization.

Thanks,
Jonathan

Jonathan Hanna

Well, never mind again. It appears that the issue has resolved itself on the original directory as well. Maybe switching between projects or opening and closing Oxygen performed some kind of refresh? Anyway, sorry for taking up bandwidth with this non-issue. At least I got to learn about a new specialization tool!

Jonathan

Hi Jonathan,

I'm glad this works for you now.

Oxygen has various schema caches in place. For example every time you type, Oxygen needs to validate the document but re-parsing the entire set of DTDs is slow so Oxygen keeps a resolved version of the DTDs in memory. But this also means that it may be possible for Oxygen at times to use the cache from an older set of DTDs. In such cases you can use the main menu File->Reload action for the XML document you are working on. You can also use the toolbar "Validate" button which should reset the validation cache.

Regards,
Radu Coravu
Oxygen XML Editor