各位大虾:
小弟请教个问题,现在有这样一个需求,想用perl读入以下的一个xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<ackage Id="main" Name="ETL workflow process" xmlns="http://www.wfmc.org/2002/XPDL1.0" xmlnspdl="http://www.wfmc.org/2002/XPDL1.0" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xmlnsyz="http://www.xyzeorder.com/workflow" xsi:schemaLocation="http://www.wfmc.org/2002/XPDL1.0
http://wfmc.org/standards/docs/TC-1025_schema_10_xpdl.xsd">
<ackageHeader>
<XPDLVersion>1.0</XPDLVersion>
<Vendor>XYZ, Inc</Vendor>
<Created>6/18/2002 5:27:17 PM</Created>
</PackageHeader>
<ConformanceClass GraphConformance="NON_BLOCKED"/>
<Script Type="text/javascript"/>
<WorkflowProcesses>
<WorkflowProcess Id="0" Name="主菜单">
<Activities>
<Activity Id="01" Name="01.一级菜单">
<Implementation>
<SubFlow Execution="SYNCHR" Id="2"/>
</Implementation>
</Activity>
<Activity Id="00" Name="主菜单">
<TransitionRestrictions>
<TransitionRestriction>
<Split Type="XOR">
<TransitionRefs>
<TransitionRef Id="0_tra1"/>
<TransitionRef Id="0_tra5"/>
<TransitionRef Id="0_tra6"/>
</TransitionRefs>
</Split>
</TransitionRestriction>
</TransitionRestrictions>
</Activity>
<Activity Id="02" Name="02.一级菜单">
<TransitionRestrictions>
<TransitionRestriction>
<Split Type="XOR">
<TransitionRefs>
<TransitionRef Id="0_tra4"/>
<TransitionRef Id="0_tra3"/>
</TransitionRefs>
</Split>
</TransitionRestriction>
</TransitionRestrictions>
</Activity>
<Activity Id="03" Name="03.一级菜单">
<Activity Id="011" Name="1.二级菜单">
<ExtendedAttributes>
<ExtendedAttribute Name="exec" Value="test.sh"/>
</ExtendedAttributes>
</Activity>
<Activity Id="021" Name="1.二级菜单">
<ExtendedAttributes>
<ExtendedAttribute Name="call" Value="fun1()"/>
</ExtendedAttributes>
</Activity>
<Activity Id="022" Name="2.二级菜单">
<ExtendedAttributes>
<ExtendedAttribute Name="call" Value="fun2()"/>
</ExtendedAttributes>
</Activity>
</Activities>
<Transitions>
<Transition From="00" Id="0_tra1" To="01"/>
<Transition From="00" Id="0_tra5" To="02"/>
<Transition From="00" Id="0_tra6" To="03"/>
<Transition From="01" Id="0_tra2" To="011"/>
<Transition From="02" Id="0_tra3" To="021"/>
<Transition From="02" Id="0_tra4" To="022"/>
</Transitions>
</WorkflowProcess>
</WorkflowProcesses>
</Package>
生成一个类似以下的菜单
主菜单
一级菜单
二级菜单
并且能识别出二级菜单的扩展属性,如果扩展属性名是exec的话,就执行shell,如果扩展属性名是call的话,就调用函数。
请各位大虾帮忙看一下类似的功能怎么实现,如果用cpan的话,用哪个cpan模块,最好能有个框架指导一下,再次感谢大家了。