Sponsored Content
Full Discussion: parsing xml file
Top Forums Shell Programming and Scripting parsing xml file Post 302572500 by annar on Thursday 10th of November 2011 06:58:22 AM
Old 11-10-2011
parsing xml file

Hello!

We need to parse weblogic config.xml file and display rows in format:

machine:listen-port:name:application_name

In our enviroment the output should be (one line for every instance):
Code:
 
Crm-Test-Web:8001:PIA:peoplesoft
Crm-Test-Web:8011:PIA:peoplesoft
Crm-Test-Web:8021:PIA:peoplesoft
:9999:WebLogicAdmin:

The config.xml file looks like:
Code:
<?xml version='1.0' encoding='UTF-8'?>
<domain xmlns="http://xmlns.oracle.com/weblogic/domain" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:... ...">
<name>peoplesoft</name>
<domain-version>10.3.3.0</domain-version>
<security-configuration>
<name>peoplesoft</name>
<realm>
<sec:authentication-provider xsi:type="wls:default-authenticatorType"></sec:authentication-provider>
<sec:authentication-provider xsi:type="wls:default-identity-asserterType">
<sec:active-type>AuthenticatedUser</sec:active-type>
</sec:authentication-provider>
<sec:role-mapper xmlns:xac="http://xmlns.oracle.com/weblogic/security/xacml" xsi:type="xac:xacml-role-mapperType"></sec:role-mapper>
<sec:authorizer xmlns:xac="http://xmlns.oracle.com/weblogic/security/xacml" xsi:type="xac:xacml-authorizerType"></sec:authorizer>
<sec:adjudicator xsi:type="wls:default-adjudicatorType"></sec:adjudicator>
<sec:credential-mapper xsi:type="wls:default-credential-mapperType"></sec:credential-mapper>
<sec:cert-path-provider xsi:type="wls:web-logic-cert-path-providerType"></sec:cert-path-provider>
<sec:cert-path-builder>WebLogicCertPathProvider</sec:cert-path-builder>
<sec:name>myrealm</sec:name>
<sec:password-validator xmlns:pas="http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator" xsi:type="pas:system-password-validatorType">
<sec:name>SystemPasswordValidator</sec:name>
<pas:min-password-length>8</pas:min-password-length>
<pas:min-numeric-or-special-characters>1</pas:min-numeric-or-special-characters>
</sec:password-validator>
</realm>
<default-realm>myrealm</default-realm>
<credential-encrypted>{AES}H+LpfH72QMbs6SzJPEAgQSDLzuKuDWf8gfnMJCjVjxHPBUgXKSGs0VP0xNngwj2wDZtEmuX99q/3dSxLSW2khhki1acWq1XtG/MytpJTM1grhNQv4rxtPeUjMs2xWxCx</credential-encrypted>
<node-manager-username>system</node-manager-username>
<node-manager-password-encrypted>{AES}neDvoLnRRW2UiGENxwO2EiCDsQa0Q1KMU109Nby0Vfs=</node-manager-password-encrypted>
<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>
</security-configuration>
<server>
<name>WebLogicAdmin</name>
<ssl>
<name>WebLogicAdmin</name>
<listen-port>443</listen-port>
</ssl>
<log>
<name>WebLogicAdmin</name>
<file-name>./logs/WebLogicAdmin_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<listen-port>9999</listen-port>
<web-server>
<name>WebLogicAdmin</name>
<web-server-log>
<name>WebLogicAdmin</name>
<file-name>./logs/WebLogicAdmin_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
<https-keep-alive-secs>120</https-keep-alive-secs>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address></listen-address>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<graceful-shutdown-timeout>30</graceful-shutdown-timeout>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
</server>
<server>
<name>PIA</name>
<ssl>
<name>PIA</name>
<enabled>true</enabled>
<listen-port>8443</listen-port>
<server-private-key-alias>Crm-Test-Web</server-private-key-alias>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<name>PIA</name>
<file-name>./logs/PIA_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<machine>Crm-Test-Web</machine>
<listen-port>8001</listen-port>
<listen-port-enabled>true</listen-port-enabled>
<cluster xsi:nil="true"></cluster>
<web-server>
<name>PIA</name>
<web-server-log>
<name>PIA</name>
<file-name>./logs/PIA_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
<https-keep-alive-secs>120</https-keep-alive-secs>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address>172.22.12.96</listen-address>
<java-compiler>javac</java-compiler>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<graceful-shutdown-timeout>30</graceful-shutdown-timeout>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<client-cert-proxy-enabled>false</client-cert-proxy-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
<server-diagnostic-config>
<wldf-diagnostic-volume>Off</wldf-diagnostic-volume>
</server-diagnostic-config>
</server>
<server>
<name>PIA1</name>
<ssl>
<name>PIA1</name>
<enabled>true</enabled>
<listen-port>8443</listen-port>
<server-private-key-alias>Crm-Test-Web</server-private-key-alias>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<name>PIA1</name>
<file-name>./logs/PIA1_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<machine>Crm-Test-Web</machine>
<listen-port>8011</listen-port>
<listen-port-enabled>true</listen-port-enabled>
<cluster xsi:nil="true"></cluster>
<web-server>
<name>PIA1</name>
<web-server-log>
<name>PIA1</name>
<file-name>./logs/PIA1_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
<https-keep-alive-secs>120</https-keep-alive-secs>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address>172.22.12.96</listen-address>
<java-compiler>javac</java-compiler>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<graceful-shutdown-timeout>30</graceful-shutdown-timeout>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<client-cert-proxy-enabled>false</client-cert-proxy-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
<server-diagnostic-config>
<wldf-diagnostic-volume>Off</wldf-diagnostic-volume>
</server-diagnostic-config>
</server>
<server>
<name>PIA2</name>
<ssl>
<name>PIA2</name>
<enabled>true</enabled>
<listen-port>8443</listen-port>
<server-private-key-alias>Crm-Test-Web</server-private-key-alias>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<name>PIA2</name>
<file-name>./logs/PIA2_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<machine>Crm-Test-Web</machine>
<listen-port>8021</listen-port>
<listen-port-enabled>true</listen-port-enabled>
<cluster xsi:nil="true"></cluster>
<web-server>
<name>PIA2</name>
<web-server-log>
<name>PIA2</name>
<file-name>./logs/PIA2_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
<https-keep-alive-secs>120</https-keep-alive-secs>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address>172.22.12.96</listen-address>
<java-compiler>javac</java-compiler>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<graceful-shutdown-timeout>30</graceful-shutdown-timeout>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<client-cert-proxy-enabled>false</client-cert-proxy-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
<server-diagnostic-config>
<wldf-diagnostic-volume>Off</wldf-diagnostic-volume>
</server-diagnostic-config>
</server>
<server>
<name>RPS</name>
<ssl>
<name>RPS</name>
<enabled>true</enabled>
<listen-port>8443</listen-port>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<name>RPS</name>
<file-name>./logs/RPS_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<instrument-stack-trace-enabled>false</instrument-stack-trace-enabled>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<listen-port>8080</listen-port>
<web-server>
<name>RPS</name>
<web-server-log>
<name>RPS</name>
<file-name>./logs/RPS_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
<https-keep-alive-secs>120</https-keep-alive-secs>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address></listen-address>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
</server>
<server>
<name>PSEMHUB</name>
<ssl>
<name>PSEMHUB</name>
<enabled>false</enabled>
<listen-port>8002</listen-port>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<name>PSEMHUB</name>
<file-name>./logs/PSEMHUB_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<instrument-stack-trace-enabled>false</instrument-stack-trace-enabled>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<listen-port>8081</listen-port>
<web-server>
<name>PSEMHUB</name>
<web-server-log>
<name>PSEMHUB</name>
<file-name>./logs/PSEMHUB_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address></listen-address>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
</server>
<server>
<name>PSOL</name>
<ssl>
<name>PSOL</name>
<enabled>false</enabled>
<listen-port>6002</listen-port>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<name>PSOL</name>
<file-name>./logs/PSOL_weblogic.log</file-name>
<log-file-severity>Info</log-file-severity>
<redirect-stdout-to-server-log-enabled>true</redirect-stdout-to-server-log-enabled>
</log>
<instrument-stack-trace-enabled>false</instrument-stack-trace-enabled>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>50</thread-count>
</execute-queue>
<listen-port>6001</listen-port>
<web-server>
<name>PSOL</name>
<web-server-log>
<name>PSOL</name>
<file-name>./logs/PSOL_access.log</file-name>
<logging-enabled>false</logging-enabled>
</web-server-log>
</web-server>
<iiop-enabled>false</iiop-enabled>
<listen-address></listen-address>
<staging-directory-name>./stage</staging-directory-name>
<upload-directory-name>./upload</upload-directory-name>
<staging-mode>nostage</staging-mode>
<graceful-shutdown-timeout>30</graceful-shutdown-timeout>
<msi-file-replication-enabled>true</msi-file-replication-enabled>
<custom-identity-key-store-file-name>piaconfig/keystore/pskey</custom-identity-key-store-file-name>
<custom-identity-key-store-type>JKS</custom-identity-key-store-type>
<custom-trust-key-store-file-name>piaconfig/keystore/pskey</custom-trust-key-store-file-name>
<custom-trust-key-store-type>JKS</custom-trust-key-store-type>
</server>
<cluster>
<name>peoplesoftCluster</name>
<multicast-address>239.192.0.0</multicast-address>
<multicast-port>7001</multicast-port>
<cluster-messaging-mode>unicast</cluster-messaging-mode>
</cluster>
<embedded-ldap>
<name>peoplesoft</name>
<credential-encrypted>{AES}C41eNE8xTc8w1i/+kZblVFUqK+vW9GheuNpZX96kJb0jd2UuAnYZqwewV32L76H3</credential-encrypted>
</embedded-ldap>
<configuration-version>10.3.3.0</configuration-version>
<app-deployment>
<name>peoplesoft</name>
<target>PIA,PIA1,PIA2</target>
<module-type>ear</module-type>
<source-path>applications/peoplesoft</source-path>
<sub-deployment>
<name>PORTAL.war</name>
<target>peoplesoftCluster</target>
</sub-deployment>
<sub-deployment>
<name>/PSIGW</name>
<target>peoplesoftCluster,PIA</target>
</sub-deployment>
<sub-deployment>
<name>/PSINTERLINKS</name>
<target>peoplesoftCluster,PIA</target>
</sub-deployment>
<sub-deployment>
<name>/PSOL</name>
<target>PIA,PSOL</target>
</sub-deployment>
<sub-deployment>
<name>/PSEMHUB</name>
<target>PIA,PSEMHUB</target>
</sub-deployment>
<sub-deployment>
<name>/pspc</name>
<target>PIA</target>
</sub-deployment>
<sub-deployment>
<name>/testsuite</name>
<target>PIA</target>
</sub-deployment>
<sub-deployment>
<name>/wsrptest</name>
<target>PIA</target>
</sub-deployment>
<sub-deployment>
<name>/helloportletapp</name>
<target>PIA</target>
</sub-deployment>
<deployment-order>1</deployment-order>
<security-dd-model>DDOnly</security-dd-model>
<staging-mode>nostage</staging-mode>
</app-deployment>
<app-deployment>
<name>HttpClusterServlet</name>
<target>RPS</target>
<module-type>war</module-type>
<source-path>applications/HttpClusterServlet</source-path>
<deployment-order>1</deployment-order>
<security-dd-model>DDOnly</security-dd-model>
<staging-mode>nostage</staging-mode>
</app-deployment>
<app-deployment>
<name>HttpProxyServlet</name>
<target>RPS</target>
<module-type>war</module-type>
<source-path>applications/HttpProxyServlet</source-path>
<deployment-order>1</deployment-order>
<security-dd-model>DDOnly</security-dd-model>
<staging-mode>nostage</staging-mode>
</app-deployment>
<app-deployment>
<name>PORTAL</name>
<target>PIA,PIA1,PIA2</target>
<module-type>war</module-type>
<source-path>applications/peoplesoft/PORTAL.war</source-path>
<security-dd-model>DDOnly</security-dd-model>
</app-deployment>
<machine xsi:type="unix-machineType">
<name>Crm-Test-Web</name>
<node-manager>
<nm-type>SSL</nm-type>
<listen-port>5556</listen-port>
<debug-enabled>false</debug-enabled>
</node-manager>
</machine>
<admin-server-name>WebLogicAdmin</admin-server-name>
</domain>


Thank you very much!

Moderator's Comments:
Mod Comment Please use code tags <- click the link!

Last edited by zaxxon; 11-10-2011 at 08:00 AM.. Reason: code tags, see PM
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Parsing xml file using Sed

Hi All, I have this(.xml) file as: <!-- define your instance here --> <instance name='ins_C2Londondev' user='' group='' fullname='B2%20-%20London%20(dev)' > <property> </property> </instance> I want output as: <!-- define your instance here --> <instance... (3 Replies)
Discussion started by: kapilkinha
3 Replies

2. Shell Programming and Scripting

XML file parsing using script

Hi I need some help with XML file parsing. I have an XML file with the below tag, I need a script to identify the value of srvcName which is this case is "AAA srvc name". I need to put contents of this value which is AAA srvc and name into different variables using an array and then reformat it... (6 Replies)
Discussion started by: zmfcat1
6 Replies

3. UNIX for Dummies Questions & Answers

Help parsing a XML file ....

Well I have read several threads on the subject ... but being a newbie like me makes it hard to understand ... What I need is the following: Input data: ------- snip --------- <FavouriteLocations> <FavouriteLocations class="FavouriteList"><Item... (6 Replies)
Discussion started by: misak
6 Replies

4. Shell Programming and Scripting

Parsing xml file

hi guys, great help to the original question, can i expand please? i have large files filled with blocks like this <Placemark> network type: hot line1 line2 line3 <styleUrl>red.png</styleUrl> </Placemark> <Placemark> network type: cold line1 line2 line3... (3 Replies)
Discussion started by: garvald
3 Replies

5. Shell Programming and Scripting

Help in parsing xml file (sed/nawk)

I have a large xml file as shown below: <input> <blah> <blah> <atr="blah blah value = ""> <blah> <blah> </input> ..2nd chunk... ..3rd chunk... ...4th chunk... All lines between <input> and </input> is one 'order' and this 'order' is repeated... (14 Replies)
Discussion started by: shekhar2010us
14 Replies

6. Shell Programming and Scripting

Parsing an XML file

Hello, I have the following xml file as an input. <?xml version="1.0" encoding="UTF-8"?> <RECORDS PS3_VERSION="1104_01"><RECORD> <POI_ID>931</POI_ID> <SUPPLIER_ID>2</SUPPLIER_ID> <POI_PVID>997920846</POI_PVID> <DB_ID>1366650925</DB_ID> <REGION>H1</REGION> <POI_NAME NAME_TYPE="Official"... (4 Replies)
Discussion started by: ramky79
4 Replies

7. Shell Programming and Scripting

Help in parsing XML output file in perl.

Hi I have an XML output like : <?xml version="1.0" encoding="ISO-8859-1" ?> - <envelope> - <body> - <outputGetUsageSummary> - <usgSumm rerateDone="5"> - <usageAccum accumId="269" accumCaptn="VD_DP_AR" inclUnits="9999999.00" inclUnitsUsed="0.00" shared="false" pooled="false"... (7 Replies)
Discussion started by: rkrish
7 Replies

8. Shell Programming and Scripting

XML: parsing of the Google contacts XML file

I am trying to parse the XML Google contact file using tools like xmllint and I even dived into the XSL Style Sheets using xsltproc but I get nowhere. I can not supply any sample file as it contains private data but you can download your own contacts using this script: #!/bin/sh # imports... (9 Replies)
Discussion started by: ripat
9 Replies

9. UNIX for Dummies Questions & Answers

Parsing XML file

I want to parse xml file sample file....... <name locale="en">my_name<>/name><lastChanged>somedate</lastChanged><some more code here> <name locale="en">tablename1<>/name><lastChanged>somedate</lastChanged> <definition><dbquery><sources><sql type="cognos">select * from... (10 Replies)
Discussion started by: ms2001
10 Replies

10. Shell Programming and Scripting

Help with parsing xml file

Hi, Need help with parsing xml data in unix and place it in a csv file. My xml file looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <iwgroups> <nextid value="128"> </nextid> <iwgroup name="RXapproval" id="124" display-name="RXapproval"... (11 Replies)
Discussion started by: ajayakunuri
11 Replies
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy