On 09/16/2014 11:29 PM, maxwell wrote:
We've been using XXE's 'insertNode' command with the parameter
'sameElementAfter' to copy an element (it happens to be one that we
added to the standard DocBook elements, although that probably doesn't
matter).  It correctly copy/pastes the node and sub-nodes, but not text
elements under that node.  However, it does not copy the attributes.  In
particular, it doesn't copy the value of one attribute that we need.  I
know the name of the attribute (it's always the same one); I just don't
know what its value will be in any particular instance.

I thought there might also be a command that copies an attribute value,
but I don't see any such command--only addAttribute and putAttribute.
(I'm looking at the list of commands at
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/commandref.html.)

I'm sure if I were a Java programmer, I could write a Java command (I
see the documentation for doing this), or maybe modify the code for the
existing insertNode command.  Unfortunately I'm not...

Am I overlooking the command I want?  Something like copyAttribute, I
would think; or maybe a parameter on the 'insertNode' command like
'sameAttributes'.


--> Command

insertNode sameElementAfter

inserts a new element similar to the selected one after the selected one. This new element has minimal content[*] in order to be valid.

More info: http://www.xmlmind.com/xmleditor/_distrib/doc/commands/insertNode.html



--> If you need more than this basic function, please write (or record: http://www.xmlmind.com/xmleditor/_distrib/doc/help/recordMacroMenu.html) a macro-command and then bind it to a keystroke (http://www.xmlmind.com/xmleditor/_distrib/doc/help/customizeConfigurationMenu.html#addKeyboardShortcutAction).

This macro-command (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro.html) could consist in:

copy (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/copy.html)
+
paste (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/paste.html)

OR

this macro-command could consist in:

store value of attribute XXX in a variable YYY (<set> child element in http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html#set)
+
insertNode sameElementAfter
+
get value of variable YYY (<get> child element in http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html#get)
+
putAttribute XXX=YYY on newly inserted element (http://www.xmlmind.com/xmleditor/_distrib/doc/commands/putAttribute.html)



---
[*] If it does not work that way, this implies that you work on a structurally invalid document.

--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to