Hi all,

I am trying to write a script that will check a given xml file for certain conditions and generate a report.

Details:

Input Tagged XML

Conditions:

The are a set of around keywords(Topics) which must exist in the file

There are 3 topic levels:

Level 1
|
|--Level 2-|--Level 3

Level 1 topics:
orders
order_description
models
model_description
manufacturer
manufacturer_description
and some more topics

Level 2 topics Under "Orders"
Type
size
part no
req
rule
and some more topics

Level 2 topics under "Order_Description"
Material
thickness
and some more topics

Level 3 topics Under "Orders" -> "Type"
FMA01
FMA02
FMA03
FMA04
etc

Lavel 3 topics under "orders" - > "Size"
1P
3P
5P
11P
etc



The script should check for all topics in level 1 in order and when it finds a level 1 topic it should check for occurrences of the Level 2 topics under it and similarly on finding the topic in level 2 it should check for corresponding topics in level 3.

Note: Some level 1 topics may not have any level 2 or 3 topics and some level 2 topics may not have level 3 topics.

The script must finally display a list of missing topics in order

Example

Missing topics

"Orders->Part No->Thickness->FMA05->5P
"Orders->Part No->Thickness->FMA05->11P

And all the topics will be tagged like this
<auto topic-url="some_url"><topic>Orders</topic></auto>


There are around 75 such conditions and manually checking them is killing me. It would be great if someone could throw some light on this.