Thank you very much. One of the reasons is obviously that in 4.1.0 an ID
is required even if I want to include the entire document
(xpointer="element(/1)").
Best Regards
Peter Schulte
Technische IT-Architektur und Strategie
Telefon: +49 251 7133-2343
Telefax: +49 251 7133-92343
eMail: peter.schulte at gad.de
GAD eG - IT f?r Banken
GAD-Stra?e 2-6
48163 M?nster
www.gad.de
Vorstand : Anno Lederer (Vors.), Dr. Elmar Pritsch (stv. Vors.), J?rg
Dreinh?fer, Friedhelm Wagner
Aufsichtsratsvorsitzender: Wilfried Guttmann
Sitz: M?nster/Westf., Amtsgericht M?nster, Genossenschafts-Register 337
Hussein Shafie <hussein at xmlmind.com>
Gesendet von: xmleditor-support-bounces at xmlmind.com
05.12.2008 15:11
Bitte antworten an
"xmleditor-support at xmlmind.com" <xmleditor-support at xmlmind.com>
An
Peter.Schulte at gad.de
Kopie
"xmleditor-support at xmlmind.com" <xmleditor-support at xmlmind.com>
Thema
Re: [XXE] problem with recent "include"-command
Peter.Schulte at gad.de wrote:
>
> Hi,
>
> while migrating our macro commands from XMLmind 3.2.0 to 4.1.0 I have
> some problem with the recent version of the "include"-command.
>
> We use the following command "change-to-reference" for modularizing an
> document being edited:
>
> <command name="change-to-reference">
> <macro>
> <sequence>
> <command name="selectNode"
> parameter="ancestorOrSelf[implicitElement] chapter section appendix" />
> <command name="confirm" parameter="Do you really want to ..." />
> <command name="selectFile" parameter="saveFile
> %p\..\docs-teile\*.xml" />
> <set variable="filename-new" expression="%_" plainString="true"
/>
> <get expression="$filename-new" />
> <command name="copy-docu" parameter="%_" />
> <set variable="clipboard" expression="%_" plainString="true" />
> <get expression="$filename-new" />
> <get expression="relativize-uri('file:///%_')" />
> <set variable="filename-new" expression="%_" plainString="true"
/>
> <get expression="$filename-new" />
> <command name="include" parameter="replace %_ " />
> </sequence>
> </macro>
> </command>
>
> <command name="copy-docu">
> <process>
> <copyDocument to="%0"
> selection = "true"
> preserveEntityRefs = "true"
> preserveXIncludes = "true"
> indent="true"
> encoding="ISO-8859-1">
> <resources match=".*" />
> </copyDocument>
> <read file="%0" encoding="ISO-8859-1" />
> </process>
> </command>
>
> The command copies the selected chapter, section or appendix into a
> separate file and replaces the selection with the reference to the new
> file.
> If the user selects a chapter or section, which does not have an ID,
> everything works fine. But if it has an ID the user gets the error
> message 'Die Knotenpunkte, identifiziert durch "-" konnten nicht in
> Dokument "..filename.." gefunden werden.' (Translation: the nodes,
> identified by "-" could not be found in document "... filename ...").
> This also happens if I change the command
> <command name="include" parameter="replace %_ " />
> into
> <command name="include" parameter="replace %_ ..ID.." />
>
> That means if I specify the ID of the selection as reference_id.
>
> Remark: In XMLmind 3.2 we used <command name="include"
> parameter="replace[useXInclude] %_" />
>
> What is wrong here? Can you help me?
>
As of XXE v4.1, the include command requires to be passed the URL of a
XML file containing the element to be included and the *identifier* of
the element to be included. Your command never passes to command
"include" the identifier of the element to be included.
Here's my interpretation of your "change-to-reference" command (also
attached to this email):
---
<command name="replace-by-reference">
<macro trace="true">
<sequence>
<test context="$selectedElement"
expression="(local-name(.) = 'chapter' or
local-name(.) = 'section' or
local-name(.) = 'appendix') and ./@id"/>
<command name="confirm" parameter="Replace by reference?"/>
<get context="$selectedElement" expression="./@id"/>
<command name="selectFile"
parameter="saveFile %p/../chapters/%_.xml"/>
<set variable="saveFileName" expression="%_" plainString="true"/>
<get expression="$saveFileName"/>
<command name="save-selection" parameter="%_"/>
<get context="$selectedElement"
expression="concat(uri-or-file-name($saveFileName),
' ', ./@id)"/>
<command name="include" parameter="replace %_"/>
</sequence>
</macro>
</command>
<command name="save-selection">
<process>
<copyDocument selection="true" to="%0"
preserveInclusions="true" saveCharsAsEntityRefs="true"
indent="true" encoding="ISO-8859-1">
<resources match=".*"/>
</copyDocument>
</process>
</command>
<binding>
<keyPressed code="F3"/>
<command name="replace-by-reference"/>
</binding>
---
* The element must be explicitly selected and must have an ID.
* This ID is used to suggest a save filename.
* Removed useless:
<set variable="clipboard" expression="%_" plainString="true" />
* Replaced:
<command name="selectFile"
parameter="saveFile %p\..\docs-teile\*.xml" />
by:
<command name="selectFile"
parameter="saveFile %p/../docs-teile\*.xml" />
because selectFile always expects an URL (that is, not '\' but '/').
* It is now:
preserveInclusions="true" saveCharsAsEntityRefs="true"
and no longer:
preserveEntityRefs = "true" preserveXIncludes = "true"
<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration
xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration">
<command name="replace-by-reference">
<macro trace="true">
<sequence>
<test context="$selectedElement"
expression="(local-name(.) = 'chapter' or
local-name(.) = 'section' or
local-name(.) = 'appendix') and ./@id"/>
<command name="confirm" parameter="Replace by reference?"/>
<get context="$selectedElement" expression="./@id"/>
<command name="selectFile"
parameter="saveFile %p/../chapters/%_.xml"/>
<set variable="saveFileName" expression="%_" plainString="true"/>
<get expression="$saveFileName"/>
<command name="save-selection" parameter="%_"/>
<get context="$selectedElement"
expression="concat(uri-or-file-name($saveFileName),
' ', ./@id)"/>
<command name="include" parameter="replace %_"/>
</sequence>
</macro>
</command>
<command name="save-selection">
<process>
<copyDocument selection="true" to="%0"
preserveInclusions="true" saveCharsAsEntityRefs="true"
indent="true" encoding="ISO-8859-1">
<resources match=".*"/>
</copyDocument>
</process>
</command>
<binding>
<keyPressed code="F3"/>
<command name="replace-by-reference"/>
</binding>
</configuration>
--
XMLmind XML Editor Support List
xmleditor-support at xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20081206/28ec5c89/attachment.htm