Thanks for the clarification. This is exactly what I needed, to create a
processor and pass arguments before processing.

Thanks and regards,
Hossam



On Nov 27, 2017 10:42 AM, "Hussein Shafie" <huss...@xmlmind.com> wrote:

On 11/26/2017 06:17 PM, Hossameldin M. Abdelwahed wrote:

>
> I need to convert doc file to xhtml file using my own extension class
> and some custom xed files. How to do that using your API?
>
>
I'm sorry but I'm not sure to understand what you mean by "extension
class". To which extension point (http://www.xmlmind.com/w2x/_d
istrib/doc/manual/index.html#extension_points) do you refer?



Anyway, if you just want to use custom ".xed" files using the API, no need
to extend anything.

This can be done just like with the w2x command-line tool.

If you are generating semantic XHTML, then your using
"W2X_install_dir/xed/main.xed".

If you take a look at this "main.xed" file, you'll notice that this
conversion step named "edit" by default invokes a number of named XED
scripts designed to be extended or overridden:

---
...
script(defined("before.headings", ""));
script(defined("do.headings", "headings.xed"));
script(defined("after.headings", ""));

script(defined("before.lists", ""));
script(defined("do.lists", "lists.xed"));
script(defined("after.lists", ""));

script(defined("before.blocks", ""));
script(defined("do.blocks", "blocks.xed"));
script(defined("after.blocks", ""));
...
---

More info about this in Stock XED scripts
http://www.xmlmind.com/w2x/_distrib/doc/manual/index.html#stock_xed_scripts

For example, let's suppose you want 1) to do something before the
processing of headings ("headings.xed") and 2) to replace the processing of
blocks ("blocks.xed") by a processing of your own.

You could do it like this using the Java API:

---
Processor proc = new Processor();

/* -pu accepts URLs or filenames. */

String[] args = {
   ...OTHER w2x ARGUMENTS HERE...

   "-pu",
   "edit.before.headings",
   "file:///C:/Users/hossam/w2x_ext/xed/Before%20the%20Headings.xed",


   "-pu",
   "edit.do.blocks",
   "C:\Users\hossam\w2x_ext\xed\My Blocks.xed",

   ...OTHER w2x ARGUMENTS HERE...
};

proc.configure(args);

proc.process(...);
---



You'll find a short and simple example of w2x embedding in the source code
of the "Word To XML" servlet. (Your wx-srv license gives you access to this
source code.) Please take a quick look at "src/com/xmlmind/w2x_servlet/W
ordToXMLServlet.java".




References:

- Embedding w2x in a Java™ application
http://www.xmlmind.com/w2x/_distrib/doc/manual/index.html#embed

- http://www.xmlmind.com/w2x/_distrib/doc/api/com/xmlmind/w2x/
processor/Processor.html

- http://www.xmlmind.com/w2x/_distrib/doc/api/com/xmlmind/w2x/
processor/Processor.html#configure-java.lang.String:A-

- http://www.xmlmind.com/w2x/_distrib/doc/api/com/xmlmind/w2x/
processor/Processor.html#process-java.lang.Object-java.io.
File-com.xmlmind.util.ProgressMonitor-
--
XMLmind Word To XML Support List
w2x-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/w2x-support

Reply via email to