on 03-18-2008 5:19 AM
Hi Experts,
In my sender side payload I have received '&', can we change this in the payload as mapping is giving some error and is not ready to accept this string.
Regards,
Study SAP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Make sure, that your send send valid XML.
Try to convince the sender to change & to & amp; as it is easier to do it there.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
is this may work out for u try once.. declare that field which accepts & as string, and do the mapping with the string field for the output also, i worked it it is working fine..
regards
Kishore
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can definetly write java code for that .You can Replace "&" sign with come symbol like "_-#_" when your payload enters in XI for the first time and then again replace
"_-#_" with " &" when it comes out .
Rewards points if helpful
Thanks
Sunil Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
can you please eloborate your questinn ....
Praveen Kalwa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should not replace & manually.
You can choose Javamapping by 2 ways.
1) You can use Javamapping to replace & by "&
package sample;
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.Map;
public class MyJavaMapping implements StreamTransformation {
public void setParameter(Map map) {
}
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
try {
int c;
while ((c = in.read()) != -1) {
if (c != '&') {
out.write(c);
} else {
out.write("&".getBytes());
}
} // while
out.flush();
} catch (Exception e) {
throw new StreamTransformationException(e.getMessage(),e);
}
}
}
2) You can choose Javamapping by replacing the encoding UTF-8 to ISO-8859-1 which accepts & as as it is.
For more details check this guide:
You cant use UDF
Since you are going to transform '&' by using DataInputStream and DataOutputStream
You can use only java mapping........
or other wise you can use XSLT mapping by converting the encoding from UTF-8 to ISO-8859-5
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="ISO-8859-5"/>
<xsl:template match="/">
<xsl:copy-of select="*" />
</xsl:template>
</xsl:stylesheet>
Hi,
I don't think for this kind of operations you need to go for Java Mapping.
& is the Bitwise Operator used in Java, so in String it was giving you the error.
The bitwise & operator performs a bitwise AND operation.
The bitwise ^ operator performs a bitwise exclusive OR operation.
The bitwise | operator performs a bitwise inclusive OR operation.
You could avoid it by adding \&. Please use below UDF
Soruce field (A) --> UDF --> Target
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.