At 09:05 2001 01 18 -0500, lhales@csc.com wrote:
>I'm getting some strange behavior using the oid_modify_attr() function.
>In the script, the
>oid_name() gives me _subchars ($tagname gives me the desired element).
>Well _subchars does not contain the attribute, so nothing is changed.
There may be better solutions (PaulK might know), and without more
details, I can't give you a definitive answer, but I can at least
give some hints. _subchars is an oid inserted into the in-memory document
data structure (of course, not really into the persistent form of the
document itself) by Epic to help represent the generated text. It is
not an element or actual PI, but it is an oid to Epic, and your
oid_modify_attr() function is "tripping" over it.
One thing you could do is "set gentext=off" in your script first.
That should make the _subchars oid disappear, and then your
oid_modify_attr() should work.
You should realize, though, that there could be other oids "in
the way" (e.g., PIs, maybe entity boundary oids), so to make your
code more robust, you could add a loop to make sure that you always
have an element oid before you attempt oid_modify_attr() on it.
For example, if you've set "o" to what you think is the oid
of the start tag that contains the attribute in question, you
might insert something like the following to ensure that "o"
is really the oid of the element's start tag:
while (oid_valid(o) && oid_type(o) != 0) { o = oid_parent(o) }
(I don't promise this is necessarily the best way, just something
to try.)
You might also consider experimenting with oid_caret() versus
oid_current_tag() (see the online help). The latter should
only return tag objects and should return the tag that would
be affected by the modify_tag command (you could try that
command instead of the oid_modify_attr function).
I'm looking at Epic 4.0 help text, and there may be some differences
between this and Adept 9.0.1 in this area, so you may still have
some investigating to do, but I hope this gives you some avenues
to try.
paul