This API will extract the document level fields for the document type for the specified batch class using regular regex extraction.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
documentType This should not be empty and valid document type for that batch class This parameter is used for generating document level fields for defined document type.
batchClassIdentifier This should not be empty and valid batch class identifier This parameter used for fetching the information of the document for defined document type.
hocrFile This value should not be empty. XML file name for which document level fields will be extracted.


An input string parameter hocrFile is to be supplied to denote the name of the HOCR file input to the web service.


Web Service URL: http://{serverName}:{port}/dcma/rest/extractFieldsUsingRegex

Sample XML file





<Value>US Invoice</Value>














  1. This batch class specified should have Regular Regex plugin configured.
  2. DocumentType should have document level fields for specified document type.
  • HOCR file name should have valid extension, i.e., XML.


Sample client code using apache commons http client:-

private static void extractFieldsUsingRegex() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractFieldsUsingRegex";
		PostMethod mPost = new PostMethod(url);
		File file1 = new File("C:\\sample\\sample.xml");
		// adding xml file for taking input
		File file2 = new File("C:\\sample\\US-Invoice_HOCR.xml");
		Part[] parts = new Part[3];
		try {
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			parts[2] = new StringPart("hocrFile ", file2.getName());
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
		} catch (HttpException e) {
		} catch (IOException e) {
		} finally {
			if (mPost != null) {

Was this article helpful to you?