How to loop through many XML messages and parse them ?
Hi All
I have been trying very hard to loop through many XML messages and process each of them. Let me first explain the problem -
Suppose I have the following String -
<xyz>
<abc>happy</abc>
</xyz>
<xyz>
<abc>new</abc>
<xyz>
<xyz>
<abc>year</abc>
</xyz>
I have to process each message within the <xyz></xyz> tag and find the falue of <abc> element (happy, new and year).
The extraction of <abc> value is very simple, I am using SAX parser's startElement() method to check every element's name and if the element's name is <abc> pick up the value. But I am not able to loop through the different messages within the <xyz></xyz> tag.
I am thinking of using another DOM parser -
DOMParser domParser = new DOMParser();
StringReader rdr = new StringReader(inputXML);
InputSource src = new InputSource(rdr);
domParser.parse(src);
Document doc = domParser.getDocument();
NodeList nodeList = doc.getElementsByTagName("xyz");
Now I can loop through this nodeList, but not able to. Is using the DOM parser and NodeList the preferable way of lopping through the messages, then how I can loop through ? Or is there any other way ?
I have been trying on this for quite a few days, but not able to. Can you please help me out ?
Thanking you in advance ....
Nirmalya Sinha
Hi,
Try using the SAX reader from the dom4j package. The document object that you receive contains methods for getting the root elements and with that you can traverse down to the sub elements of it.
Hope this was of some help.
Similar Messages
-
How to loop through Multiple Excel sheets and load them into a SQL Table?
Hi ,
I am having 1 excel sheet with 3 worksheet.
I have configured using For each loop container and ADO.net rowset enumerator.
Every thing is fine, but after running my package I am getting below error
[Excel Source [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may
be error messages posted before this with more information on why the AcquireConnection method call failed.
Warning: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (5) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified
in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
[Connection manager "Excel Connection Manager"] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by
another user, or you need permission to view and write its data.".
Pleas suggest me the correct way of solving above issues.
Thanks in advance :)
regards,
Vipin jha
Thankx & regards, Vipin jha MCPHi ,
Please refer the below link for Looping multiple worksheet in a single SQL Table.
http://www.singhvikash.in/2012/11/ssis-how-to-loop-through-multiple-excel.html
Note:-If you using excel 2010 then you have to use EXCEL 12.0 .
Above link explaining step by step of Looping multiple worksheet in a single SQL Table.
regards,
Vipin jha
Thankx & regards, Vipin jha MCP -
How to loop through single XML File and send multiple RFC calls?
I am looking for the best approach to use for making multiple RFC calls (can be sequential) using a single XML file of data. I have been attempting to get a BPM loop working, but to no avail. My RFC only accepts a single set of delivery input and I have been told to try to work with it as is.
input xml sample:
<?xml version="1.0" encoding="UTF-8"?>
<ProofOfDelivery>
<POD>
<delivery_number>1</delivery_number>
<carrier_name>UPS</carrier_name>
</POD>
<POD>
<delivery_number>2</delivery_number>
<carrier_name>UPS</carrier_name>
</POD>
</ProofOfDelivery>
I need to make a synchronous RFC call for each set of POD data.
Thanks in advance!Thanks for the inputs.
I tried with a BPM and multi-mapping transformation before a ForEach block. I am getting this error:
Work item 000000028028: Object FLOWITEM method EXECUTE cannot be executed
Error during result processing of work item 000000028029
com/sap/xi/tf/_ProofOfDeliveryMultiMapping_com.sap.aii.utilxi.misc.api.BaseRuntimeExceptionRuntim
Error: Exception CX_MERGE_SPLIT occurred (program: CL_MERGE_SPLIT_SERVICE========CP, include: CL_
Probably because I am not making/using the container objects properly. Here is a screenshot of my BPM. Can anyone spot my issue or point me to an example on this sort of container use?
[http://kdwendel.brinkster.net/images/bpm.jpg|http://kdwendel.brinkster.net/images/bpm.jpg]
Thanks -
I have an iphone 4, how do I take stored voice messages and record them to a stick?
I have an iphone 4, how do I take stored voice messages and record them to a stick? A family member passed away and I want to keep their voice.
Hey there!
Sadly, there is no way to do this.
I'm sad to hear you've lost a familymember.
Try this: Move in a quiet-room. Play his/her voice over speaker of your iphone and record it with free recording-softwarefor windows or mac.
Hope this will help you keeping the memory. -
Testcase, how to split up an xml message and call a BPEL process.
Another question.
Considering the following XML message.
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row>
<id>10</id>
<naam>A</naam>
</row>
<row>
<id>20</id>
<naam>B</naam>
</row>
</rows>
An input message can consist of 1 to about 20000 <row></row> elements. I would like to split up this message into individual <row></row> and call a BPEL process for further processing.
I've tried to use the file adapters feature "Files contain Multiple Messages" Publish Messages in batches of.." This did not work. ( root element expected exceptions ).
I've also tried to invoke an extra async routing service with a mapping which removes the root element. This also doesn't work as it leaves the following ( incorrect ) xml message at the end.
<row>
<id>10</id>
<naam>A</naam>
</row>
<row>
<id>20</id>
<naam>B</naam>
</row>
Which is logical considering how an XSL transformation works.
Is there any way to achieve this?
Any help is appreciated!You shoul create a while loop, that loops through XML payload for each row. Than you can process each individual row. See also example:
C:\orabpel\samples\tutorials\112.Arrays\ArraySample.bpel -
I got this really great script that loops through some XML files and does stuff based off the content.
What I would like to do now is have it repeat when it gets to a certain field. for example my xml file would look like this.
<xml>
<fileName>nameoffile</fileName>
<userEmail>[email protected]</userEmail>
<commandList>
<item>info here</item>
<item>more info here</item>
<item>yet more info</item>
<item>still more info here</item>
</commandList>
</xml>
then basically i need the applescript to see the <commandList> tag and then repeat for each item.
i can't seem to wrap my head around how to get it to happen.
currently I am using this to extract the normal tags from the xml file
set theXML to choose file
tell application "System Events"
tell XML element 1 of contents of XML file theXML
set the fileName to value of (XML elements whose name is "fileName")
... and so on
end tell
end tell
i believe i have to put an if statment in saying that if the element name == "commandList" then
repeat with item in commandList
my stuff here.
end repeat
but i'm not sure how to build the statement.
thanks for any help.
PSomething like this?
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
set theXML to POSIX path of (choose file)
tell application "System Events"
tell XML element 1 of contents of XML file theXML -- root element
set the fileName to value of XML element "fileName"
get value of XML elements of XML element "commandList" -- sub elements
repeat with anItem in the result
log anItem
end repeat
end tell
end tell
</pre> -
How to Loop through App and finding popup Windows
Does anyone know how to loop through the app and find any
popup windows..I guess application by default creates a SystemManager
object... So i used
this.systemManager.popUpChildren.numChildren and it gives me
0 all the time.. even though I have instances of windows to the
app.. According to the documentation this should give you the
number of popup children but it doesn't.. Any more ideas? -
How to loop through a collection of records which is return value of func.
Hi all.
Have this situation:
- Stored function (member of pkg procedure) that returns a collection of records.
Package Spec:
=========
type tipo_pvt is table of s08_plan_venta_totalizado_r % rowtype;
rc_pvt tipo_pvt;
(s08_plan_venta_totalizado_r is a view).
Package Body:
=========
select col1
,col2
,etc
bulk collect into rc_pvt
from s08_lista_precio_producto_r lpp
,s03_producto_r prd
where condition;
return rc_pvt;
Once collection is loaded and returned (i know it loads records). I just want to loop through every record on a pl/sql procedure on the client (forms6i procedure), but it gives me the error: ORA-06531 Reference to uninitialized collection:
On the forms6i client procedure i have something like:
procedure p_carga_plan_venta_inv (p_id_plan_venta in number) is
v_contador integer;
v_mensaje varchar2(10);
rc_pvt sk08_gestiona_plan_venta.tipo_pvt; (sk08_gestiona_plan_venta is package name)
begin
rc_pvt := sk08_gestiona_plan_venta.tipo_pvt();
rc_pvt := sk08_gestiona_plan_venta.f_genera_plan_venta_inv (:pvv.lip_id_lista_precio
,:pvv.ems_id_sucursal
,:control4.v_metodo_calculo
,:pvv.unm_co_unidad_monetaria
,:pvp.fe_fin_periodo) ;
-- previous statement dos not fail BUT THIS:
message('rc_pvt.count= '||rc_pvt.count);pause;
DOES FAIL
end;
So my question is : since i have already returned the collection, how come is not initialized....?
Do i have to extend it first? In this case i have to return the number of records in the collection.....
Look what happen when done from sqlplus:
declare
rc_pvt sk08_gestiona_plan_venta.tipo_pvt;
begin
rc_pvt := sk08_gestiona_plan_venta.tipo_pvt();
rc_pvt :=
sk08_gestiona_plan_venta.f_genera_plan_venta_inv (8713171
,null
,'m'
,'BS.F'
,to_date('28/02/2001','dd/mm/yyyy'));
end;
SQL> /
Registros en la coleccion =6
Procedimiento PL/SQL finalizado con éxito.
SQL>
I put a dbms_output.put_line on stored function .....
Please help ....!
Apparently it fails when calling the stored function:
rc_pvt := sk08_gestiona_plan_venta.f_genera_plan_venta_inv (:pvv.lip_id_lista_precio
,:pvv.ems_id_sucursal
,:control4.v_metodo_calculo
,:pvv.unm_co_unidad_monetaria
,:pvp.fe_fin_periodo) ;
I don't undestand since this function return the appropiate type. It seems the collection is empty, although having test that on sqlplus works ...
rc_pvt := sk08_gestiona_plan_venta.f_genera_plan_venta_inv (:pvv.lip_id_lista_precio
,:pvv.ems_id_sucursal
,:control4.v_metodo_calculo
,:pvv.unm_co_unidad_monetaria
,:pvp.fe_fin_periodo) ;
function f_genera_plan_venta_inv (p_id_lista_precio in number
,p_id_sucursal in number
,p_tipo_nivel_inv in varchar2
,p_co_unidad_monetaria in varchar2
,p_fe_fin_periodo in date) return tipo_pvt;
for some reason it works on plus:
SQL> declare
2 rc_pvt sk08_gestiona_plan_venta.tipo_pvt;
3 begin
4 rc_pvt := sk08_gestiona_plan_venta.tipo_pvt();
5 rc_pvt :=
6 sk08_gestiona_plan_venta.f_genera_plan_venta_inv (8713171
7 ,null
8 ,'m'
9 ,'BS.F'
10 ,to_date('28/02/2001','dd/mm/yyyy'));
11 --
12 dbms_output.put_line('Registros en la coleccion = '||rc_pvt.count);
13 for i in 1 .. rc_pvt.count loop
14 --
15 dbms_output.put_line('En '||i||rc_pvt(i).prd_co_producto);
16 end loop;
17 end;
18 /
Registros en la coleccion =6
Registros en la coleccion = 6
En 1PT.REF.PET.KO05
En 2PT.REF.PET.LM15
En 3PT.ALM.VDR.001
En 4PT.REF.GRN.CN
En 5PT.REF.GRN.KO
En 6PT.REF.GRN.LM
Procedimiento PL/SQL finalizado con éxito.
Don't understand why it works on plus8 (same version that comes with 6i).
Can't loop through records on forms...? WHY ...?
Edited by: myluism on 02-abr-2012 14:40Forms 6i is an antique ... write your code to run on the server.
Multiple examples of how to loop through an array loaded with bulk collect can be found here.
http://www.morganslibrary.org/reference/array_processing.html
The main library page is:
http://www.morganslibrary.org/library.html -
How to loop through a Data Node
Hello,
I have an Interactive Adobe form in WebDynpro Java project.
My data View tab includes the following structure:
Bapi_test
ValueHelpData
CodeNumber
CodeDescription
Can someone please tell how I can loop through the ValueHelpData node, and get values for CodeNumber and CodeDescription
The ValueHelpData node has the cardinality of 0..n. and has approximately 100 elements.
Thanks. Your help is much appreciated.
Rob.Hi Robby,
You could try the following :
int n = wdContext.nodeValueHelpData().size();
for(int i = 0; i < n; i++)
wdContext.nodeValueHelpData().moveTo(i);
IPrivateMyDataView.IValueHelpDataElement ele = wdContext.currentValueHelpDataElement();
String codenum = ele.getCodeNumber();
String codedesc = ele.getCodeDescription();
// Any other processing logic..//
Hope this helps. -
How can i transfer video recordings, messages and contacts to computer?
Hi
how can i transfer video recordings, messages and contacts to computer... please guide me through..
regardsYou should read the iPhone user guide. Answers all these questions.
-
How to loop through attributes
Im trying to loop through some XML and use the two attributes
name and href for each button im creating. so far all I have been
able to do is onfuse myself, well not totally - I can pull the
first name attribute from the firstChild. But I have not been able
to successfully assign it to a button. I took out my button code as
it was probably wrong. Heres what Ive tried...The arrays are built in an event, so before that event
happens, they are undefined. After the event, you can access the
arrays as usual. The trace(menus); call is before the
myXML_xml.load("menu2.xml"); line, which triggers the loading, so
it can't trace any values. It also wouldn't trace anything when
placed directly after the load() call, because the loading will
take some time until all data is loaded and the onLoad event is
fired. That makes it a bit hard to use the data outside the event,
because you must assert that it's loaded when used. The onLoad
event is just perfect for that, so it should be done there, just
after the loop through the xml nodes.
For the submenus, the attached code will place the childnode
data in subMenus. The arrays must be declared outside the event,
otherwise they get deleted when the event finishes.
cheers,
blemmo -
How to loop through columns selected by select clause
Hi,
I am having a select statement which is generated dynamically and the columns within it are also generated dynamically.
Select col1, col2, col3 from table1 where rowid = 'xxxx'
This will return a single row and columns within it, now i want to loop through the column values and store in it varray and return it.
Can somebody please show me how can i do this.
Thanks!Hi,
Thanks for replying.
Your solution works but my question is will it work if i try to do this dynamically.
I do have the count and names of the columns which are generated dynamically, i have the datatype for the corresponding columns also, the only problem which i faced is getting the values of these columns into something.
I am able to run the following sql like this:
szSqlStr := 'Select DISCOVERYHOSTNAME, DISCOVERYMACPRIMARYPHYSICAL, DISCOVERYSERIALNUMBER
from ALT_42_Consolidated where rowid = ''AAEWNEABXAAAAkxAAA''';
Execute immediate szSqlStr into nVal_Array(1), nVal_Array(2), nVal_Array(3);
I am generating this string also :
nVal_Array(1), nVal_Array(2), nVal_Array(3)
But i can't use it in execute immediate statement.
Can you please throw some light on genearing the variable for the into clause in teh above execute immediate statement. I am having the count of columns.
Yesterday I posted a question and its link is here:
How to execute dynamic sql
Thanks for your reply.
PS: What is YMMV -
How to loop through an associative array
Guys,
How to loop through an associative array. where the key is string but the value is an object
-ThanksIt depends if you are using a Java HashMap or a BPM Associative array. You'd use the "keySet" if for the former and the "keys" if it's the latter.
I know you want an object for the array, but Any[String] is used here just so you can see something coming back in the display statements shown below. Remove the input and display statements - they're just in there so you can see something working.
Here's how to go through a Hashmap's array using a loop:
map as Java.Util.HashMap
map.put(1, "One")
map.put(2, "Two")
map.put(3, "Three")
map.put(4, "Four")
map.put(5, "Five")
display map.keySet
for each item in keySet(map) do
display item
display get(map, arg1 : item)
endHere's how to go through an associative array using a loop:
hashMap as Any[String]
hashMap = ["One": 1,"Two":2]
for each item in hashMap.keys do
display item
display "Item in the array is: " + hashMap[item]
endDan -
How to loop through a KM Folder ?
Hi ....can someone please let me know how to loop through a KM Folder having many documents , files etc .
Waiting for replies !!
Regards
SmitaHi Smita
Here is the code:
String rLocationtest = "/documents/Folder1";
IResourceContext c = ResourceFactory.getInstance().getServiceContext("cmadmin_service");
ICollection collection = (ICollection)ResourceFactory.getInstance().getResource(RID.getRID(rLocationtest),c);
loopFolder(collection,c);
public void loopFolder(ICollection collection, IResourceContext c){
try{
IResourceList resList = collection.getChildren();
IResourceListIterator resItr = resList.listIterator();
while(resItr.hasNext()){
IResource restemp = resItr.next();
if(restemp.isCollection() && LinkType.NONE.equals(restemp.getLinkType())){
loopFolder((ICollection)restemp,c);
//If the restemp is not a collection, it is a resource.
//Do the resource related operations here.
}// End of while
}catch(Exception e){
e.printStackTrace();
}//End of loopFolder
Hope it helps
Thanks
Deepak -
How do I get my I message and FaceTime to activate on the iPhone 5s
How do I get my I message and FaceTime to activate on the iPhone 5s?
settings>messages>turn on
settings>facetime>turn on
if those dont work then go to settings>general>Reset>reset all settings
-Nothing will be deleted, you just have to go through the setup process again, setup as new ipad/iphone/ipod do not restore from back up, sign in with your apple id, and you should be good to go just make sure that both facetime and imessage are turned on
Maybe you are looking for
-
ME23N purchase order history - add new fields (not in layout)
Hello, I would like to expand the layout of Purchase order history (ME23N). I would like to add the field MKPF-BKTXT into the purchase order history for more information. Who can help? - Thank you. - Dietlinde
-
Poor quality on slow motion!!! (pixelated)
I would be soooooo grateful if someone could help me here! Okay, Ive been using final cut express for the past probably 5 months and had no problem but the other day when i went to edit a new video I noticed when i exported it any clips that had thei
-
Help with error codes!!!! Please!!!
import java.util.Scanner; //program uses Scanner public class Payroll3 private String name; private double rate; private double hours; //Constructor to store employee information public Payroll3(String employeeName, double ho
-
Gmail label/os x mail problems
In an effort to fix some strange gmail/imap/apple-mail/iphone behavior, i inadvertently broke it even more. my OS X Mail was not displaying the correct gmail inbox. it would only display older messages (from a few weeks ago). based on some advice i f
-
Sign in issue with Creative Cloud Desktop App
Error There was an error with this action. Try again later. 03609ef9-3083-48b3-b374-035f743103c7