in reply to Re^2: XML parser to fetch default values of the optional attributes from the xsd file
in thread XML parser to fetch default values of the optional attributes from the xsd file

ikegami:

I assumed that if he (a) could detect that the defaults are missing, and (b) can track down the correct values, that he already knows how to identify the correct values.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re^3: XML parser to fetch default values of the optional attributes from the xsd file

Replies are listed 'Best First'.
Re^4: XML parser to fetch default values of the optional attributes from the xsd file
by ikegami (Patriarch) on Jan 11, 2011 at 19:23 UTC

    He's asking how to do (b), if not both (a) and (b), so it's not a very good assumption.

    Update: That was not very well put. The following explains what I meant.

    I would expect that he wants get_attributes($ele) to return all present attributes and all absent attributes for which the schema defines a default.

    To achieve that automatically, one must automatically determine (a) which attributes are missing and (b) what are the default for those attributes.

    Another scenario is that he simply wants get_attribute($ele, 'foo') to return the specified value for the attribute, or the default otherwise if it's not specified.

    To achieve that automatically, one must automatically determine (b) what is the default for that attribute.

    For both scenarios, you simply assumed the OP could already solve all but the trivial portions of his problem.