Note that we are not supposed to answer this kind of questions. Excerpts
from http://www.xmlmind.com/xmleditor/proedition.html:
---
* Unlimited developer support by e-mail for *3* *months* from date of
purchase.
This type of support is intended to help the customer integrate XXE in
his information system.
---
Let's say that we'll answer your questions for the last time as a proof
of our good will.
Jeff Hooker wrote:
>
> We're writing a command that will allow users to strip the xml:id attributes
> from a copied node before they paste it and running into some difficulties.
>
>
> First question:
>
> I'm trying to register a new paste command in XmlMind.
>
> At first I created BSPaste class extending Paste class which is already
> defined
> in XMLmind.
> Then tried to register this BSPaste as command, and replace Paste with this
> BSPaste class.
>
> So I added jar file for the new class in directory
> XMLEditor4\addon\a_bs_docbook\config\bs_docbook\delete_attribute,
> and added following code in file
> XMLEditor4\addon\a_bs_docbook\config\gui\customize.xxe_gui:
>
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> <command name="bluestream.paste">
> <class>com.bluestream.docbook.copypaste.BSPaste</class>
> </command>
>
> <action name="pasteBeforeAction" label="Paste Bef_ore"
> icon="icons/pasteBeforeAction.png">
> <command name="bluestream.paste" parameter="before[implicitElement]" />
> </action>
>
> <action name="pasteAction" label="_Paste"
> icon="icons/pasteAction.png">
> <command name="bluestream.paste" parameter="toOrInto" />
> </action>
>
> <action name="pasteAfterAction" label="Pa_ste After"
> icon="icons/pasteAfterAction.png">
> <command name="bluestream.paste" parameter="after[implicitElement]" />
> </action>
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>
> When I run xmlmind, I got this message:
>
> 'bluestream.paste' unknown command
> 'bluestream.paste' unknown command
> 'bluestream.paste' unknown command
>
> Then I tried several other ways adding the file in different places in addon
> directory but have yet to get it working. What am I doing wrong?
>
--> You forgot to add what follows at the end of your customize.xxe_gui:
---
<layout>
<hidden>
<insert/>
<command name="bluestream.paste" />
</hidden>
</layout>
---
For example, the attached customize.xxe_gui works fine.
See http://www.xmlmind.com/xmleditor/_distrib/doc/gui/hidden.html
--> What you have done will indeed change the behavior of the Paste menu
items and also of the Paste toolbar buttons. However it will have no
special effect when a user will press Ctrl-V, Ctrl-U, Ctrl-W. In such
case, it's the stock paste command which will be invoked.
The solution is to replace the stock paste command and not to register a
bluestream.paste command.
Therefore, the following, simpler, customize.xxe_gui should do what you
expect (in almost all the cases because some commands may directly
instantiate com.xmlmind.xmledit.cmd.edit.Paste for their own internal
needs):
---
<gui xmlns="http://www.xmlmind.com/xmleditor/schema/gui"
xmlns:gui="http://www.xmlmind.com/xmleditor/schema/gui">
<command name="paste">
<class>com.bluestream.docbook.copypaste.BSPaste</class>
</command>
<layout>
<hidden>
<insert/>
<command name="paste" />
</hidden>
</layout>
</gui>
---
> Second question.
>
> When trying to get the attributes from Node with method:
> node.attributeValue(attributeName);
>
> the attributeName "xml:id" is NOT identified, which returns null, while
> the attributeName "arch" is identified, which returns its value.
>
> So I would like to know what is the reason, and how to
> identify "xml:id" as regular attribute for a Node.
>
--> Please do not use any of the methods documented as:
---
Description copied from interface: XNode
---
Such (weakly typed) methods are public only by necessity and could be
removed at any time without notice.
Instead, please use the native (strongly typed) DOM of XXE. In your
case, it's Element.getAttribute(Name)
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Element.html#getAttribute(com.xmlmind.xml.name.Name)
However this does not explain your problem (which is probably caused by
a mistake you made in the creation of the attribute name).
--> Please take the time to read:
XMLmind XML Editor - Developer's Guide, Programming the Document Object
Model:
http://www.xmlmind.com/xmleditor/_distrib/doc/dev/dom.html
You'll see there that:
element.getAttribute(Name.XML_ID)
or
element.getAttribute(Name.get(Namespace.XML, "id"))
and
element.getAttribute(Name.get(Namespace.NONE, "arch"))
or
element.getAttribute(Name.get("arch"))
are the recommended methods to access attributes "xml:id" and "arch".
<?xml version='1.0' encoding='UTF-8'?>
<gui xmlns="http://www.xmlmind.com/xmleditor/schema/gui"
xmlns:gui="http://www.xmlmind.com/xmleditor/schema/gui">
<command name="bluestream.paste">
<class>com.xmlmind.xmleditapp.cmd.helper.Alert</class>
</command>
<action name="pasteBeforeAction" label="Paste Bef_ore"
icon="xxe-gui:app/icons/pasteBeforeAction.png">
<command name="bluestream.paste" parameter="before[implicitElement]" />
</action>
<action name="pasteAction" label="_Paste"
icon="xxe-gui:app/icons/pasteAction.png">
<command name="bluestream.paste" parameter="toOrInto" />
</action>
<action name="pasteAfterAction" label="Pa_ste After"
icon="xxe-gui:app/icons/pasteAfterAction.png">
<command name="bluestream.paste" parameter="after[implicitElement]" />
</action>
<layout>
<hidden>
<insert/>
<command name="bluestream.paste" />
</hidden>
</layout>
</gui>
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support