Skip to Content
author's profile photo Former Member
Former Member

Java code to parse the content of input XML and send to target field

HI All,

I have the following UDF code which will parse the input XML and send some portion to the target element

String temp = a[0].substring(a[0].indexOf(b[0])+(b[0].length()));

String value = temp.substring(0,temp.indexOf("/")-2);


Actual input should come is value="149433" /. Now the present input doesn't contain space after quotation symbol (value="149433"/)which is truncating the last digit(The output going is 14943 instead of 149433)

The above UDF will remove the last 2 characters and send the output to target field. The new requirement is the entire value should send to target field. Please advise how to achieve the requirement(with space&quotation, without space and with quotation)

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 10, 2013 at 02:01 PM


    Not sure what's the context of argument "b", but u can replace second line of ur code with the below one:

    String value = a[0].replaceAll(" ","").substring(0,a[0].replaceAll(" ","").indexOf("/")-1);

    So above statement will replace all the spaces present in the input value and then pass that value which is present before "/" (without any spaces)


    Amit Srivastava

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.