Page 1 of 1

xml document not refreshed when attribute value changed

Posted: Sat Feb 20, 2010 3:39 pm
by guna@ebscohost.com
Hi,
we are using oxygen 11.1

i am trying to change the attribute value through api. the value has been changed,when i query back the attribute value.

but in oxygen editor the corresponding attribute value is not showing the correct value, as well as the the save button is not enable..

if i try the following workaround. then it is working.
edit the xml content and save the document. at this point it is showing the correct value.

following is my code

Code: Select all


AuthorNode[] node= authorAccess.getDocumentController().findNodesByXPath("//article",true, true, true);
AuthorElement element = (AuthorElement)node[0];

element.setAttribute("article-type", new AttrValue(userSelectedType));


Re: xml document not refreshed when attribute value changed

Posted: Mon Feb 22, 2010 11:24 am
by Radu
Hi Guna,

Always make modifications to existing elements through the AuthorDocumentController like:

Code: Select all


authorAccess.getDocumentController().setAttribute("article-type", new AttrValue(userSelectedType), element);
Using the controller to make modifications will also make undo/redo work for them and mark the document as modified.
The AuthorElement nodes indeed have the setAttribute() methods on them but they are only intended to be used when the AuthorElement's are not a part of the current document.

Regards,
Radu