| <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <title>XML Compare Extension Points: idMapping</title> |
| </head> |
| <body link="#0000FF" vlink="#800080"> |
| |
| <center> |
| <h1> |
| idMapping</h1></center> |
| <b><i>Identifier: </i></b>org.eclipse.compare.examples.xml.idMapping |
| <p><b><i>Description: </i></b>This extension point allows to define internal XML ID Mapping |
| schemes using the <i>mapping</i> element. These schemes can then be used when performing an XML compare to uniquely identify XML elements by the value of an |
| attribute or the text in a child element. |
| <br>Additionally, <i>ordered</i> elements can be used to specify that the direct children of an element should be compared in ordered fashion instead of the |
| default unordered way. |
| <p><b><i>Configuration Markup:</i></b> |
| <p><tt> <!ELEMENT idmap (mapping*)></tt> |
| <br><tt> <!ATTLIST idmap</tt> |
| <br><tt> name |
| CDATA #REQUIRED</tt> |
| <br><tt> extension |
| CDATA</tt> |
| <br><tt> ></tt> |
| <ul> |
| <li> |
| <b>name</b> - the name of the ID Mapping scheme. Should be unique.</li> |
| <li> |
| <b>extension</b> - (optional) a file extension associated with this ID Mapping Scheme. |
| When comparing files with this extension, the current ID Mapping Scheme will automatically be used. |
| <br>If an extension is specified, then the extension should also be added in the plugin.xml file of the XML Compare Plugin. |
| For example, if we create an ID Mapping Scheme with extension cd, the plugin.xml of the XML Compare Plugin is updated as follows |
| (update shown in bold): |
| <tt> |
| <p><extension |
| <br> point="org.eclipse.compare.structureMergeViewers"> |
| <br> <structureMergeViewer |
| <br> extensions="xml,classpath,<b>cd</b>" |
| <br> class="org.eclipse.compare.xml.XMLStructureViewerCreator"> |
| <br> </structureMergeViewer> |
| </tt> |
| <p><b>Warning: </b>If an extension is associated more than once, only the first association will be considered. |
| Also, internal ID Mapping schemes have priority over user ID Mapping schemes when duplicate extensions are defined. |
| <p><b>Warning: </b>When an internal ID Mapping scheme with extension association is removed (from a <tt>plugin.xml</tt>), the XML Compare plugin has to be reloaded to disassociate itself from the extension. |
| If not, on the first compare of files with this extension, the XML Compare plugin will be used with the default <em>Unordered</em> algorithm. |
| (However, at this point the extension will have been disassociated from the XML Plugin, as the plugin has been loaded.) |
| </ul> |
| <br> |
| <p><tt> <!ELEMENT mapping EMPTY></tt> |
| <br><tt> <!ATTLIST mapping</tt> |
| <br><tt> signature |
| CDATA #REQUIRED</tt> |
| <br><tt> id |
| CDATA #REQUIRED</tt> |
| <br><tt> id-source CDATA</tt> |
| <br><tt> ></tt> |
| <ul> |
| <li> |
| <b>signature</b> - the XML path from the root to the current element (see examples below).</li> |
| |
| <li> |
| <b>id</b> - the attribute that identifies this element or the name of the child element |
| whose text identifies this element.</li> |
| |
| <li> |
| <b>id-source</b> - (optional) if <em>id</em> is the name of a child element, then this attribute must have |
| the value <em>body</em>. If <em>id-source</em> is left out, it is assumed that <em>id</em> is an attribute.</li> |
| </ul> |
| <br> |
| <p><tt> <!ELEMENT ordered EMPTY></tt> |
| <br><tt> <!ATTLIST ordered</tt> |
| <br><tt> signature |
| CDATA #REQUIRED</tt> |
| <br><tt> ></tt> |
| <ul> |
| <li> |
| <b>signature</b> - the XML path from the root to the element whose direct children will be compared in ordered fashion instead of the default unordered way.</li> |
| </li> |
| </ul> |
| <b><i>Examples:</i></b> |
| <br>The following is an example ID Mappings Scheme for ANT files. |
| <br><i>project</i> elements are identified by an attribute <i>name</i>. <i>target</i> elements (which are children of <i>project</i>) are also identified by an attribute <i>name</i>. |
| Also, the children of <i>target</i> will be compared in the order in which they appear in the document. |
| <tt> |
| <p><idmap name="ANT"> |
| <br> <mapping signature="project" id="name"/> |
| <br> <mapping signature="project>target" id="name"/> |
| <br> <ordered signature="project>target"/> |
| <br><idmap> |
| </tt> |
| <p>The following example illustrates a case where the text of a child element is used as id: |
| <tt> |
| <p><idmap name="Book Catalog" extension="book"> |
| <br> <mapping signature="catalog>book" id="isbn" id-source="body"/> |
| <br><idmap> |
| </tt> |
| <p><b><i>Supplied Implementation:</i></b> |
| <br>The XML Compare plugin defines an ID Mapping scheme for Eclipse <tt>plugin.xml</tt> files, one for <tt>.classpath</tt> files and one for ANT files. |
| |
| <p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation and others 2000, 2003. All Rights Reserved." BORDER=0 height=14 width=324></a></p> |
| </body> |
| </html> |