Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Does the "oid_attr(oid, attrname)" ACL function return the DTD's "default" value for an attribute if that attribute is not present on the specified "oid" tag? The "help center" entry I have (5.4 M070) for this function does not specify this behavior. An issue I'm tracking down hints that it does, but I could swear I sawpreviously that it does not do this.
In any case, I'm curious to know if this behavior is what most users of this API would want, or expect.
In Reply to Marty Ross:
Does the "oid_attr(oid, attrname)" ACL function return the DTD's "default" value for an attribute if that attribute is not present on the specified "oid" tag? The "help center" entry I have (5.4 M070) for this function does not specify this behavior. An issue I'm tracking down hints that it does, but I could swear I sawpreviously that it does not do this.
In any case, I'm curious to know if this behavior is what most users of this API would want, or expect.
Marty,
I would have to agree with Paul.
Case in point. I have an SGML DTD that has a tag with an attribute of "tmidnolen" set to "10em" as the default value. The actual entry for the attribute is: .
I opened a document, place the cursor inside <idinfo>. There are no attributes set within the document. In the command line, I enter the following command:
$m = oid_attr( oid_current_tag(), 'tmidnolen' ) ; exec mess "$m"
The return is "10em",even though it is not shown in the document.
The easiest way to tell if you have defaults set without analyzing the DTD is to open the document, position your cursor inside the tag and select Modify Attributes from the menus or Toolbar (or <ctrl+d>. Any "default value" will show up as a value in the field with the name of the attribute in BLACK. Any value you've entered into the document will have it's value shown as well, however the name of the attribute will be in BLUE.
Also mentioned by Paul, if you need to differentiate whether or not the attribute has a value set or not, use the oid_has_attr() test command. It will tell you if the OID tested has the attribute set within the document, regardless of how the attribute is defined within the DTD.
On a side note, the setting "set writeunspecifiedattrs=all" will cause the Editor to write EVERY attribute defined within the DTD out to your document (NOT the DTD). It has nothing to do with what you are trying to achieve here. Arbortext Editor is VERY aware of the DTD and it's default settings. Arbortext recommends that you do not use this setting as it will increase the size of your documents considerably. The setting is really used to save your document for use in an environment that is not completely DTD-aware.
Hope this helps,
Bob