XML file parse issue
I have a requirement to print <attribute-override> and <column> in a spreadsheet.
My xml file is as
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd">
<entity class="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetails">
<table name="FLX_AC_ACCT_CREDIT_MATRIX_DTLS"/>
<attributes>
<embedded-id attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetailsKey" name="key">
<attribute-override name="accountId">
<column name="ACCOUNT_ID"/>
</attribute-override>
<attribute-override name="accountType">
<column name="ACCOUNT_TYPE"/>
</attribute-override>
<attribute-override name="effectiveDate">
<column name="EFFECTIVE_DATE"/>
</attribute-override>
<attribute-override name="matrixIdvalue">
<column name="MATRIX_ID_VALUE"/>
</attribute-override>
<attribute-override name="classification">
<column name="Classification"/>
</attribute-override>
</embedded-id>
<embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetric" name="creditMetric">
<attribute-override name="metricType">
<column name="METRIC_TYPE" unique="false"/>
</attribute-override>
<attribute-override name="metricValue">
<column name="METRIC_VALUE" unique="false"/>
</attribute-override>
</embedded>
<embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.RiskScore" name="riskScore">
<attribute-override name="scoreType">
<column name="SCORE_TYPE" unique="false"/>
</attribute-override>
<attribute-override name="otherScoreType">
<column name="OTHER_SCORE_TYPE" unique="false"/>
</attribute-override>
<attribute-override name="scoreCardExternalReferenceNo">
<column name="SCORE_EXTR_REF_NO" unique="false"/>
</attribute-override>
<attribute-override name="ratingModel">
<column name="RATING_MODEL" unique="false"/>
</attribute-override>
<attribute-override name="ratingStatus">
<column name="RATING_STATUS" unique="false"/>
</attribute-override>
<attribute-override name="riskGrade">
<column name="RISK_GRADE" unique="false"/>
</attribute-override>
<attribute-override name="scoreCardIndex">
<column name="SCORE_CARD_INDEX" unique="false"/>
</attribute-override>
<attribute-override name="score">
<column name="SCORE" unique="false"/>
</attribute-override>
</embedded>
</attributes>
</entity>
</entity-mappings>
I have managed to write the code as
package xmlexcel;
import org.apache.poi.hssf.usermodel.*;
import java.util.ArrayList;
import java.awt.List;
import java.io.*;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class XMLconvertExcel {
private static File xmlDocument;
private static NodeList e;
int a;
public void generateExcel(File xmlDocument) {
try {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet spreadSheet = wb.createSheet("spreadSheet");
spreadSheet.setColumnWidth((short)0,(short) (256*25));
spreadSheet.setColumnWidth((short)1,(short) (256*25));
spreadSheet.setColumnWidth((short)2,(short) (256*25));
spreadSheet.setColumnWidth((short)3,(short) (256*25));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xmlDocument);
NodeList nList = document.getElementsByTagName("attributes");
document.getDocumentElement().normalize();
//a=nodelist.getLength();
//e = printStackTrace();
//System.out.println("I am here " +e);
System.out.println("Root element :" + document.getDocumentElement().getNodeName() + " nlist length " +nList.getLength());
System.out.println("Node Type :" + document.getDocumentElement().getNodeType());
HSSFRow row = spreadSheet.createRow(0);
HSSFCell cell = row.createCell((short)0);
cell.setCellValue("Entity");
cell = row.createCell((short)1);
cell.setCellValue("Table");
cell = row.createCell((short)2);
cell.setCellValue("Attribute");
cell = row.createCell((short)3);
cell.setCellValue("Column");
HSSFRow row1 = spreadSheet.createRow(1);
HSSFRow row2 = spreadSheet.createRow(2);
HSSFRow row3 = spreadSheet.createRow(3);
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
System.out.println("\nCurrent Element :" + nNode.getNodeName());
switch {
case 0:
//cell = row1.createCell((short)0);
//cell.setCellValue("Attribute");
//trying from http://architects.dzone.com/articles/parsing-xml-using-dom-sax-and
cell = row1.createCell((short) 2);
cell.setCellValue(((Element) (nList.item(0)))
.getElementsByTagName("attribute-override").item(0)
.getFirstChild().getNodeValue());
break;
case 1:
//cell = row1.createCell((short)1);
//cell.setCellValue("Table");
cell = row1.createCell((short) 3);
cell.setCellValue(((Element) (nList.item(0)))
.getElementsByTagName("column").item(0)
.getFirstChild().getNodeValue());
break;
case 2:
cell = row1.createCell((short)2);
cell.setCellValue("Attribute");
cell = row1.createCell((short) 2);
cell.setCellValue(((Element) (nodelist.item(2)))
.getElementsByTagName("attribute-override").item(0)
.getFirstChild().getNodeValue());
cell = row1.createCell((short)3);
cell.setCellValue("Column");
cell = row1.createCell((short) 3);
cell.setCellValue(((Element) (nodelist.item(3)))
.getElementsByTagName("column").item(0)
.getFirstChild().getNodeValue());
break;
default:
break;
//wb.write(arg1.getOutputPayload().getOutputStream());
//Outputting to Excel spreadsheet
FileOutputStream output = new FileOutputStream(new File("C:\\java_training\\com\\XMLtoExcel\\ormaccount.xls"));
wb.write(output);
output.flush();
output.close();
} catch (IOException e) {
System.out.println("IOException " + e.getMessage());
} catch (ParserConfigurationException e) {
System.out.println("ParserConfigurationException " +e.getMessage());
}catch (SAXException e) {
System.out.println("SAXException " +e.getMessage());
private String printStackTrace() {
// TODO Auto-generated method stub
return null;
* @param args
public static void main(String[] args) {
File xmlDocument = new File("C:\\java_training\\com\\XMLtoExcel\\AccountCreditMatrixDetails.orm.xml");
XMLconvertExcel excel = new XMLconvertExcel();
excel.generateExcel(xmlDocument);
Both the tags are not getting printed in separate columns.
I have looked at
http://www.javaworld.com/article/2076189/enterprise-java/book-excerpt--converting-xml-to-spreadsheet--and-vice-versa.html
http://scn.sap.com/thread/3224533
http://www.tutorialspoint.com/java_xml/java_dom_parse_document.htm
The above URL shows example of simple xml.
Please can I get assistance.
I too received this error as I tried to run my first Windows 8.1 deployment. Per another post I commented out this line
<IEWelcomeMsg>false</IEWelcomeMsg>
from the IE section of the unattend.xml. I was then able to run my deployment. I do not see this line in your posting though.
I referenced this link even though it was for Windows 7.
http://social.technet.microsoft.com/Forums/en-US/c41a2b69-a591-4cd3-86ab-6a0f8a73b858/getting-windows-could-not-parse-or-process-the-unattend-answer-file-for-pass-specialize-with?forum=mdt
Hope this helps someone.
JayTheTech
To clarify, I edited the unattend.xml file from from Deployment Share, not C:\Windows\Panther.
DS\control\task sequence ID\unattend.xml
JayTheTech
Similar Messages
-
Hello I am doing some SOAP XML stuff and I am having an issue that hopefully I can get some help with.
Is XML like this valid to do in a SOAP message?
<prompt>1 &_lt_; 0? <prompt>It's suppose to represent "1 < 0?"
* the forum formatter seems to eat up my encoded text and transofrms it into acutal "<" so I am placing underscores "_" everywhere to keep the text. so above is actually without underscores
From what I've read I think it is. I have text like this transported as part of the overall SOAP message to my client from the server.
In my code I do:
// Create an instance of the DocumentBuilderFactory
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
// Get the DocumentBuilder from the factory
DocumentBuilder builder = documentFactory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
...inputStream is an InputStream (specifically ByteArrayInputStream) containing the XML.
The issue I am having is that wherever I have an '&' (such as "&_lt_;" or "&_gt_;" or "&" etc...) the parsing seems to get cut off and the rest of the string doesn't seem to get parsed. So the above string "1 &_lt_; 0?" ends up being "1 ".
Also is there an easy way to get back or rebuild the XML into a string from a Document object? I would really like to do that right after I do the parse method and see if the XML data that the Document object has is the same as what's in the inputStream (which is "1 &_lt_; 0?").
Any input you can provide is much appreciated. Thanks,
LatemHello I am doing some SOAP XML stuff and I am having an issue that hopefully I can get some help with.
Is XML like this valid to do in a SOAP message?
<prompt>1 &_lt_; 0? <prompt>It's suppose to represent "1 < 0?"
* the forum formatter seems to eat up my encoded text and transofrms it into acutal "<" so I am placing underscores "_" everywhere to keep the text. so above is actually without underscores
From what I've read I think it is. I have text like this transported as part of the overall SOAP message to my client from the server.
In my code I do:
// Create an instance of the DocumentBuilderFactory
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
// Get the DocumentBuilder from the factory
DocumentBuilder builder = documentFactory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
...inputStream is an InputStream (specifically ByteArrayInputStream) containing the XML.
The issue I am having is that wherever I have an '&' (such as "&_lt_;" or "&_gt_;" or "&" etc...) the parsing seems to get cut off and the rest of the string doesn't seem to get parsed. So the above string "1 &_lt_; 0?" ends up being "1 ".
Also is there an easy way to get back or rebuild the XML into a string from a Document object? I would really like to do that right after I do the parse method and see if the XML data that the Document object has is the same as what's in the inputStream (which is "1 &_lt_; 0?").
Any input you can provide is much appreciated. Thanks,
Latem -
EHP4 - Stack XML file related issue
Hi,
I have the following two issues from DSWP tcode (or solution_manager):
1. From DSWP code -> Change Management -> Maintenance Optimizer, New
Maintenance Transaction and i select the ERP system , then i select the radio button Enhancement Package Installation after which it is showing a drop down from where i can
select EHP4 installation and second drop down i can select support
stack 03. But if i do the same thing again by coming out and going back
in on the same day it is showing only support stack 01, Next day again
for one time it is showing.. --- Why is it like this ?
2. Also after selecting the EHP4 version, support stack 03 it log's on
to the ERP system and it comes out with lot of components from
which if i select some of them and deselect some of them as per our
need, it continues to next screen and confirms the file from download
manager and also the XML file gets's created but unfortunately the XML
file contains all components including the one we deselect because of
which we ended up in doing all shown components last week. We
are in a stage of applying another technical usage and the xml is
created with all the components again. Any idea how to avoid this ?
Thanks,
Murali.Hi,
The problem might be configuration of your system in SMSY transaction ...Because if some componenets you have selected there will come as selected by default...
Moreover go to SAP Note 1134872 - Maintenance Optimizer: FAQ for Stack Delta Files and related sap note to this note which contains problems related to MOPZ and stack xml file..
Thanks
Sunny -
hello all,
i am learning xml file with sap help sample. I have a FM, that change xml-file into if_ixml_parser, but when i wrote the xml " <person status="retired">Walt Whitman</person>" and debug it.
event_sub was 312, <b>event was always initial</b>.
data: event type ref to if_ixml_event,
event_sub type i.
let the parser know which events I am interested in
event_sub = if_ixml_event=>co_event_element_pre2 +
if_ixml_event=>co_event_element_post.
parser->set_event_subscription( events = event_sub ).
do.
event = parser->parse_event( ).
if event is initial.
exit. ' either end reached or error (check below)
endif.
data: str type string.
case event->get_type( ).
when if_ixml_event~co_event_element_pre2.
str = event->get_name( ).
write: '<' str '>'.
when if_ixml_event~co_event_text_post.
str = event->get_value( ).
write: str.
endcase.
enddo.
Thanks for Request.
<a href="http://help.sap.com/saphelp_nwmobile71/helpdata/de/47/b5413acdb62f70e10000000a114084/frameset.htm">sap library - Parsing an XML document event-based</a>
Best regards
ShuoHi,
reference link:
http://help.sap.com/saphelp_nw04/helpdata/en/fd/9d7348389211d596a200a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/bb/576670dca511d4990b00508b6b8b11/content.htm
Please see the PDF document which tells you how to develop with KM API's
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/aef1a890-0201-0010-6faf-8fa094808653
Regards -
JSP XML file parsing XSLT using Xalan
Hi all
I have created an XML file "view_campaign.xml" using JSP as shown in a code below and i wanna know how i should proceed to parse the XML file and so i can display this XML as the XSLT file i created.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%
// Identify a carriage return character for each output line
int iLf = 10;
char cLf = (char)iLf;
// Create a new empty binary file, which will content XML output
File outputFile = new File("C:\\WebContent\\view_campaigns.xml");
//outputFile.createNewFile();
FileWriter outfile = new FileWriter(outputFile);
// the header for XML file
outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
try {
// Define connection string and make a connection to database
//DriverManager.registerDriver (new org.apache.derby.jdbc.ClientDriver());
Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/sample","app","app");
Statement stat = conn.createStatement();
// Create a recordset
ResultSet rset = stat.executeQuery("Select * From campagn");
// Expecting at least one record
if( !rset.next() ) {
throw new IllegalArgumentException("No data found for the campaigns table");
outfile.write("<campaigns>"+cLf);
outfile.write("<campaign>"+cLf);
outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
outfile.write("</campaign>"+cLf);
// Parse our recordset
// Parse our recordset
while(rset.next()) {
outfile.write("<campaign>"+cLf);
outfile.write("<campaign_id>" + rset.getString("campagn_id") +"</campaign_id>"+cLf);
outfile.write("<campaign_name>" + rset.getString("campagn_name") +"</campaign_name>"+cLf);
outfile.write("<campaign_type>" + rset.getString("campagn_type") +"</campaign_type>"+cLf);
outfile.write("<client>" + rset.getString("client_name") +"</client>"+cLf);
outfile.write("<positions>" + rset.getString("positions_nbr") +"</positions>"+cLf);
outfile.write("<begin>" + rset.getString("campagn_beginning_date") +"</begin>"+cLf);
outfile.write("<close>" + rset.getString("campagn_ending_date") +"</close>"+cLf);
outfile.write("</campaign>"+cLf);
outfile.write("</campaigns>"+cLf);
// Everything must be closed
rset.close();
stat.close();
conn.close();
outfile.close();
catch( Exception er ) {
%>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
this is my .XSL file
<?xml version="1.0" encoding="iso-8859-1" ?>
- <!-- DWXMLSource="view_campaigns.xml"
-->
<!DOCTYPE xsl:stylesheet (View Source for full doctype...)>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
- <xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gestion des campagnes</title>
</head>
- <body>
Gestion des campagnes
- <table border="1">
- <tr bgcolor="#9acd32">
<th align="left">Code</th>
<th align="left">Nom</th>
<th align="left">Type</th>
<th align="left">Client</th>
<th align="left">Nombre de positions</th>
<th align="left">Date d'ouverture</th>
<th align="left">Date de cl�ture</th>
</tr>
- <xsl:for-each select="campaigns/campaign">
- <tr>
- <td>
<xsl:value-of select="campaign_id" />
</td>
- <td>
<xsl:value-of select="campaign_name" />
</td>
- <td>
<xsl:value-of select="campaign_type" />
</td>
- <td>
<xsl:value-of select="client" />
</td>
- <td>
<xsl:value-of select="positions" />
</td>
- <td>
<xsl:value-of select="begin" />
</td>
- <td>
<xsl:value-of select="close" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>I would be greatful that u answer my question what i should do have any exemple case study.Hi,
Try this code
JspWriter out = pageContext.getOut(); // Get JSP output writter
javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance(); //Instantiate a TransformerFactory.
String realPath = "c:/applyXsl.xsl";
java.io.File file = new java.io.File(realPath); // crearte a file object for given XSL.
// Use the TransformerFactory to process the stylesheet Source and generate a Transformer.
javax.xml.transform.Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource(file));
java.io.StringReader inputStream = new java.io.StringReader("c:/xmlFile.xml"); // create an input stream for given XML doc
java.io.ByteArrayOutputStream obj = new java.io.ByteArrayOutputStream(); // Create an output stream for XSL applied XML doc.
// 3. Use the Transformer to transform an XML Source and send the output to a Result object.
transformer.transform(new javax.xml.transform.stream.StreamSource(inputStream), new javax.xml.transform.stream.StreamResult(obj));
String outputString = obj.toString(); // get the XSL applied applied XML document for print
out.println(outputString); // print the XSL applied XML in to JSP.
however you need xercesImpl.jar and xml-apis.jar files to run this program.
Regards,
Ananth.P -
Is there some Java package which able me to parse a XML file ?
a method like as:
public Enumeration parseXML(File file);
?????????Yes,
You've the package named: javax.xml.parsers
And you've a class called: javax.xml.parsers.SAXParser
To know more about parsers, java.sun.com/xml
There are many different parsers available based on SAX (Simple API for XML Parsing) and DOM!
-RK. -
XML File Generation Issues using DBMS_XMLGEN
Hi,
I am using DBMS_XMLGEN package in a stored procedure to generate an XML file on Oracle 10 G R2 .But, the problem is the format in which the file is generated.
CREATE OR REPLACE TYPE "state_info" as object (
"@product_type" Number
CREATE OR REPLACE TYPE prod_tab as TABLE OF "state_info";
CREATE OR REPLACE TYPE state_t as object (
"state_code" CHAR(2),
"state_info" prod_tab
CREATE OR REPLACE PROCEDURE get_xml_serviced_state (p_clob OUT clob)
IS
v_xmlctx DBMS_XMLGEN.ctxhandle;
v_str VARCHAR2 (1000);
BEGIN
v_str := 'SELECT state_t(a.st_cd,CAST(MULTISET(select veh_type_id from svcd_st where st_cd =a.st_cd)as prod_tab)) as "state_info"
from svcd_st a where a.st_cd in (select distinct st_cd from svcd_st) group by a.st_cd having count(*)>=1';
v_xmlctx := DBMS_XMLGEN.newcontext (v_str);
DBMS_XMLGEN.setrowsettag (v_xmlctx,'serviced_state');
DBMS_XMLGEN.setrowtag (v_xmlctx,NULL);
p_clob := DBMS_XMLGEN.getxml (v_xmlctx);
printclobout(p_clob);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
RAISE;
END;
SHOW ERRORS
Output :
<serviced_state>
<state_info state_code="VA">
<state_info>
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
</state_info>
<state_info state_code="AB">
<state_info>
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
</state_info>
</serviced_state>
Required it in below format:
<serviced_state>
<state_info state_code="VA">
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
<state_info state_code="AB">
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
</serviced_state>
I just need to put in all the rows under one single tag.Appreciate your early responses.
Thanks.Your wanted XML output is NOT VALID...(try it yourself on http://tools.decisionsoft.com/schemaValidate/)
-
RFC to XML-RFC Parsing issue in RFC Adapter as Sender
Hi all,
I tried to use RFC adapter as a sender. The scenario I am trying to achieve is R3 -> RFC Adapter Sender --> BPM --> RFC Adapter Receiver --> SAP Auto-ID system.
The reason to use two RFC adapter and BPM is to log the request message if the RFC call fails. Everything works as expected, except the RFC Adapter Sender.
The RFC I am calling has an input table. The input data I use works fine if I call it via SE37 or remotely from another SAP system. However, if I call it via RFC adapter, when XI parses the data into RFC-XML format, the input data is all messed up.
DATA: BEGIN OF ID_STR,
ID_VERSION(8) TYPE C,
ID(96) TYPE C,
ELEMENT_NAME(50) TYPE C,
ELEMENT_VALUE(128) TYPE C,
END OF ID_STR.
DATA: it_id LIKE TABLE OF ID_STR,
ls_id LIKE ID_STR.
ls_id-ID_VERSION = 'EPC_1.30'.
ls_id-ID = '30340242206DC3C00000000A'.
ls_id-element_name = 'BATCH_ID'.
ls_id-element_value = 'BATCH001'.
APPEND ls_id TO it_id.
CALL FUNCTION '/AIN/UI_MOBILE_MSG_SEND'
IN BACKGROUND TASK
DESTINATION 'RFC_UPDATEAII'
EXPORTING
IV_BUSINESS_PROCESS = '09'
IV_COMMAND = 'DO'
IV_ACTION_TYPE = 'APL2'
IV_PRT_ID = '31140242200000000F000000'
IV_DEVGRP_EXTID = 'MOBILE'
TABLES
IT_ID = it_id
commit work.
And the parsed RFC-XML message is:
<?xml version="1.0" encoding="UTF-8" ?>
<rfc:_-AIN_-UI_MOBILE_MSG_SEND
xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<IV_ACTION_TYPE>APL2</IV_ACTION_TYPE>
<IV_BTD_EXTID />
<IV_BTD_TYPE />
<IV_BUSINESS_PROCESS>09</IV_BUSINESS_PROCESS>
<IV_COMMAND>DO</IV_COMMAND>
<IV_DEVGRP_EXTID>MOBILE</IV_DEVGRP_EXTID>
<IV_LOC_EXTID />
<IV_LOC_TYPE />
<IV_PRT_ID>31140242200000000F000000</IV_PRT_ID>
<IV_PRT_ID_VERSION />
<IV_REASON_CODE />
<IV_UNAME/>
<ET_RETURN />
<IT_ID>
<item>
<ID_VERSION>EPC_1.30</ID_VERSION>
<ID>206DC3C00000000A BATCH_ID</ID>
<ELEMENT_NAME />
<ELEMENT_VALUE />
</item>
</IT_ID>
</rfc:_-AIN_-UI_MOBILE_MSG_SEND>
You can see the data in the table is all wrong, it should be:
<IT_ID>
<item>
<ID_VERSION>EPC_1.30</ID_VERSION>
<ID>30340242206DC3C00000000A</ID>
<ELEMENT_NAME>BATCH_ID</ELEMENT_NAME>
<ELEMENT_VALUE>BATCH001</ELEMENT_VALUE>
</item>
</IT_ID>
The calling system is a 4.6C non-unicode system, and the destination system is a unicode system (this does not matter since the first part of the integration is between R3 and XI). There is no config found on R3 side to specify non-unicode because it is a rather old system. In XI RFC Adapter config, I checked non-unicode checkbox (I also tested it with this unchecked, but still the same issue).
Have any of you seen this problem and how you resolve it?
Thanks a lot for your help!
Regards,
HartHi Hart
long time no seen - hope you remember me
>The reason to use two RFC adapter and BPM is to log the request message if the RFC call fails
there is an easy way (guess max 3-4 hours) to solve all of your issues
and get rid of a BPM
use IDOC - XI - ABAP Proxy
then you will have IDOC and ABAP Proxy that always log the message on both ends (and you can restart ABAP proxies easily in AII - and every AII supports ABAP proxies) + you get rid of a BPM as it's not necessary as far as I understand (as it's asyn communication right?)
maybe you can go this way and IDOCs always work...
good luck,
Regards,
Michal Krawczyk
http://mypigenie.com XI/PI FAQ -
I wonder if anyone can help.
Pasted below is an standard WSDL file has generated by BPEL Designer. However, XML Spy wont validate it, reporting:
"The file is not valid. Unexpected element 'plnk:PartnerLinkType' in element definitions"
Can anyone help?
many thanks
Vince
<?xml version="1.0"?>
<definitions name="a"
targetNamespace="http://www.a.com"
xmlns:tns="http://www.a.com"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TYPE DEFINITION - List of types participating in this BPEL process
The BPEL Designer will generate default request and response types
but you can define or import any XML Schema type and use them as part
of the message types.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<types>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://www.a.com"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="aRequest">
<complexType>
<sequence>
<element name="input" type="string"/>
</sequence>
</complexType>
</element>
<element name="aResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MESSAGE TYPE DEFINITION - Definition of the message types used as
part of the port type defintions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<message name="aRequestMessage">
<part name="payload" element="tns:aRequest"/>
</message>
<message name="aResponseMessage">
<part name="payload" element="tns:aResponse"/>
</message>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PORT TYPE DEFINITION - A port type groups a set of operations into
a logical service unit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- portType implemented by the a BPEL process -->
<portType name="a">
<operation name="process">
<input message="tns:aRequestMessage" />
<output message="tns:aResponseMessage"/>
</operation>
</portType>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PARTNER LINK TYPE DEFINITION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<plnk:partnerLinkType name="a">
<plnk:role name="aProvider">
<plnk:portType name="tns:a"/>
</plnk:role>
</plnk:partnerLinkType>
</definitions>Alexander,
There is a WSDL tutorial in User Manual of Altova XML Spy Help. Just go through that which gives you an idea of how to generate the WSDL file.
Also go through this weblogs which may give some information:
/people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
/people/siva.maranani/blog/2005/03/01/testing-xi-exposed-web-services
---Satish -
XMLDocument and blank XML tag parse issue
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = false;
xmlDoc.parseXML("<Test> </Test>");
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var processObj:Object = decoder.decodeXML(xmlDoc);
trace( processObj.Test );
Result is comming as 0 instead of a blank space between the tags(<Test> </Test>).Hi,
Here are two possible solutions :
xmlelement("EXCEPTIONS",
xmlforest(
xmlforest(
v1.exception_code as "EXCEPTION_CODE"
, v1.exception_long_desc as "EXCEPTION_LONG_DESC"
) as "EXCEPTION"
)or,
xmlelement("EXCEPTIONS",
case when v1.exception_code is not null
or v1.exception_long_desc is not null
then xmlelement("EXCEPTION",
xmlforest(
v1.exception_code as "EXCEPTION_CODE"
, v1.exception_long_desc as "EXCEPTION_LONG_DESC"
end
) -
Loading JEditorPane from an XML file parsed by
an XSL translator.
the JEditorPane setPage needs a URL, I'm wondering if there is anyway way to have the XSL tool write directly to the JEditorPane?If the XSL translator is producing HTML, and it can be run at the command line and send its output to stdout (as many of them can), then there's an approach to a solution.
JEditorPane has a read() method that takes an InputStream as a parameter. You could use Runtime.getRuntime().exec() to run the XSL translator, then use getInputStream() from the resulting Process object to capture its output, and give that InputStream to JEditorPane.read().
That's an outline of what I would try. Runtime.exec() is a notoriously irritating thing to get working, so it might fail, but you could give it a try. -
"character conversion error" while parsing xml files
Hello,
I'm trying to parse MusicXML (Recordare) files, but I'm getting an exception.
I'm using the SAX parser (javax.xml.parsers.SAXParser).
Here is the code I use to instantiate it:
final javax.xml.parsers.SAXParserFactory saxParserFactory = javax.xml.parsers.SAXParserFactory.newInstance();
final javax.xml.parsers.SAXParser saxParser = saxParserFactory.newSAXParser();
final org.xml.sax.XMLReader parser = saxParser.getXMLReader();
I'm using my own handler, but I get the same exception even if I use org.xml.sax.helpers.DefaultHandler.
The error I get is:
Character conversion error: "Illegal ASCII character, 0xc2" (line number may be too low).
The first few lines of my xml files look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE score-partwise
PUBLIC "-//Recordare//DTD MusicXML 0.6 Partwise//EN"
"http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
[...etc...]
If I delete the <!DOCTYPE ...> line, then I don't get the exception anymore. But the MusicXML files I get (from some other program) always contain this line, and it would be quite some work to delete them from every file manually.
So does anyone know if there is a way to avoid deleting that line in every file, while still being able to parse the xml files without exceptions?
Or maybe does anyone know what the exact cause of the exception is? (because I don't know what exactly causes it)
Thank you in advance.
Greetz,
JipoSo does anyone know if there is a way to avoid
deleting that line in every file, while still being
able to parse the xml files without exceptions?ok this is side-stepping the real problem but I've used this code to filterout DTD references for other reasons public static InputStream filterOutDTDRef(InputStream in) throws IOException {
BufferedReader iniReader = new BufferedReader(new InputStreamReader(in));
StringBuffer newXML = new StringBuffer();
for(String line = iniReader.readLine(); line!=null; line = iniReader.readLine())
newXML.append(line+"\n");
in.close();
int s = newXML.indexOf("<!DOCTYPE ");
if(s!=-1)
newXML.replace(s,newXML.indexOf(">",s)+1,"");
return new ByteArrayInputStream(newXML.toString().getBytes());
}and it actually speeds up the parsing phase too (since the DTD ref.s were on the web and the XML standard mandates that there is a fetch for each xml file parsed..)
you can feed the above into the InputSource constructor that takes an InputStream argument.
Now for the real problem... 0xc2 is "LATIN CAPITAL LETTER A WITH CIRCUMFLEX" according to a unicode chart - which is not an ASCII character (as the error message correctly reports). I'm not sure why the file is being parsed as ASCII though? You could try parsing in a FileReader to the inputsource and hope it picks up the default character encoding of your system, and that that character encoding matches the file. Or you could try passing in a FileReader constructed with a explicit character encoding (eg "UTF8") and see if that does the trick?
asjf -
How to compare after parsing xml file
Hi,
following code, parse the input.xml file, counts how many nodes are there and writes the node name and its value on screen.
1) i am having trouble writing only node name into another file instead of writing to screen.
2) after parsing, i like to compare each node name with another .xsd file for existence.
Please keep in mind that, input.xml is based on some other .xsd and after parsing i have comparing its tag with another .xsd
Need you help guys.
thanks
* CompareTags.java
import java.io.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
/** This class represents short example how to parse XML file,
* get XML nodes values and its values.<br><br>
* It implements method to save XML document to XML file too
public class CompareTags {
private final static String xmlFileName = "C:/input.xml";
int totalelements = 0;
/** Creates a new instance of ParseXMLFile */
public CompareTags() {
// parse XML file -> XML document will be build
Document doc = parseFile(xmlFileName);
// get root node of xml tree structure
Node root = doc.getDocumentElement();
// write node and its child nodes into System.out
System.out.println("Statemend of XML document...");
writeDocumentToOutput(root,0);
System.out.println("totalelements in xyz tag " + totalelements);
System.out.println("... end of statement");
/** Returns element value
* @param elem element (it is XML tag)
* @return Element value otherwise empty String
public final static String getElementValue( Node elem ) {
Node kid;
if( elem != null){
if (elem.hasChildNodes()){
for( kid = elem.getFirstChild(); kid != null; kid = kid.getNextSibling() ){
if( kid.getNodeType() == Node.TEXT_NODE ){
return kid.getNodeValue();
return "";
private String getIndentSpaces(int indent) {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < indent; i++) {
buffer.append(" ");
return buffer.toString();
/** Writes node and all child nodes into System.out
* @param node XML node from from XML tree wrom which will output statement start
* @param indent number of spaces used to indent output
public void writeDocumentToOutput(Node node,int indent) {
// get element name
String nodeName = node.getNodeName();
// get element value
String nodeValue = getElementValue(node);
// get attributes of element
NamedNodeMap attributes = node.getAttributes();
System.out.println(getIndentSpaces(indent) + "NodeName: " + nodeName + ", NodeValue: " + nodeValue);
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
System.out.println(getIndentSpaces(indent + 2) + "AttributeName: " + attribute.getNodeName() + ", attributeValue: " + attribute.getNodeValue());
// write all child nodes recursively
NodeList children = node.getChildNodes();
//int totalelements = 0;
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
// System.out.println("child value.."+child);
if (child.getNodeType() == Node.ELEMENT_NODE) {
writeDocumentToOutput(child,indent + 2);
if(node.getNodeName() == "DATA"){
totalelements = totalelements+1;}
//System.out.println("totalelements in DATA tag " + totalelements);
/** Parses XML file and returns XML document.
* @param fileName XML file to parse
* @return XML document or <B>null</B> if error occured
public Document parseFile(String fileName) {
System.out.println("Parsing XML file... " + fileName);
DocumentBuilder docBuilder;
Document doc = null;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setIgnoringElementContentWhitespace(true);
try {
docBuilder = docBuilderFactory.newDocumentBuilder();
catch (ParserConfigurationException e) {
System.out.println("Wrong parser configuration: " + e.getMessage());
return null;
File sourceFile = new File(fileName);
try {
doc = docBuilder.parse(sourceFile);
catch (SAXException e) {
System.out.println("Wrong XML file structure: " + e.getMessage());
return null;
catch (IOException e) {
System.out.println("Could not read source file: " + e.getMessage());
System.out.println("XML file parsed");
return doc;
/** Starts XML parsing example
* @param args the command line arguments
public static void main(String[] args) {
new CompareTags();
}hi,
check out the following links
Check this blog to extract from XML:
/people/kamaljeet.kharbanda/blog/2005/09/16/xi-bi-integration
http://help.sap.com/saphelp_nw04/helpdata/en/fe/65d03b3f34d172e10000000a11402f/frameset.htm
Check thi link for Extract from any DB:
http://help.sap.com/saphelp_nw04s/helpdata/en/58/54f9c1562d104c9465dabd816f3f24/content.htm
regards
harikrishna N -
Place contents of xml file to 2D array
i have a xml file like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "map.dtd">
<map width="5" height="5" goal="6" name="Hallways of Dooom">
<random-item type='lantern' amount='5' />
<random-item type='health' amount='10' />
<tile x="1" y="0" type="floor">
<renderhint>floor:wood</renderhint>
</tile>
<tile x="0" y="1" type="wall" />
<tile x="1" y="1" type="floor" startlocation="1" />
<tile x="3" y="1" type="floor">
<item type="treasure">Bar of Silver</item>
<renderhint>floor:stone,blood</renderhint>
</tile>
</map>i was asked to creat a 5*5 2D array from it. each tile represents a position on the point. If the type of tile is wall, it is represented by number 2; if it is floor, it is represented by number 1.
i have written my code as following:
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.io.*;
public class parsexml
public void parseXML()
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
try {
DocumentBuilder parser = factory.newDocumentBuilder();
Document doc = parser.parse(new File("hallways.xml"));
System.out.println("XML file parsed.");
processTree(doc);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
public void processTree(Document doc)
int column = 0;
int row = 0;
int hori = 0;
int vert = 0;
String Type = "";
Node element = doc.getDocumentElement();
NamedNodeMap attrs = element.getAttributes();
for (int i = 0; i < attrs.getLength(); i++) {
Node attr = attrs.item(i);
String attrName = attr.getNodeName();
if (attrName == "width") {
column = Integer.parseInt(attr.getNodeValue());
if (attrName == "height") {
row = Integer.parseInt(attr.getNodeValue());
int[][] map = new int[row][column];
NodeList children = element.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
String nodeName = child.getNodeName();
if (nodeName == "tile") {
NamedNodeMap attributes = child.getAttributes();
for (int a = 0; a < attributes.getLength(); a++) {
Node attribute = attributes.item(a);
String attributeName = attribute.getNodeName();
if (attributeName == "x") {
hori = Integer.parseInt(attribute.getNodeValue());
if (attributeName == "y") {
vert = Integer.parseInt(attribute.getNodeValue());
if (attributeName == "type") {
Type = attribute.getNodeValue();
if (Type == "floor") {
map[hori][vert] = 1;
} else if (Type == "wall") {
map[hori][vert] = 2;
print(map);
public void print(int[][] map)
for (int r = 0; r < map.length; r++) {
for (int c = 0; c < map[r].length; c++) {
System.out.print(map[r][c]);
System.out.println();
public static void main(String[] args)
parsexml xml = new parsexml();
xml.parseXML();
}When i run the program, i found it doesn't fills the spcified position on the array. all I get is a 5*5 grid of 0s.
Can anyone tells me why? thank you in advance.Unless someone is willing to put in the time to do your job for you, you'll have to debug it yourself. Put in some debugging statements. In their simplest form this is just a bunch of System.out.println("your message here") calls where you put in messages describing the current point of execution (like what method you just started or are about to finish) and the values of relevant data (such as method parameters, loop indices, whatever you feel is important).
Then run the program and see what it tells you. -
Convert xml file to a 2D list - Urgent!!!
I have a xml file like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "map.dtd">
<map width="5" height="3" goal="6" name="Hallways of Dooom">
<random-item type='lantern' amount='5' />
<random-item type='health' amount='10' />
<tile x="1" y="0" type="floor">
<renderhint>floor:wood</renderhint>
</tile>
<tile x="0" y="1" type="floor" />
<tile x="1" y="1" type="floor" startlocation="1" />
<tile x="2" y="0" type="wall" />
<tile x="3" y="0" type="wall" />
<tile x="3" y="1" type="floor">
<item type="treasure">Bar of Silver</item>
<renderhint>floor:stone,blood</renderhint>
</tile>
</map>and i want to convert it to a 2D list, with the x-value of the list is the width of the map and the y-value of the list is the height of the map. The x and y value in the tile indicates the position of the point.
i have already parse the xml file to java using:
public class parsexml
public static void main(String[] args)
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
try {
DocumentBuilder parser = factory.newDocumentBuilder();
Document doc = parser.parse(new File("hallways.xml"));
System.out.println("XML file parsed.");
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}Can anyone give me any hint on what to do next. Thank you very much.mujingyue wrote:
Thank you for your poem, it is the hightlight of my miserable day.
but, any suggestions?Sure....
You play tricks on my mind
You're everywhere but you're so hard to find
You're not warm or sentimental
You're so extreme, you can be so temperamental
But I'm not looking for a love that will last
[ Urgent song text brought to you by LyricsYouLove ]
I know what I need and I need it fast
Yeah, there's one thing in common that we both share
That's a need for for each other anytime, anywhere
It gets so urgent
So urgent
You know it's urgent
I wanna tell you it's the same for me
So oh oh urgent
Just you wait and see
How urgent our love can be
It's urgent
You say it's urgent
Make it fast, make it urgent
Do it quick, do it urgent
Gotta rush, make it urgent
Want it quick
Urgent, urgent, emergency
Urgent, urgent, emergency
Urgent, urgent, emergency
Urgent, urgent, emergency
So urgent, emergency
Emer... emer... emer...
It's urgent
Maybe you are looking for
-
Error while opening Oracle Form
Dear All, Presently I am using Oracle R12.1.1 on Windows XP SP2 - Operating System. Now when I am opening any form within any application within Oracle I am getting the below error. FRM -92050: Failed to connect to the Server: /forms/lservlet:-1 Kind
-
How can I store my music files on an external hard drive and listen to them through iTunes that way? At the moment they're both on the external hard drive and also stored on the computer but I'm quickly running out of memory on my iBook G4 so I'd lik
-
Connecting oracle dev 2000 forms to oracle 9i database on another server
we have these oracle developer 2000 forms (in .fmx format) in a server and the data of these forms in another server.... the server with the data is very old and is very slow...so we decided to relocate the database(oracle 9i) to a new server..... al
-
How to create a new user over HTTPS
Hi. I have set up conf.xml and web.xml so that when the user accesses a page in the secure area of the website, then they are taken to a login page where they enter their username and password and the form calls j_security_check on the server. All th
-
SCC file quirks when viewed in Apple DVD Player
Greetings all, I have a bunch of DVDs with closed captioning that I am implementing by importing scc files. Everything works fine and looks gereat on set top players and even most software players running Windows. However, on the Mac running Apple DV