These command line options are documented at the Enhydra site.
The -urlmapping option takes two arguments. The input HTML page is searched for instances of the first argument. All these instances are replaced in the output by the second argument.
The -urlsetting option takes two arguments. The input HTML page is searched for tags with a id attribute. If the value of the id attribute is the same as the first argument, and the tag also contains an URL, the URL is replaced in the output by the second argument.
The -docout option takes one argument, interpreted as a file
name. This option shortcircuits the generation of Java code. If it is
present on the command line, XMLC writes HTML to the named file. The HTML is
identical to the HTML which would have been written by the Java class. This
functionality can be useful where XMLC is being used to update the URLs in
static pages, and where Enhydra applications have some static pages.
This generates the following output. Note that only those URLs which
exactly matched -urlmapping's first argument were
replaced. In particular, appending #team to an URL was sufficient to
stop it being replaced. Recent verions of XMLC also have a -urlregexpmapping
option, which allows you to specify a regular expression to match URLs and a
replacement pattern.
Where the URLs in several HTML files need to be updated, it might be useful
to put the URL mapping options into a shell environment variable, as follows.
A Sample HTML Page
Consider the following HTML, which we will name "demo_urls.html".
<HTML>
<HEAD><TITLE>Demonstration of URL Manipulation</TITLE></HEAD>
<BODY>
<IMG SRC="Corporate.gif" ALIGN=LEFT ALT="Corporate Logo">
<IMG SRC="Corporate.gif" ALIGN=RIGHT ALT="Corporate Logo">
<A HREF="http://www.CorporateHost/ProjectPage/index.html">Project index</A>
<A HREF="http://www.CorporateHost/ProjectPage/index.html#team">Project team</A>
<A HREF="mailto:ProjectLeader@CorporateHost">Project leader</A>
<A HREF="http://www.CorporateHost/VeryOldPage" ID="defunct">First version</A>
<A HREF="http://www.CorporateHost/OldPage" ID="defunct">Second version</A>
</BODY>
</HTML>
Resulting Java Class
The -docout option does not generate java code.
Resulting HTML
The URL manipulation command line options can be invoked as follows.
$ENHYDRA/bin/xmlc -urlmapping Corporate.gif AmazingStock.gif -urlmapping http://www.CorporateHost/ProjectPage/index.html http://www.AmazingStock.com/apps/killer/index.html -urlmapping mailto:ProjectLeader@CorporateHost mailto:catbert@AmazingStock.com -urlsetting defunct http://www.CorporateHost/NotAvailable -docout demo_urls_new.html demo_urls.html
<HTML>
<HEAD><TITLE>Demonstration of URL Manipulation</TITLE></HEAD>
<BODY>
<IMG align='LEFT' alt='Corporate Logo' src='AmazingStock.gif'>
<IMG align='RIGHT' alt='Corporate Logo' src='AmazingStock.gif'>
<A href='http://www.AmazingStock.com/apps/killer/index.html'>Project index</A>
<A href='http://www.CorporateHost/ProjectPage/index.html#team'>Project team</A>
<A href='mailto:catbert@AmazingStock.com'>Project leader</A>
<A href='http://www.CorporateHost/NotAvailable' id='defunct'>First version</A>
<A href='http://www.CorporateHost/NotAvailable' id='defunct'>Second version</A><
/BODY>
</HTML>
URL_MAPPINGS="-urlmapping Corporate.gif AmazingStock.gif -urlmapping http://www.CorporateHost/ProjectPage/index.html http://www.AmazingStock.com/apps/killer/index.html -urlmapping mailto:ProjectLeader@CorporateHost mailto:catbert@AmazingStock.com -urlsetting defunct http://www.CorporateHost/NotAvailable" ; export URL_MAPPINGS
$ENHYDRA/bin/xmlc $URL_MAPPINGS -docout demo_urls_new.html demo_urls.html