Hi all,
I am new to perl and xml ...
Can anyone help me out to read an xml file and write it to text file.
6 2727 KevinADC 4,059
Recognized Expert Specialist
What have you tried so far?
What have you tried so far?
i haven't started coding yet....as i am new to perl and xml, looking out for the way to proceed... help me
KevinADC 4,059
Recognized Expert Specialist
Hi,
I am new to perl and xml.... please help me out with the following as this is urgent:
Can anyone help me with the code....
I have a xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE FOF (View Source for full doctype...)>
- <FOF Name="BBH3" Date="20070413" Last="1">
- <OB cl="FOMessage.F IOMMessage.FIOM Object" no="1019.1008.5 1" vr="1.43" od="1" mn="0">
<tx no="51" nm="provider1ID " mn="0" ky="1" />
<tx no="51" nm="provider2ID " mn="0" ky="1" />
<tx no="51" nm="provider3ID " mn="0" ky="1" />
<sp no="1008" nm="creationTim e" mn="0" />
<tx no="1008" nm="author" mn="0" />
<nu no="1019" nm="revisionNo " mn="0" />
<sp no="1019" nm="createTimes tamp" mn="0" />
<tx no="1019" nm="createUserI D" mn="0" vl="WMS" />
<tx no="1019" nm="initiatorId " mn="0" />
<tx no="1019" nm="messageFrom ID" mn="0" vl="iss-blade4.local.wm gruppe.de_21221 _2_0" />
<tx no="1019" nm="messageToID " mn="0" vl="iss-blade4.local.wm gruppe.de_21221 _2_0" />
<fg no="1019" nm="isEndOfDeli very" mn="0" />
<fg no="1019" nm="isExecuted " mn="0" />
- <R no="1019" nm="fiomData">
- <RP mn="0">
- <OB cl="QuoteHolder .TopLevelObject .FIOMObject" no="208.1080.51 " vr="1.43" od="2" mn="3">
<tx no="51" nm="provider1ID " mn="0" ky="1" />
<tx no="51" nm="provider2ID " mn="1" ky="1" vl="WMS" ov="" />
<tx no="51" nm="provider3ID " mn="0" ky="1" />
<cr no="208" nm="currency" mn="4" ky="1" vl="6 WKN 965642 Waehrung_BdB EO ISIN EU0009656420 BoersenkuerzelI nland EUR Waehrung_ISO421 7 EUR DB_KEY 69" />
<R no="1080" nm="result" />
- <R no="1080" nm="vdpsInforma tion">
- <RP mn="0">
+ <OB cl="VDPSInforma tion.FIOMObject " no="160.51" vr="1.43" od="3" mn="3">
<tx no="51" nm="provider1ID " mn="0" ky="1" />
<tx no="51" nm="provider2ID " mn="0" ky="1" />
<tx no="51" nm="provider3ID " mn="0" ky="1" />
<fg no="160" nm="hasPendingA ctivities" mn="4" vl="FALSE" />
<tx no="160" nm="vstName" mn="0" vl="QuoteHolder " />
<tx no="160" nm="vstVersion " mn="0" vl="WM_003a" />
<em no="160" nm="foType" mn="4" dm="FOType" vl="500" />
<tx no="160" nm="createUserI D" mn="0" vl="WMS" />
<sp no="160" nm="createTimes tamp" mn="0" vl="05.07.2005 - 22:02:15 @0" />
<tx no="160" nm="updateUserI D" mn="3" vl="WMS" ov="unknown" />
<sp no="160" nm="updateTimes tamp" mn="3" vl="16.04.2007 - 10:24:40 @0" ov="15.04.2007 - 11:26:04 @0" />
<nu no="160" nm="vstQuality " mn="4" vl="10" />
<fg no="160" nm="isRelevant " mn="4" vl="TRUE" />
<tx no="160" nm="modificatio nReason" mn="0" />
<nu no="160" nm="revisionNo " mn="3" vl="529" ov="528" />
<tx no="160" nm="remarks" mn="0" />
<fg no="160" nm="hasFutureMe ssages" mn="0" />
<nu no="160" nm="vstRequired Quality" mn="4" vl="5" />
<tx no="160" nm="provider1Sy mbol" mn="0" ky="1" />
<tx no="160" nm="provider2Sy mbol" mn="0" ky="1" />
<tx no="160" nm="provider3Sy mbol" mn="0" ky="1" />
<em no="160" nm="dataStatusT ype" mn="0" dm="DataStatusT ype" />
<nu no="160" nm="vstMaximumQ uality" mn="0" vl="10" />
<nu no="160" nm="newVstQuali ty" mn="1" vl="10" ov="" />
<fg no="160" nm="isChecked" mn="0" />
<tx no="160" nm="messageInfo " mn="0" />
<fg no="160" nm="fotWizardIs Disabled" mn="0" />
<em no="160" nm="blockingCod eType" mn="0" dm="BlockingCod eType" />
<em no="160" nm="logicDeleti onType" mn="0" dm="LogicDeleti onType" />
<tx no="160" nm="foDBKey" mn="0" />
<fg no="160" nm="isOnDB" mn="4" vl="TRUE" />
<fg no="160" nm="isFastInser tion" mn="0" />
<em no="160" nm="priorityTyp e" mn="0" dm="PriorityTyp e" />
<R no="160" nm="genericInfo rmations" />
<R no="160" nm="areaInforma tions" />
</OB>
</RP>
</R>
<R no="1080" nm="control" />
<R no="1080" nm="pendingActi vity" />
<R no="1080" nm="pendingChan ge" />
- <WR no="208" tn="BTID3" nm="instrument" >
<id no="0_BTID3" tn="BTID3" nm="destination Key" mn="3" vl="1 WKN 977961" ov="5 CommonCode 8492301 WKN 977961 ISIN DE0009779611 BoersenkuerzelI nland FPJB DB_KEY 18022" />
</WR>
- <R no="208" nm="recentQuote Values">
- <RP mn="0">
- <OB cl="QuoteValue. FIOMObject" no="213.51" vr="1.43" od="4" mn="1">
<tx no="51" nm="provider1ID " mn="0" ky="1" />
<tx no="51" nm="provider2ID " mn="1" ky="1" vl="20070413K01 005L21NULK02_1_ 4" ov="20070413K01 005L21NULK02_1_ 4" />
<tx no="51" nm="provider3ID " mn="0" ky="1" />
<tx no="213" nm="quoteTypeId Symbol" mn="1" vl="03_K02_1_4 " ov="03_K02_1_4 " />
<em no="213" nm="valueType" mn="1" dm="ValueType" vl="9001" ov="9001" />
<ft no="213" nm="quoteValue " mn="1" vl="75.35" ov="75.35" />
<em no="213" nm="valueStyleT ype" mn="1" dm="ValueStyleT ype" vl="5" ov="5" />
<ft no="213" nm="quoteSize" mn="0" />
<sp no="213" nm="quoteTime" mn="1" vl="13.04.2007 - 99:99:99 @99" ov="13.04.2007 - 99:99:99 @99" />
<em no="213" nm="sizeStyleTy pe" mn="0" dm="SizeStyleTy pe" />
<em no="213" nm="reliability Type" mn="0" dm="Reliability Type" />
<fg no="213" nm="isCorrectio n" mn="0" />
<sp no="213" nm="validUntil " mn="0" />
<em no="213" nm="settlementT imeType" mn="0" dm="SettlementT imeType" />
<em no="213" nm="settlementC odeType" mn="0" dm="SettlementC odeType" />
<em no="213" nm="settlementS tatusType" mn="0" dm="QuoteSettle StatusType" />
<em no="213" nm="valueStyleR efinedType" mn="1" dm="ValueStyleR efinedType" vl="9121" ov="9121" />
<tx no="213" nm="quoteTypeSc hemeSymbol" mn="1" vl="03_Fondspre ise" ov="03_Fondspre ise" />
<em no="213" nm="fixingCapit alEventType" mn="0" dm="FixingCapit alEventType" />
<lg no="213" nm="valueDescr " mn="0" />
<R no="213" nm="listingInfo rmation" />
<R no="213" nm="providedSer vice" />
<R no="213" nm="quoteListin gs" />
<RD no="213" nm="quoteType" mn="0" kyA="quoteTypeI dSymbol/quoteTypeScheme Symbol" />
</OB>
</RP>
- <RP mn="0">
- <OB cl="QuoteValue. FIOMObject" no="213.51" vr="1.43" od="5" mn="1">
<tx no="51" nm="provider1ID " mn="0" ky="1" />
<tx no="51" nm="provider2ID " mn="1" ky="1" vl="20070413K02 004L21NULK02_1_ 4" ov="20070413K02 004L21NULK02_1_ 4" />
<tx no="51" nm="provider3ID " mn="0" ky="1" />
<tx no="213" nm="quoteTypeId Symbol" mn="1" vl="03_K02_1_4 " ov="03_K02_1_4 " />
<em no="213" nm="valueType" mn="1" dm="ValueType" vl="9002" ov="9002" />
<ft no="213" nm="quoteValue " mn="1" vl="71.76" ov="71.76" />
<em no="213" nm="valueStyleT ype" mn="1" dm="ValueStyleT ype" vl="4" ov="4" />
<ft no="213" nm="quoteSize" mn="0" />
<sp no="213" nm="quoteTime" mn="1" vl="13.04.2007 - 99:99:99 @99" ov="13.04.2007 - 99:99:99 @99" />
<em no="213" nm="sizeStyleTy pe" mn="0" dm="SizeStyleTy pe" />
<em no="213" nm="reliability Type" mn="0" dm="Reliability Type" />
<fg no="213" nm="isCorrectio n" mn="0" />
<sp no="213" nm="validUntil " mn="0" />
<em no="213" nm="settlementT imeType" mn="0" dm="SettlementT imeType" />
<em no="213" nm="settlementC odeType" mn="0" dm="SettlementC odeType" />
<em no="213" nm="settlementS tatusType" mn="0" dm="QuoteSettle StatusType" />
<em no="213" nm="valueStyleR efinedType" mn="1" dm="ValueStyleR efinedType" vl="9121" ov="9121" />
<tx no="213" nm="quoteTypeSc hemeSymbol" mn="1" vl="03_Fondspre ise" ov="03_Fondspre ise" />
<em no="213" nm="fixingCapit alEventType" mn="0" dm="FixingCapit alEventType" />
<lg no="213" nm="valueDescr " mn="0" />
<R no="213" nm="listingInfo rmation" />
<R no="213" nm="providedSer vice" />
<R no="213" nm="quoteListin gs" />
<RD no="213" nm="quoteType" mn="0" kyA="quoteTypeI dSymbol/quoteTypeScheme Symbol" />
</OB>
</RP>
- <R no="208" nm="providedSer vice">
- <RP mn="0">
- <OB cl="ProvidedSer vice.FIOMObject " no="310.51" vr="1.43" od="11" mn="4">
<tx no="51" nm="provider1ID " mn="0" ky="1" />
<tx no="51" nm="provider2ID " mn="0" ky="1" />
<tx no="51" nm="provider3ID " mn="0" ky="1" />
<dt no="310" nm="beginDate" mn="0" />
<dt no="310" nm="endDate" mn="0" />
- <WR no="310" tn="BTID2" nm="institution ">
<id no="0_BTID2" tn="BTID2" nm="destination Key" mn="3" vl="1 Institution 848758" ov="5 Abwicklungsstel le 4039 Betreuer 4039 Institution 848758 IBEI DE08487588 DB_KEY 54487" />
</WR>
- <WR no="310" tn="BTID5" nm="instrumentS ervice">
<id no="0_BTID5" tn="BTID5" nm="destination Key" mn="4" vl="1 InvestmentFonds Preise WMGruppe" />
</WR>
</OB>
</RP>
</R>
</OB>
</RP>
</R>
</OB>
Output:
I need a perl script and the output (txt file) of the perl script is as follows:
#(ISIN, valueType, quoteValue,quot eTime)
DE0009779611,90 01,75.35,200704 13
DE0009779612,90 01,97.12,200704 13
.
.
Need to take the Date from the header ie 3rd line and compare it with the date in quoteTime. If the date matches, write it into txt file.If it doesn't match, then discard
Here i need to get only the quoteValue for valueType =9001 and not for 9002
Would appreciate if anyone helps me with this
KevinADC 4,059
Recognized Expert Specialist
the scenario is:
you start the code, we help.
Or we point you to resouces that can get you started. I did that in your other post but you seem to have ignored that.
First u must show ur code...then only v wl know ur need
use Cwd;
$path = getcwd();
$path =~s/\\/\//sgi;
opendir(DIR,$pa th) || die("cannot open the file");
@html = grep(/\.xml/,readdir(DIR));
closedir(DIR);
foreach $files (@xml)
{
submain($path." \/".$files);
}
sub submain()
{
$xml = shift;
$txt = $html;
$txt=~s/\.xml/\.txt/g;
open(FIL,$xml);
then proceed According to ur need...........
This may help u.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ling Lee |
last post by:
Hi all.
I'm trying to write a program that:
1) Ask me what file I want to count number of lines in, and then counts the
lines and writes the answear out.
2) I made the first part like this:
in_file = raw_input("What is the name of the file you want to open: ")
in_file = open("test.txt","r")
|
by: Rigga |
last post by:
Hi,
I am new to Python and need to parse a text file and cut parts out i.e. say
the text file contained 5 rows of text:
line 1 of the text file
line 2 of the text file
line 3 of the text file
line 4 of the text file
line 5 of the text file
|
by: Eric |
last post by:
Assume that disk space is not an issue
(the files will be small < 5k in general for the purpose of storing
preferences)
Assume that transportation to another OS may never occur.
Are there any solid reasons to prefer text files over binary files
files?
|
by: thenightfly |
last post by:
Ok, I know all about how binary numbers translate into text characters.
My question is what exactly IS a text character? Is it a bitmap?
|
by: Chris |
last post by:
Hi
I can use a text file as a datasource but am unable to get the datatable to
see the text file as having multiple columns. Everything gets
put into the first column in the datatable. Sample of code and text file
included.
Please help
Regards
| |
by: bbepristis |
last post by:
Hey all I have this code that reads from one text file writes to
another unless im on a certian line then it writes the new data however
it only seems to do about 40 lines then quits and I cant figure out why
any help would be much apprechiated
1.
Dim line_num As Integer
2.
Dim filename2 As String
3.
|
by: Osoccer |
last post by:
...to a different folder and in the relocated file concatenates all of the lines in one long string with a space between each line element. Here is a fuller statement of the problem:
I need a Visual Basic Script file, call it "Move and Reformat Text File.VBS," that will run from a Windows Script Host command-prompt-based version as follows:
C:\> Cscript.exe "Move and Reformat Text File.VBS"
The objective of the VBScript file, "Move...
|
by: bluemountain |
last post by:
Hi there,
Iam new to python forms and programming too
I had a text file where i need to extract few words of data from the header(which is of 3 lines) and search for the keyword TEXT1, TEXT2, TEXT3in entire file(file consisting of 150 lines) that is related to a particular id and get the sum of the, WRITES of TEXT1, TEXT2, TEXT3
ex: input file will be as below
Windows 2000 text text text text text text text
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |