in reply to XML dynamic nesting !!

What have you tried? Any of the XML parsers will parse this kind of XML dynamically without limiting in any way the nesting.

Of course, if you're trying to use regular expressions to parse XML, that makes things harder. So don't do that.

Replies are listed 'Best First'.
Re^2: XML dynamic nesting !!
by onkar (Novice) on Jan 20, 2010 at 12:11 UTC
    <Root> <Databasechecks> <Dbname>DB01</Dbname> <Runquery>some query</Runquery> </Databasechecks> <Databasechecks> <Dbname>DB02</Dbname> <Runquery> <xyz>dfdf</xyz> some query </Runquery> </Databsechecks> </Root>
    here there are two Database checks in the same level . But in the second Databasechecks we have nested xyz tag which is not there in the first Database check. Using XML::Simple module, we can get query result , but we get xyz as hashreference. The code written for first Database check should also parse n number of nodes added to second Databasechecks. How can we know that ? and how can we implement that ? If u know please tell me the solution.

      You should read the XML::Simple documentation about the ForceArray parameter.

        In this case it looks more like onkar needs ForceContent but restricted to the <Runquery> tag. (I did send Grant a patch to allow that years ago ...)

        onkar you may find it easier to let XML::Rules infer the base set of rules for you and then tweak them so that it produces a convenient data structure.

        Jenda
        Enoch was right!
        Enjoy the last years of Rome.