Help needed XML Field Extraction


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed XML Field Extraction
# 15  
Old 09-20-2010
What is ".log format"? Please provide a suitable example. The example SOAP message you provided was valid XML.
# 16  
Old 09-20-2010
Murphy,

Here it is. The XML or XSL is not in .xml file format. Its embedded in normal file. just like given below.

Code:
$ more querysubscriber1

ERROR|2010-08-29 15:58:20,581|SERIAL_ID=1283115500060|ST=2010-08-2915:58:20|SERVER=12.13.14.56:4420|TYPE=TransactionLog|LOG_LEVEL=6|CLASS=Gateway|OBJECT=/services/queryServiceService|PROVIDERID=dpmq://7SKQManager/?RequestQueue=queryServiceLIST;ReplyQueue=7SS.REPLY01;Sync=true;Timeout=30000;UserName=mqm|CONSUMERID=7S|OPERATION_NAME={http://integration.xyz.com/interfaces/queryServiceService/v1/queryServiceService.wsdl}queryServicePortType/queryServiceList|MsgID=414d5120445004c74775c29953acc|TOTAL_TIME=132|DP_TIME=6|REQUEST_MESSAGE=<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><m:wsMessageHeader xmlns:m="http://integration.xyz.com/common/header/WSMessageHeader/v2"><m:trackingMessageHeader><m:applicationId>7S</m:applicationId><m:applicationUserId>System</m:applicationUserId><m:consumerId>RHS</m:consumerId><m:messageId>818734161</m:messageId><m:conversationId>818734161</m:conversationId><m:timeToLive>45</m:timeToLive><m:replyCompletionCode>0</m:replyCompletionCode><m:messageDateTimeStamp>2010-08-29T15:58:19-05:00</m:messageDateTimeStamp></m:trackingMessageHeader></m:wsMessageHeader></SOAP-ENV:Header><SOAP-ENV:Body><tns:queryServiceList xmlns:tns="http://integration.xyz.com/interfaces/queryServiceList/v1/queryServiceList.xsd"><tns:info><tns:ban>873248743876324</tns:ban></tns:info><tns:selectionCriteria><tns:memoDateRange><tns:fromDate>2010-06-20</tns:fromDate><tns:toDate>2010-05-30</tns:toDate></tns:memoDateRange><tns:memoLevel>B</tns:memoLevel></tns:selectionCriteria></tns:queryServiceList></SOAP-ENV:Body></SOAP-ENV:Envelope>|RESPONSE_MESSAGE=<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><m:wsMessageHeader xmlns:m="http://integration.xyz.com/common/header/WSMessageHeader/v2"><m:trackingMessageHeader><m:applicationId>7S</m:applicationId><m:applicationUserId>System</m:applicationUserId><m:consumerId>RHS</m:consumerId><m:messageId>818734161</m:messageId><m:conversationId>818734161</m:conversationId><m:timeToLive>45</m:timeToLive><m:replyCompletionCode>8</m:replyCompletionCode><m:messageDateTimeStamp>2010-08-29T15:58:20-05:00</m:messageDateTimeStamp></m:trackingMessageHeader></m:wsMessageHeader></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>Server.600</faultcode><faultstring>Application processing error</faultstring><faultactor>pkk-queryServiceListBt-queryServiceListBtProcessor</faultactor><detail><ns1:errorDetailItem xmlns:ns1="http://integration.xyz.com/common/ErrorDetailsV2.xsd"><ns1:providerError><ns1:providerErrorCode>600</ns1:providerErrorCode><ns1:providerErrorText>general_application_exception-Server.600:pkk returned error: startDate should be prior or equal to endDate</ns1:providerErrorText><ns1:errorSystem>pkk</ns1:errorSystem><ns1:errorTransactionId>queryServiceListBt</ns1:errorTransactionId><ns1:errorProgramId>queryServiceListBtProcessor</ns1:errorProgramId><ns1:fieldInError/></ns1:providerError></ns1:errorDetailItem></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

Its not visible like XML Tree. Where as entire log is just one lengthy single line. In this case its quite difficult to convert this into XML tree and pull the desired format from that

The previous XML i had given you the formatted Log using XML Spy.
# 17  
Old 09-21-2010
Why did you waste everybody's time for with your questions about XML? Am I missing something here?

Last edited by fpmurphy; 09-21-2010 at 10:35 AM.. Reason: Fixed typo
# 18  
Old 09-21-2010
Sorry to misguide you, Just wanted to know, how can i make use of xsltproc. Do can i append the output of the log file to other change it to xml.file format so that, i can make use of this tool. can you give me the syntax . I tried using --debug way but of no use
# 19  
Old 09-21-2010
Have a look at A CSV to XML converter

Another useful tool is csv2xml

Last edited by fpmurphy; 09-21-2010 at 10:59 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with tag value extraction from xml file based on a matching condition

Hi , I have a situation where I need to search an xml file for the presence of a tag <FollowOnFrom> and also , presence of partial part of the following tag <ContractRequest _LoadId and if these 2 exist ,then extract the value from the following tag <_LocalId> which is "CW2094139". There... (2 Replies)
Discussion started by: paul1234
2 Replies

2. Shell Programming and Scripting

Help with XML tag value extraction based on condition

sample xml file part <?xml version="1.0" encoding="UTF-8"?><ContractWorkspace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _LoadId="export_AJ6iAFmh+pQHq1" xsi:noNamespaceSchemaLocation="ContractWorkspace.xsd"> <_LocalId>CW2218471</_LocalId> <Active>true</Active> ... (3 Replies)
Discussion started by: paul1234
3 Replies

3. Shell Programming and Scripting

Help with XML tag value extraction based on matching condition

sample xml file part <DocumentMinorVersion>0</DocumentMinorVersion> <DocumentVersion>1</DocumentVersion> <EffectiveDate>2017-05-30T00:00:00Z</EffectiveDate> <FollowOnFrom> <ContractRequest _LoadId="export_AJ6iAFoh6g0rE9"> <_LocalId>CRW2218451</_LocalId> ... (4 Replies)
Discussion started by: paul1234
4 Replies

4. Shell Programming and Scripting

Data extraction from .xml file

Hello, I'm attempting to extract 13 digit numbers beginning with 978 from a data file with the following command: awk '{ for(i=1;i<=NF;i++) if($i ~ /^978/) print $i; }' datafile > outfile This typically works. However, the new data file is an .xml file, and this command is no longer working... (6 Replies)
Discussion started by: palex
6 Replies

5. Shell Programming and Scripting

Regular Expression needed for the xml

I would like to match the regular below xml snippet by using the following grep command. I want match the lines as well could some please help me .. grep -il "<tokenValue>.*.</tokenValue>\n...*.amey.*.</userName>" ... (6 Replies)
Discussion started by: ameyrk
6 Replies

6. Red Hat

How to get a particular field from xml file?

i have a xml file and in that input file path is given. how to fetch that input file path using shell script. (4 Replies)
Discussion started by: ramsavi
4 Replies

7. Shell Programming and Scripting

XML parsing using nawk help needed

i need one help, below is one more xml file with diff pattern i tried it but dint get it , iam sure its a peice of cake for you guys. <xn:MeContext id="LSVLKY001"> <xn:ManagedElement id="1"> <un:RncFunction id="1"> <un:UtranCell... (2 Replies)
Discussion started by: tech_frk
2 Replies

8. Shell Programming and Scripting

How to get a field from an XML?

We have an input XML of the following form <item> <account>1234</account> <id>345</id> </item> How do we get the value of <account> tag (1234) using UNIX ? (6 Replies)
Discussion started by: Jassz
6 Replies

9. Shell Programming and Scripting

data extraction from xml file

I have an of xml file as shown below <?xml version='1.0' encoding='ASCII' standalone='yes' ?> <Station Index="10264" > <Number Value="237895890" /> <Position Lat="-29.5" Lon="3.5" /> <MaxDepth Value="-4939" /> <VeloLines Count="24"> <VeloLine Index="0" > <Depth... (3 Replies)
Discussion started by: shashi792
3 Replies

10. Shell Programming and Scripting

Problem in extraction when space is a field delimiter

I have more than 1000 files to parse. Each file contains few lines (number of lines varies) followed by a header line having all column's name (SPOT, NAME etc) and then values for those columns. **Example File: sdgafh dfhaadfha sfgaf dhah jkthdj SPOT NAME GENE_NAME CH_MEAN CHDN_MED ... (11 Replies)
Discussion started by: AshwaniSharma09
11 Replies
Login or Register to Ask a Question