xml document not refreshed when attribute value changed

Oxygen general issues.
guna@ebscohost.com
Posts: 27
Joined: Tue Nov 17, 2009 10:16 pm

xml document not refreshed when attribute value changed

Post 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));

Radu
Posts: 9063
Joined: Fri Jul 09, 2004 5:18 pm

Re: xml document not refreshed when attribute value changed

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply