on 06-22-2006 7:37 PM
Wanted to confirm my understaing for ABAP and JAVA mapping.
Am I correct in my assumption that these mapping techniques can be used only if input and ouput is in XML format ?
So if XI is receiving a flat comma separated text/non-XML file or an IDOC for that matter and output is NOT in XML format, say again flat text file or IDOC, I cannot use above two techniques?
All the docs I have read suggest that 'Execute' method is called when XML file/data is received, paresed using DOM/SAX/JAXB (for Java mapping) or IXML lib (for ABAP mapping) and then create a output XML file.
-Thanks in advance
Hi,
<i>Am I correct in my assumption that these mapping techniques can be used only if input and ouput is in XML format ?</i>
>>Parser will parse only XML documents. It should have xml document format.
<i>
So if XI is receiving a flat comma separated text/non-XML file or an IDOC for that matter and output is NOT in XML format, say again flat text file or IDOC, I cannot use above two techniques?</i>
>>You can use it. Mapping is used for tranforming the sourcr structure into Target structre with Business Rules. Now Adapter comes into picture.SO idea is, the corresponding adapters will read the nonXML structure and give it to XI as an XI understandable XML structre
Hope it helps,
Regards,
Moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Michal.
Plz do not get me wrong/misunderstand here..it is still using DOM parser as sender adapter is HTTP and it sends the flat file as an XML file which is then parsed to target XML file.
This is the text from the blog:
***
The Flow
Posting the flat file
The source system will post the flat file to XI using the HTTP plain adapter. Before posting, the used webpage will wrap the flat file into an XML file just by adding a root element. This root element is necessary, because the Plain HTTP adapter of XI accepts only XML.
Hi Bob,
Here you have a code sample for deescaping. I have have written this code a couple of time ago. The incoming file can be any text format. It might be XML, but not necessarily.
The main method is not reqired, but good for testing.
Regards
Stefan
/*
* Created on 28.09.2005
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package sample;
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.Map;
public class Deescaping implements StreamTransformation{
public static void main (String[] args) {
try {
InputStream in = new FileInputStream(new File("in.xml"));
OutputStream out = new FileOutputStream(new File("out.xml"));
Deescaping change = new Deescaping();
change.execute(in, out);
} catch (Exception e) {
e.printStackTrace();
}
}
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 {
// ampersand
String help = "&";
boolean exit = false;
// check the next 5 chars, if there is a ';'
for (int i = 0; i < 5 && !exit; i++) {
c = in.read();
if (c == -1) {
exit = true;
} else {
// another ampersand?
if (c == '&') {
out.write(help.getBytes());
help = "&";
i = 0; // check the next 5 chars
} else {
help = help + (char) c;
if (c == ';') {
exit = true;
}
if (help.equals("&")) {
help = "&";
}
if (help.equals("<")) {
help = "<";
}
if (help.equals(">")) {
help = ">";
}
if (help.equals(""")) {
help = """;
}
if (help.equals("'")) {
help = "'";
}
}
}
} // for
out.write(help.getBytes());
}
} // while
out.flush();
} catch (Exception e) {
throw new StreamTransformationException(e.getMessage(),e);
}
}
}
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.