Hi,
I just tried to implement the solution below for a similar problem.
But unfortunately, I can't get it to work.
My current Node is called - with ist full qualified name -
"{http://www.lexisnexis.at/schema/norm}listeneintrag"
I want now want to insert two nodes after listeneintrag.
I used the paste command, but failed miserably....
Here is my code:
<cfg:command name="insertNumListenPunkt">
<cfg:macro>
<cfg:sequence>
<cfg:command name="selectNode"
parameter="ancestor[implicitElement]
{http://www.lexisnexis.at/schema/norm}listeneintrag"/>
<cfg:command name="paste" parameter="after
<?xml version='1.0'?> <ns:clipboard
xmlns:ns='http://www.xmlmind.com/xmleditor/namespace/clipboard'><listnum></listnum><listeneintrag><absatz></absatz></listeneintrag></ns:clipboard>"/>
</cfg:sequence>
</cfg:macro>
</cfg:command>
It works fine till the selectNode. The desired node gets selected, but no
insertion is done....
I also tried to qualify all element names in the paste command, like
<cfg:command name="insertNumListenPunkt">
<cfg:macro>
<cfg:sequence>
<cfg:command name="selectNode"
parameter="ancestor[implicitElement]
{http://www.lexisnexis.at/schema/norm}listeneintrag"/>
<cfg:command name="paste" parameter="after
<?xml version='1.0'?> <ns:clipboard
xmlns:ns='http://www.xmlmind.com/xmleditor/namespace/clipboard'><{http://www.lexisnexis.at/schema/norm}listnum></{http://www.lexisnexis.at/schema/norm}listnum><{http://www.lexisnexis.at/schema/norm}listeneintrag><{http://www.lexisnexis.at/schema/norm}absatz></{http://www.lexisnexis.at/schema/norm}absatz></{http://www.lexisnexis.at/schema/norm}listeneintrag></ns:clipboard>"/>
</cfg:sequence>
</cfg:macro>
</cfg:command>
But it didn't work either.
My schema allows the insertion of the two nodes at the desired position.
Can you help me?
wbr,
Roman
> -----Urspr?ngliche Nachricht-----
> Von: xmleditor-support-bounces at xmlmind.com
> [mailto:xmleditor-support-bounces at xmlmind.com] Im Auftrag von
> Hussein Shafie
> Gesendet: Dienstag, 17. Mai 2005 15:16
> An: Klocker Christoph
> Cc: xmleditor-support at xmlmind.com
> Betreff: Re: WG: [XXE] command for inserting 2 elements
>
> Klocker Christoph wrote:
> > Hi,
> >
> > tried now different ways, couldn't get it working....
> >
> > my macro looks like you said,
> >
> > <cfg:command name="insertNumListenPunkt">
> > <cfg:macro>
> > <cfg:sequence>
> > <cfg:command name="selectNode"
> parameter="ancestor[implicitElement] punkt"/>
> > <cfg:command name="paste"
> parameter="after <?xml
> version='1.0'?>listnum></listnum><punkt><
> absatz></absatz></punkt>"/>
> > </cfg:sequence>
> > </cfg:macro>
> > </cfg:command>
> >
> > It stops working after the first command.
> > I suppose it has something to do with my schema, as if I
> change it a bit, the command executes.
> >
> > my schema looks like this
> > <xs:element name="nummerierte_liste">
> > <xs:complexType>
> > <xs:sequence>
> > <xs:element name="ueberschrift"
> minOccurs="0"/>
> > <xs:sequence maxOccurs="unbounded">
> > <xs:element name="listnum"/>
> > <xs:element ref="punkt"/>
> > </xs:sequence>
> > </xs:sequence>
> > </xs:complexType>
> > </xs:element>
> >
> > I think the problem is, that I can't even insert a new
> listnum and punkt, by pressing the "InsertAfter" button.
> While the punkt node() is selected I cannot even select the
> InsertAfter button as it is greyed out,.
>
> No. "Insert After" simply cannot be used to insert *two*
> elements at the same time (listnum and punkt).
>
> But the above macro-command based on "Paste After" can paste
> these two elements at the same time.
>
> Now, your macro-command cannot work because:
>
> [1] The parameter of the command is not well-formed XML (you
> forgot a "<" before first "listnum").
>
> [2] I forgot to wrap the two elements in a
> {http://www.xmlmind.com/xmleditor/namespace/clipboard}clipboar
> d envelope.
>
> Try this version:
> ---
> <cfg:command name="insertNumListenPunkt">
> <cfg:macro>
> <cfg:sequence>
> <cfg:command name="selectNode"
> parameter="ancestor[implicitElement] punkt"/>
>
> <cfg:command name="paste" parameter="after <?xml
> version='1.0'?> <ns:clipboard
> xmlns:ns='http://www.xmlmind.com/xmleditor/namespace/clipboard'>
> <listnum>
> </listnum>
> <punkt>
> <absatz>
> </absatz>
> </punkt>
> </ns:clipboard>"/>
> </cfg:sequence>
> </cfg:macro>
> </cfg:command>
> ---
>
> Note that if listnum and punkt have a namespace, a proper
> xmlns attribute must be added to the parameter of the "Paste
> After" command.
>
>
> --
> XMLmind XML Editor Support List
> xmleditor-support at xmlmind.com
> http://www.xmlmind.com/mailman/listinfo/xmleditor-support
>