Help in using grako for parsing

varun7rs at gmail.com varun7rs at gmail.com
Fri Oct 17 11:17:01 CEST 2014


I'm really sorry for not being clear. I shall explain things in detail from now onwards. Really sorry. The output I would like is 

<RF schema="RF.xsd" version="">
<VNE>
<requests>
<request ID="'0'">
<virtualnodes>
<virtualnode PhysicalNode_ID="'1'" Request_ID="'0'" VirtualNode_ID="'0'"/><virtualnode PhysicalNode_ID="'5'" Request_ID="'0'" VirtualNode_ID="'1'"/><virtualnode PhysicalNode_ID="'20'" Request_ID="'0'" VirtualNode_ID="'2'"/><virtualnode PhysicalNode_ID="'21'" Request_ID="'0'" VirtualNode_ID="'3'"/><virtualnode PhysicalNode_ID="'8'" Request_ID="'0'" VirtualNode_ID="'4'"/></virtualnodes>
<virtualedges>
<virtualedge PhysicalEdgeHead_ID="'5'" PhysicalEdgeTail_ID="'1'" Request_ID="'0'" VirtualEdgeHead_ID="'1'" VirtualEdgeTail_ID="'0'"/><virtualedge PhysicalEdgeHead_ID="'9'" PhysicalEdgeTail_ID="'5'" Request_ID="'0'" VirtualEdgeHead_ID="'2'" VirtualEdgeTail_ID="'1'"/><virtualedge PhysicalEdgeHead_ID="'20'" PhysicalEdgeTail_ID="'9'" Request_ID="'0'" VirtualEdgeHead_ID="'2'" VirtualEdgeTail_ID="'1'"/><virtualedge PhysicalEdgeHead_ID="'21'" PhysicalEdgeTail_ID="'2'" Request_ID="'0'" VirtualEdgeHead_ID="'3'" VirtualEdgeTail_ID="'2'"/><virtualedge PhysicalEdgeHead_ID="'22'" PhysicalEdgeTail_ID="'2'" Request_ID="'0'" VirtualEdgeHead_ID="'2'" VirtualEdgeTail_ID="'3'"/><virtualedge PhysicalEdgeHead_ID="'22'" PhysicalEdgeTail_ID="'20'" Request_ID="'0'" VirtualEdgeHead_ID="'3'" VirtualEdgeTail_ID="'2'"/><virtualedge PhysicalEdgeHead_ID="'10'" PhysicalEdgeTail_ID="'8'" Request_ID="'0'" VirtualEdgeHead_ID="'3'" VirtualEdgeTail_ID="'4'"/><virtualedge PhysicalEdgeHead_ID="'10'" PhysicalEdgeTail_ID="'0'" Request_ID="'0'" VirtualEdgeHead_ID="'4'" VirtualEdgeTail_ID="'3'"/><virtualedge PhysicalEdgeHead_ID="'14'" PhysicalEdgeTail_ID="'0'" Request_ID="'0'" VirtualEdgeHead_ID="'3'" VirtualEdgeTail_ID="'4'"/><virtualedge PhysicalEdgeHead_ID="'21'" PhysicalEdgeTail_ID="'14'" Request_ID="'0'" VirtualEdgeHead_ID="'3'" VirtualEdgeTail_ID="'4'"/></virtualedges>

In a similar way I have something like this for every request. This is what I intend to get from the input that I had pasted earlier.



More information about the Python-list mailing list