Extract the particular field from html body of an Email


I have an Email polling service which gets an Email which will be having HTML body (Includes images,color fonts etc). I need to extract specific fields/values from that email body.

It is giving error while converting xmlNode to document.

Error: com.wm.app.b2b.server.ServiceException: [ISC.0042.9327] Expecting got

Steps followed:

  1. getTransportInfo
  2. createMimeData
  3. getBodyPartContent
  4. streamToString
  5. xmlStringToXMLNode
  6. xmlNodeToDocument

Please let me know the solution for the above issue. Thanks in advance.

Can you share the complete error message. If possible share the code sample.

Hi Mahesh,

Please find the attached code. I have already mentioned the complete error message in my previous email.

As i think, the Email server is not properly converting the HTML body into HTML tags. Please see the some tags extracted from sample data.

As you can see there is no ending tag. Like this lots of ending tags are missing.
TestGanesh.zip (12.3 KB)

I don’t think metadata tags in html will have closing tags. From your error, the issue might be with img and span tags. Img in a span tag. For to draw some clear conclusions can you post the output step 4 in your code?

Hello, is there any udate on this topic? I am also getting the above error.