2009/09/25

New Feature for modify XML with java script

Next major release will support this feature (replace the Modify element wizard) , so user can write java script to perform complex modification. A variable named node is created automatic. It represented the selected node in dialog box.
Here is a example://get id attribute from first child node named 'span'
var nid=node.span['@id'];
//above call is same as: var nid=node.getChild('span')['@id'];
//delete first child node
node.getChild('span').remove();
//insert text before node
node.insertBefore(''+nid+':'+node.getChild('span').getInnerHTML()+'');
The node object will provide lots of function(Detail can be found here). Most of get methods are W3C API like... and additional support:
  • For get child node : node.childName is the same as node.getChild('childName') unless the childName is the same as any supported function.
  • For get attribute value : node['@attrName'] is the same as node.getAttribute('attrName')
Basic rules for modification: 1) All node text/data are evaluated as original value.
For example://if node['@attr']='789'
node.setAttribute('attr','123');
//try to set @id=@attr
node.setAttribute('id',node['@attr']);
//node['@id'] will be '789' not '123'
2) If a node is modified several times, high priority modification will overwrite others.
For example://remove a node
node.remove();
//below call will not take effect, because remove() conflict with setOuterHTML();
node.setOuterHTML('test');
If you have any suggesion, please feedback.

2009/09/07

Version 1.2.3 release

  • [Requirement] String Externalize wizard - sort property key before update property file
  • [Requirement] Move "By click position" option from "Child Text Node" to "Whole Node", support tag lib that handler type is "Output tag data" and only one attribute is outputed.
  • [Requirement] For page import function, if editor is not opened, move cursor to original node.
  • [Requirement] Change visual part highlight implementation(the table cell will not be resized)
  • [Bug] Double click in visual part only work if element is already select
  • [Bug] "By click position" does not work in some case
Thanks for Chris' suggestion. For all visitors, please let me know if you have other ideas~ If you think the plugin is helpful, please vote this plugin in Eclipse plugin central.