How to read a XML file and Modify the same using PERL?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GBR20
    New Member
    • May 2012
    • 2

    How to read a XML file and Modify the same using PERL?

    Hi All:

    I am new to Perl. I need to open a XML file and add few data in it using PERL. Could you please help me?

    XML File:

    <?xml version="1.0" encoding="ASCII "?>
    <componentmanif est.application :ApplicationCon figuration xmi:version="2. 0" xmlns:xmi="http ://www.omg.org/XMI" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xmlns:component manifest.applic ation="http:///componentmanife st/application.eco re" xmlns:component manifest.descri ption="http:///componentmanife st/description.eco re" xmi:id="Applica tionConfigurati on">
    <description xmi:id="MediaRo otProcessAppCon fig.hbac_Descri ption">
    <delegationPoin ts xsi:type="compo nentmanifest.de scription:PortD escription" xmi:id="Using_a pi/sys/data/pf/engineering/src/DSYSEngineering App_3.0.0_Engin eering" name="Engineeri ng" incomingConnect ors="_i0teQLTvE d-_huZVa1DFhQ">
    <interface href="mocca:imp/nbt/mm/mmdebuginfo/src/PMMDebugInfoDev ImplManifest.hb cm#api/sys/data/pf/engineering/src/DSYSEngineering App_3.0.0"/>
    </delegationPoint s>
    <parameterProvi ders xsi:type="compo nentmanifest.de scription:Exter nalParameterIni tialization" xmi:id="_9oV2cM 89Ed6JTfPP1OWyv Q">
    <requiredParame ter href="mocca:app configs/qnxintel/subsystems/NBTCommcoSubsys tem.hbsc#Parame terReference_Mm eGlobalBaseDevC trl_Config"/>
    </parameterProvid ers>
    <connectors xsi:type="compo nentmanifest.de scription:Assem blyConnector" xmi:id="_TUlewG yiEd-vxOnUAC_0Ig">
    <source href="mocca:app configs/qnxintel/subsystems/NBTPresCtrlSubS ystem.hbsc#Port Reference_Multi mediaPlayerFron t_Using_api/mm/media/pf/src/DMMPlayerNav_6. 0.0_PlayEngineZ one1"/>
    <target href="mocca:app configs/qnxintel/subsystems/NBTCommcoSubsys tem.hbsc#PortRe ference_PlayEng ineZone1_Provid ing_api/mm/media/pf/src/DMMPlayerNav_6. 1.0"/>
    </connectors>
    </description>
    <deployments xsi:type="compo nentmanifest.ap plication:Appli cationDeploymen t" xmi:id="_LPnLMM 5_Ed6Bfp5E6XnJK w" name="Default">
    <processes xmi:id="_Pn-6AM7JEd6IY6dYC1 rnCA" name="NBTMediaM ainApp" comment="">
    <dsiThreads xmi:id="_VRqzAM 9QEd6g88g4Gh8Y2 w">
    <send xmi:id="_VRqzAc 9QEd6g88g4Gh8Y2 w" watchdogTimeout ="60000"/>
    <receive xmi:id="_VRqzAs 9QEd6g88g4Gh8Y2 w" watchdogTimeout ="60000"/>
    </dsiThreads>
    <subSystems href="mocca:app configs/qnxintel/subsystems/NBTPresCtrlSubS ystem.hbsc#SubS ystemDeployment "/>
    <subSystems href="mocca:app configs/qnxintel/subsystems/NBTCommcoSubsys tem.hbsc#SubSys temDeployment"/>
    <subSystems href="mocca:app configs/qnxintel/subsystems/NBTMediaOnOffSu bsystem.hbsc#Su bSystemDeployme nt"/>
    </processes>
    <frameworkConfi g xmi:id="_LBonAE VwEeCktOQek5zVi A" watchdogWarning Limit="75" frameworkThread PartitionName=" interaction">
    <tracePersisten ce xmi:id="_RXZPME VwEeCktOQek5zVi A" headerFile="api/sys/tracesrv/pf/trace/src/CHBDefaultBinar yTracePersisten ce.hpp" className="CHBD efaultBinaryTra cePersistence"/>
    <defaultThreadP arameters xmi:id="_b8gMsE VwEeCktOQek5zVi A" watchdogTimeout ="100" stackSize="3276 8">
    <priorities xmi:id="_fZ784E VwEeCktOQek5zVi A" priorityValue=" 10" isAbsolute="tru e"/>
    <priorities xmi:id="_g0PXsE VwEeCktOQek5zVi A" isAbsolute="tru e" osFamily="WIN32 "/>
    </defaultThreadPa rameters>
    </frameworkConfig >
    <rootComponen t href="mocca:app configs/qnxintel/subsystems/NBTMediaOnOffSu bsystem.hbsc#De ployedComponent _MultimediaOnOf fComponent"/>
    </deployments>
    </componentmanife st.application: ApplicationConf iguration>


    DATA TO BE ADDED UNDER RESPECTIVE TAGS:

    <delegationPoin ts xsi:type="compo nentmanifest.de scription:PortD escription" xmi:id="Providi ng_api/nbt/mm/common/src/MmeCommon_3.2.0 _MmeCommon" name="MmeCommon " incomingConnect ors="_UUFLQJmmE eGK0NAOkJ-nZw" provider="true" >
    <interface href="mocca:imp/nbt/mm/mmecommon/src/MmeCommonManife st.hbcm#api/nbt/mm/common/src/MmeCommon_3.2.0 "/>
    </delegationPoint s>

    <connectors xsi:type="compo nentmanifest.de scription:Deleg ationConnector" xmi:id="_UUFLQJ mmEeGK0NAOkJ-nZw" target="Providi ng_api/nbt/mm/common/src/MmeCommon_3.2.0 _MmeCommon">
    <source href="mocca:app configs/qnxintel/subsystems/NBTPresCtrlSubS ystem.hbsc#Port Reference_MmeCo mmon_Providing_ api/nbt/mm/common/src/MmeCommon_3.2.0 "/>
    </connectors>
Working...