Mapping xml values
Hi, i joined as a developer and i got one new task like.
In application we have one dropdown. beside the dropdown we have to put one disable and enable operations using (+ and -). if we click on '+', dropdown will be disable and textbox should be displayed.and if click on
' - ',dropdown will be enable and textbox should be disbld. whatever the user entered in text box(example 123Simple) that should be mapped in xml like 123/simple.please help me how to hardcode in java(struts action and xml) and their mappings
waiting for the reply,
thanking you.
chk this:
input will be : var1
execution type All values of a context
int a = var1.length;
String b="";
for(int i=0;i<a;i++)
b =b +var1<i> + ";";
int c=b.length();
String output =b.substring(0,c-1)
result.addValue(output);
date-UDF--dates
Similar Messages
-
Issue with mapping XML to Java using SAX API
I am using SAX API to Map XML Documents To Java. Is it possible to differentiate the elements based on the attribute rather than localname or element name in SAX API? because I am having the below xml structure. In SAX API we are processing the element values based on start/End Element name.
<?xml version="1.0" encoding="UTF-8"?>
<response>
<result name="response">
<doc>
<str name="art_id">192201910</str>
<str name="title">test</str>
<arr name="author">
<str>Darrell Dunn</str>
<str>William </str>
</arr>
<arr name="tax">
<str>113243335</str>
<str>233454666</str>
</arr>
</doc>
<doc>
<str name="art_id">192201911</str>
<str name="title">test2</str>
<arr name="author">
<str>Darrell Dunn1</str>
<str>William 1</str>
</arr>
</doc>
</result>
</response>
I want to map the elements based on attributes such as
classobj.art_id, classobj.title, classobj.tax[]. I have wriiten code below, but I am not getting the proper result.
import org.xml.sax.;
import org.xml.sax.helpers.;
import java.io.;
import java.util.;
import common.;
public class XmltoObjectHandler extends DefaultHandler{
/* Creates a new instance of XmltoObjectHandler */
public XmltoObjectHandler() {
// Local SolrDocument object to collect
// document XML data.
private XmlDocument doc = new XmlDocument();
// Local list of solr documents items...
private Vector xmlDocuments = new Vector();
// Local current solr document reference...
private XmlDocument currentSolrDoc;
// Buffer for collecting data from
// the "characters" SAX event.
private CharArrayWriter contents = new CharArrayWriter();
// Override methods of the DefaultHandler class
// to gain notification of SAX Events.
// See org.xml.sax.ContentHandler for all available events.
public void startElement( String namespaceURI,
String localName,
String qName,
Attributes attr ) throws SAXException {
if ( localName.equals( "doc" ) ) {
currentXmlDoc = new XmlDocument();
solrDocuments.addElement( currentSolrDoc );
if( localName.equals("str"){
for ( int i = 0; i < attr.getLength(); i++ ){
if("art_id".equals(attr.getValue(i))){
currentSolrDoc.art_id = contents.toString();
if("title".equals(attr.getValue(i))){
currentSolrDoc.title = contents.toString();
public void endElement( String namespaceURI,
String localName,
String qName ) throws SAXException {
public void characters( char[] ch, int start, int length )
throws SAXException {
contents.write( ch, start, length );
public Vector getxmlDocuments() {
return solrDocuments;
public static void main( String[] argv ){
System.out.println( "Example4:" );
try {
// Create SAX 2 parser...
XMLReader xr = XMLReaderFactory.createXMLReader();
// Set the ContentHandler...
XmltoObjectHandler ex4 = new XmltoObjectHandler();
xr.setContentHandler( ex4 );
// Parse the file...
xr.parse( new InputSource(new FileReader( "xmlfile.xml" )));
// Display all documents items...
XmlDocument i;
Vector items = ex4.getxmlDocument();
Enumeration e = items.elements();
while( e.hasMoreElements()){
i = (XmlDocument) e.nextElement();
System.out.println(i.art_id+"\n");
System.out.println(i.title+"\n");
}catch ( Exception e ) {
e.printStackTrace();
Can anybody help me how to process this type of xml. Is there any other way we can do this? I am trying for two days. It is a big deadlock for me. any help greatly appriciated. Thanks in advance.I added my code inside code tags...
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.io.*;
import java.util.*;
import common.*;
public class XmltoObjectHandler extends DefaultHandler{
/** Creates a new instance of XmltoObjectHandler */
public XmltoObjectHandler() {
// Local SolrDocument object to collect
// document XML data.
private XmlDocument doc = new XmlDocument();
// Local list of solr documents items...
private Vector xmlDocuments = new Vector();
// Local current solr document reference...
private XmlDocument currentSolrDoc;
// Buffer for collecting data from
// the "characters" SAX event.
private CharArrayWriter contents = new CharArrayWriter();
// Override methods of the DefaultHandler class
// to gain notification of SAX Events.
// See org.xml.sax.ContentHandler for all available events.
public void startElement( String namespaceURI,
String localName,
String qName,
Attributes attr ) throws SAXException {
if ( localName.equals( "doc" ) ) {
currentXmlDoc = new XmlDocument();
solrDocuments.addElement( currentSolrDoc );
if( localName.equals("str"){
for ( int i = 0; i < attr.getLength(); i++ ){
if("art_id".equals(attr.getValue(i))){
currentSolrDoc.art_id = contents.toString();
if("title".equals(attr.getValue(i))){
currentSolrDoc.title = contents.toString();
public void endElement( String namespaceURI,
String localName,
String qName ) throws SAXException {
public void characters( char[] ch, int start, int length )
throws SAXException {
contents.write( ch, start, length );
public Vector getxmlDocuments() {
return solrDocuments;
public static void main( String[] argv ){
System.out.println( "Example4:" );
try {
// Create SAX 2 parser...
XMLReader xr = XMLReaderFactory.createXMLReader();
// Set the ContentHandler...
XmltoObjectHandler ex4 = new XmltoObjectHandler();
xr.setContentHandler( ex4 );
// Parse the file...
xr.parse( new InputSource(new FileReader( "xmlfile.xml" )));
// Display all documents items...
XmlDocument i;
Vector items = ex4.getxmlDocument();
Enumeration e = items.elements();
while( e.hasMoreElements()){
i = (XmlDocument) e.nextElement();
System.out.println(i.art_id+"\n");
System.out.println(i.title+"\n");
}catch ( Exception e ) {
e.printStackTrace();
} -
How to map XML File input to VO (eventually to update table) upon fileupld
Reqirement: I am downloading an XML File (basically name-value pair) from user using OAMessageFileUploadBean. I need to take this file and update to an existing record in the table (cs_incidents_all). XML File schema is well-known in advance.
Approach: Don't know what is the best, but I'm thinking if there is an OAF way to map the XML File (Blobdomain) to VO and get the rowIMPL.getColumn1Value to fetch all the datavalues then loop thru all the columns (xml-tags) and finally call plsql APIs which will update/insert into table (cs_incidents_all)
Is this possible in OAF? If so please shed some light as to how to map XML File to VO.
If this is not possible then please let me know the other way. I have to do this inside the oaf.
Thank you,Can someone please let me know if this is possible in OAF?
-
Mapping the values of a Map as Transformation
Hi,
Is it possible to map the value of a (Java) Map with a transformation? The values in my Map are arbitrary object hierarchies, and I want to transform them to XML using XStream before they're put to a CLOB field in the database, and vice versa.
Thanks!And I'm using 10g Release 3 (10.1.3)
-
Hi EveryBody
i have my applications-mapping.xml file already in the applib directory, but when i try to conect to a remote ejb i had this error[b]
FILE not found error: j2ee/home/applib/applications-mapping.xml (No such file or directory)
can anyone help??gday
Is the error on the client or server?
What role in the application does applications-mapping.xml fulfill?
How are you loading the file in?
-steve- -
Its illegal to assign a XML value directly to the messageType variable
I was recently working in JDeveloper 11g (11.1.1.7.0) on an internal SOA project making some changes in the BPEL and noticed this message: Error(172): its illegal to assign a XML value directly to the messageType variable "InvokeFetchUpdatedUserId_FetchUpdatedUserID_InputVariable" I searched for this error message and didn't find anything. The message is somewhat explanatory but I thought I would post the fix here just in case. I modified my assign from the following: To this making sure to assign it to the underlying entity. Then it compiled just fine. Thanks, Tom
In case if you are returning multiple value or with multiple columns then you have to use record or cursor to do that operation.
satyaki>
satyaki>ed
Wrote file afiedt.buf
1 declare
2 cursor c1
3 is
4 select *
5 from emp;
6 r1 c1%rowtype;
7 begin
8 for r1 in c1
9 loop
10 dbms_output.put_line(r1.empno||' - '||r1.ename);
11 end loop;
12* end;
13 /
7521 - WARD
7654 - MARTIN
7788 - SCOTT
7839 - KING
7844 - TURNER
7876 - ADAMS
7900 - JAMES
7902 - FORD
7934 - MILLER
7566 - Smith
7698 - Glen
1 - boock
PL/SQL procedure successfully completed.
Elapsed: 00:00:01.02
satyaki>
satyaki>
satyaki>Regards.
Satyaki De. -
Problem in mapping xml data with header details from IPM 11g to BPEL
Hi,
I want to map xml data as a supporting content from IPM application to BPEL.
My xml is
<?xml version="1.0" encoding="utf-8"?>
<DocumentFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/Document.xsd">
<Document DocumentType="Invoice">
<DocumentImage>
<Filename>\\10.205.0.209\Img\10883212.TIF</Filename>
</DocumentImage>
</DocumentFile>
If I remove header details from root element <DocumentFile> i.e. modified xml is
<DocumentFile>
<Document DocumentType="Invoice">
<DocumentImage>
<Filename>\\10.205.0.209\Img\10883212.TIF</Filename>
</DocumentImage>
</DocumentFile>
it works fine but i need to pass header details as well.
Please suggest.
Thanks,
PriyaHi Naveen,
In sxmb_moni the content transmitted to the adapter(RFC)is as follows
<?xml version="1.0" encoding="UTF-8" ?>
- <ns:ZRFID_EQUIP xmlns:ns="urn:sap-com:document:sap:rfc:functions">
- <RECORDS>
- <item>
<FLOC>f1-01-01</FLOC>
<RFID_NO>I006</RFID_NO>
</item>
- <item>
<FLOC>f1-01-02</FLOC>
<RFID_NO>I002</RFID_NO>
</item>
- <item>
<FLOC>f1-01-03</FLOC>
<RFID_NO>I003</RFID_NO>
</item>
- <item>
<FLOC>f1-01-04</FLOC>
<RFID_NO>I004</RFID_NO>
</item>
- <item>
<FLOC>f1-01-05</FLOC>
<RFID_NO>I005</RFID_NO>
</item>
- <item>
<FLOC>f1-01-06</FLOC>
<RFID_NO>I001</RFID_NO>
</item>
</RECORDS>
</ns:ZRFID_EQUIP>
At r/3 side the field floc and rfid_no gets mapped to floc which is of char30
eg floc=f1-01-01I006
rfid_no= -
Mapping input values for a web service connection to a range of cells
I've created a web service connection in Xcelsius data manager. My web service requires an array of integer as input parameter. How do I map input values for a web service connection to read from a range of cells in the spreadsheet, e.g. $A$2:$A$20, in similar way of mapping output values to write to a range of cells in the spreadsheet?
For output values of the web service, I can specify to map the output values to write to a range of cells. However, it doesn't seem to work for reading the input values.
I can map input values for each node to a single cell, e.g. $A$2, in the spreadsheet. However, when I set the "Read From" field to a range of cells, e.g. $A$2:$A$20, it only reads in the first value in the range.
Is there any way that we can do this mapping for input values as we do for output values?
Your assistance is very much appreciated.
Regards,
VanVan,
There is a workaround for that...
Example:
My Webservice accepts input data range in a specific format with " :" symbol, i.e. 072008:082008
Now what i do is
A1 = 072008
A2 = 082008
A3 = CONCATENATE(A1,":",A2)
so A3 = 072008:082008
Now i map the input value in web service to cell A3
P.S have 2 input box components and map it to cells A1 and A2, i.e you are giving users an option to enter the range of values...then web service will capture the range and refreshes data with the range of values user entered.
hope this helps..
-Anil -
Problem in Creating .wsdl file and mapping.xml with ant
hi
i am created my .wsdl file and mapping.xml file with wscompile tool but when i run this by ant tool it show a problem.
the command runs on command prompt but when run throught ant file it shows a following error :-
Execute failed: java.io.IOException: CreateProces: wscompile -define -mapping build\classes\META-INF\mapping.xml -d . -nd build\.................and so on
so if anybody have any idea then plz help me asap
thanxThe following Ant snippet is the way I've defined my wscompile task. I'm creating a web application and it looks like yours might be an EJB endpoint, but you can adjust where necessary:
<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile">
<classpath refid="compile.classpath" />
</taskdef>
<target name="init">
<echo message="-------- ${appname} --------" />
</target>
<!-- This target compiles the server components using an existing WSDL as the driving document.
The configuration file must use the <wsdl> element giving the location (local file system
or URL) of the WSDL document.
Note: the fork argument is needed to over come a bug when using the mapping argument. See
http://forum.java.sun.com/thread.jspa?threadID=592994&tstart=0
-->
<target name="generate-server-from-WSDL" depends="init">
<wscompile fork="yes"
keep="true"
base="${basedir}/WebContent/WEB-INF/classes"
import="true"
features="wsi"
xPrintStackTrace="true"
verbose="true"
mapping="${basedir}/WebContent/WEB-INF/jaxrpc-mapping.xml"
sourcebase="${basedir}/src"
config="${config.server.doclit.file}">
<classpath>
<path refid="compile.classpath" />
</classpath>
</wscompile>
</target>
<target name="compile-server-from-WSDL" depends="generate-server-from-WSDL">
<javac srcdir="${basedir}/src" destdir="${basedir}/WebContent/WEB-INF/classes" debug="${compile.debug}">
<classpath refid="compile.classpath" />
</javac>
</target>Just make sure that the named destination directories exist before you run the script.
If you'd like more details on the wscompile Ant task, I found the following pages invaluable:
https://jax-rpc.dev.java.net/whitepaper/1.1/index-part1.html -
How to fix iframe issue that displays XML values instead of formatted XML in IE11
The following sub.jsp file shows the formatted XML properly as expected when is opened directly:
<% response.setContentType("text/xml"); %>
<book>
<chapter1>chapter 1</chapter1>
<chapter2>chapter 2</chapter2>
</book>
IE11 shows the result as below which are colored and can be collapsed or un-collapsed:
<book><chapter1>chapter 1</chapter1><chapter2>chapter 2</chapter2></book>
But if the sub.jsp is opened in an iframe from the below main.html, it only shows the values of the XML in the iframe:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<iframe src="sub.jsp"></iframe>
</body>
</html>
The iframe shows only the XML values, i.e., chapter 1 chapter 2 in IE11. This issue does not happen in IE8.
I appreciate to your if you know how to address this issue.
Regards, AmirThe following sub.jsp file shows the formatted XML properly as expected when is opened directly:
<% response.setContentType("text/xml"); %>
<book>
<chapter1>chapter 1</chapter1>
<chapter2>chapter 2</chapter2>
</book>
IE11 shows the result as below which are colored and can be collapsed or un-collapsed:
<book><chapter1>chapter 1</chapter1><chapter2>chapter 2</chapter2></book>
But if the sub.jsp is opened in an iframe from the below main.html, it only shows the values of the XML in the iframe:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<iframe src="sub.jsp"></iframe>
</body>
</html>
The iframe shows only the XML values, i.e., chapter 1 chapter 2 in IE11. This issue does not happen in IE8.
I appreciate to your if you know how to address this issue.
This issue is also posted at below link:
https://social.msdn.microsoft.com/Forums/en-US/5b0692b4-d312-4797-9089-42c1029ac059/how-to-fix-iframe-issue-that-displays-xml-values-instead-of-formatted-xml-in-ie11?forum=iewebdevelopment
Regards, Amir -
Response Payload (Mapped XML) in SXMB_MONI
Hi,
I found many posts with the same question and but couldn't get an answer
Posting it again!
I can find the request and response( XML after mapping) if it is a X - IDoc scenario. But for IDoc - X scenarios I can find only the request payload which is the IDoc XML not the mapped XML.
Is there any way I can get the mapped XML also in SXMB_MONI?
Could you throw some light towards where these XML is stored in J2EE engine?
Regards,
AnishHi,
In the SXMB_MONI I get only 3 menus
Inbound Message(CENTRAL)
-SOAP Header
-SOAP Body
- Payloads
Receiver Grouping
-SOAP Header
-SOAP Body
- Payloads
Response
-SOAP Header
-SOAP Body
Payloads option is not there in the last menu and I need that payload XML and that too in the Runtime.
Any help on the same?
Regards,
Anish -
How to map column value (in table cell)
Hi,
My table, say product, has 'status' field (varchar(1))
status = 0 -- unavailable product
status = 1 -- avaialble product
I want to map this value into readable 'available/unavailable'
(a combo box cell editor) when I manipulate table cell (insert/search/modify)
and status field correctly mapped into '0', '1'.
Thanks,
Tuanrepost
-
Inheritance of mapping xml files?
How can one use inheritance (or other technique) to generate mapping files to be bundled with common components that are shared among several departments/projects. The original map (XML) would be distributed in a jar file with the classes. The idea is that the other people might want to extend components but don't want to have to map all of the objects again. Just want to add some new methods.
Currently for coherent use of the MW, objects that inherit mappings must be in the same project (mapping file). This means that the common mapping file would need to be used as a starting point for the different components, and amendment methods/code APIs would have to be used at deployment by each of the components to modify the project according to their needs.
HTH,
-Mike -
Convert XML values to internal table
Hi Experts
How can i convert XML values to internal table . i am getting all the values into the string.
this is my example
<?xml version="1.0" encoding="UTF-8"?><TEST><ZTEST><DEPTNO>HEADOFFICE</DEPTNO><DNAME>IT</DNAME><LOC>HYD</LOC><MANDT>003</MANDT></ZTEST></TEST>
i did create internal table with 4 fields.
Please help.XML DOM Processing in ABAP part I - Convert an ABAP table into XML file using SAP DOM Approach.
-
Mapping XML to Existing Objects
In Castor I can defined how I want to map existing XML to an existing (not auto-generated) object. Can I do the same in JAXB? I have searched the JAXB documentation, but haven't found a way to map XML to Java without having JAXB generate the Java classes from a schema.
http://castor.exolab.org/xml-mapping.html
-- JohnPerhaps JSR 222 will address this issue?
http://www.jcp.org/en/jsr/detail?id=222
-- John
Maybe you are looking for
-
N95 - Infrared Process Runs in Background Flatteni...
After running the infrared to sync Outlook and removing the phone it eventyally stopps the infrared connection (well so it would seam untill)... The N95 then continues to heat up and eventually flattens the battery. I can only presume that the infrar
-
Newbe Question: How to get the Workflow Name to a WS* number?
Hi All Just a short question: I have a whole bunch of WS9*** numbers and now I am supposed to find the corresponding WorkFlows in a system (from a business perspective). The problem is that I have no clue on how to do this as I am reale new to WorkFl
-
Hello, I have had success with cutting and pasting Behaviors but not Properties. Is it possible to cut and paste Property parameters (Transform - Position, rotation, etc.)? And if so, how? Thanks, Ines
-
Can i run java program in the same way of .exe program?
I am beginner in java and i'd like to know that java program can run in the same of .exe program(double click program icon) , instead of typing "java [class name]" or choose execute botton from forteCE. Thank you for your help [email protected]
-
Firefox has application/x support but Safari does not
Why does the Firefox browser for Mac have a plugin that handles "application/x-oleobject" content such as that found at the CBSnews.com web site, but Safari does not. Cann't Apple stay up to date with this MS MIME type?