Hussein,
I get the NPE exception below when executing a macro to use the convert
command with a template instead of a node. I'm trying to put an
<emphasis role="bold"> tags around the current word.
The elementTemplate, macro, binding, and exception follow.
I haven't looked to see if the bug is in my code, but in any case, I
don't suppose you want XXE throwing exceptions in this case.
David Flanagan
<elementTemplate name="bold" selectable="true">
<emphasis role="bold" xmlns=""></emphasis>
</elementTemplate>
<!-- If there is a selection, enclose it in the specified tag. -->
<!-- If there is no selection, do it to the current word. -->
<command name="djf.Enclose">
<macro>
<choice>
<sequence><!-- if there is no selection, select the current word -->
<pass><command name="djf.testSelection" parameter="none"/></pass>
<command name="moveDotTo" parameter="previousChar"/>
<command name="selectText" parameter="word"/>
<command name="convert" parameter="[wrapElement] %0"/>
<command name="moveDotTo" parameter="elementEnd"/>
<command name="insertNode" parameter="textAfter[implicitElement]"/>
</sequence>
<!-- if there is a selection -->
<sequence>
<command name="convert" parameter="[wrapElement] %0"/>
<command name="moveDotTo" parameter="elementEnd"/>
<command name="insertNode" parameter="textAfter[implicitElement]"/>
</sequence>
</choice>
</macro>
</command>
<binding> <!-- Ctrl-C B: put word or selection in Bold -->
<keyPressed code="C" modifiers="ctrl"/>
<keyPressed code="B"/>
<command name="djf.Enclose" parameter="#template(emphasis,bold)"/>
</binding>
Execution of command com.xmlmind.xmledit.command.MacroCommand
with parameter '#template(emphasis,bold)'
has thrown a java.lang.NullPointerException exception.
----------------------------------------
java.lang.NullPointerException
at
com.xmlmind.xmledit.command.Convert.getFieldChooserInfo(Convert.java:190)
at
com.xmlmind.xmledit.command.Convert.prepareCommand(Convert.java:82)
at
com.xmlmind.xmledit.command.MacroCommand$Invocation.prepare(MacroCommand.java:90)
at
com.xmlmind.xmledit.command.MacroCommand$Sequence.execute(MacroCommand.java:202)
at
com.xmlmind.xmledit.command.MacroCommand$Choice.execute(MacroCommand.java:179)
at
com.xmlmind.xmledit.command.MacroCommand.executeCommand(MacroCommand.java:245)
at
com.xmlmind.xmledit.gadget.Bindings.executeCommand(Bindings.java:532)
at
com.xmlmind.xmledit.gadget.Bindings.handleKeyEvent(Bindings.java:486)
at
com.xmlmind.xmledit.view.DocumentView.handleKeyEvent(DocumentView.java:3092)
at
com.xmlmind.xmledit.gadget.EventDispatcher.dispatchEvent(EventDispatcher.java:132)
at
com.xmlmind.xmledit.view.DocumentViewEventDispatcher.dispatchEvent(Do