{"action":"created","issue":{"url":"https://api.github.com/repos/TomBZombie/Dice/issues/61","labels_url":"https://api.github.com/repos/TomBZombie/Dice/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/TomBZombie/Dice/issues/61/comments","events_url":"https://api.github.com/repos/TomBZombie/Dice/issues/61/events","html_url":"https://github.com/TomBZombie/Dice/issues/61","id":85897053,"number":61,"title":"Support new xml format more readable","user":{"login":"laurentj","id":336034,"avatar_url":"https://avatars.githubusercontent.com/u/336034?v=3","gravatar_id":"","url":"https://api.github.com/users/laurentj","html_url":"https://github.com/laurentj","followers_url":"https://api.github.com/users/laurentj/followers","following_url":"https://api.github.com/users/laurentj/following{/other_user}","gists_url":"https://api.github.com/users/laurentj/gists{/gist_id}","starred_url":"https://api.github.com/users/laurentj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurentj/subscriptions","organizations_url":"https://api.github.com/users/laurentj/orgs","repos_url":"https://api.github.com/users/laurentj/repos","events_url":"https://api.github.com/users/laurentj/events{/privacy}","received_events_url":"https://api.github.com/users/laurentj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-07T12:09:31Z","updated_at":"2015-06-23T16:32:29Z","closed_at":null,"body":"The actual grammar used in the XML file is very verbose and doesn't use very well XML features (like attributes).\r\n\r\nSo, this example with the actual grammar:\r\n\r\n```xml\r\n<?xml version=\"1.0\"?>\r\n<dice>\r\n  <rule>\r\n    <name>Foo</name>\r\n    <!-- Shared: either true or false. If the tag is omitted it defaults to false -->\r\n    <shared>true</shared>\r\n    <!-- Multiple substitutions can be defined using the substitute tag: -->\r\n    <substitute>\r\n      <use>BIterator</use>\r\n      <as>Iterator</as>\r\n    </substitute>\r\n    <substitute>\r\n      <use>X</use>\r\n      <as>Y</as>\r\n    </substitute>\r\n    <!-- Supports calling parameters after construction using the call tag: -->\r\n    <call>\r\n      <method>setAttribute</method>\r\n      <params>\r\n        <param>Foo</param>\r\n        <param>Bar</param>\r\n      </params>\r\n    </call>\r\n    <call>\r\n      <method>setAttribute</method>\r\n      <params>\r\n        <param>Bar</param>\r\n        <param>Baz</param>\r\n      </params>\r\n    </call>\r\n    <!-- Multiple call tags can be defined. Instances of a specified class name are\r\n        supported by using the <instance> tag. This will supply an instance of \"X\" \r\n        equivilant to $dice->create('X'); (using rules for X) to the setDependency method.\r\n        Instance supports named instances as well as class names.\r\n        -->\r\n    <call>\r\n      <method>setDependency</method>\r\n      <params>\r\n        <instance>X</instance>\r\n      </params>\r\n    </call>\r\n    <!-- For named instances, supports the instanceof tag. \r\n             See documentation on Named Instances \r\n        -->\r\n    <instanceof>Bar</instanceof>\r\n    <!-- Comma separated list of dependencies which will be created new, ignoring their shared rules -->\r\n    <newinstances>Foo,Bar</newinstances>\r\n    <!-- List of constructor parameters -->\r\n    <construct>\r\n      <param>123</param>\r\n      <param>XYZ</param>\r\n    </construct>\r\n  </rule>\r\n  <rule>\r\n    <name>Bar</name>\r\n    <!-- Define rules for the next component -->\r\n  </rule>\r\n</dice>\r\n```\r\n\r\ncould be, with a more intelligent parser:\r\n\r\n```xml\r\n<?xml version=\"1.0\"?>\r\n<dice>\r\n  <rule name=\"foo\" shared=\"true\">\r\n    <substitute use=\"BIterator\" as=\"Iterator\" />\r\n    <substitute use=\"X\" as=\"Y\" />\r\n    <!-- Supports calling parameters after construction using the call tag: -->\r\n    <call method=\"setAttribute\">\r\n        <param>Foo</param>\r\n        <param>Bar</param>\r\n    </call>\r\n    <call method=\"setAttribute\">\r\n        <param>Bar</param>\r\n        <param>Baz</param>\r\n    </call>\r\n    <!-- Multiple call tags can be defined. Instances of a specified class name are\r\n        supported by using the <instance> tag. This will supply an instance of \"X\" \r\n        equivilant to $dice->create('X'); (using rules for X) to the setDependency method.\r\n        Instance supports named instances as well as class names.\r\n        -->\r\n    <call method=\"setDependency\">\r\n        <instance>X</instance>\r\n    </call>\r\n    <!-- For named instances, supports the instanceof tag. \r\n             See documentation on Named Instances \r\n        -->\r\n    <instanceof>Bar</instanceof>\r\n    <!-- Comma separated list of dependencies which will be created new, ignoring their shared rules -->\r\n    <newinstances>Foo,Bar</newinstances>\r\n    <!-- List of constructor parameters -->\r\n    <construct>\r\n      <param>123</param>\r\n      <param>XYZ</param>\r\n    </construct>\r\n  </rule>\r\n  <rule name=\"bar\">\r\n    <!-- Define rules for the next component -->\r\n  </rule>\r\n</dice>\r\n```\r\n\r\nIt's more readable and easier to write, isn't it?"},"comment":{"url":"https://api.github.com/repos/TomBZombie/Dice/issues/comments/114564659","html_url":"https://github.com/TomBZombie/Dice/issues/61#issuecomment-114564659","issue_url":"https://api.github.com/repos/TomBZombie/Dice/issues/61","id":114564659,"user":{"login":"TomBZombie","id":2454540,"avatar_url":"https://avatars.githubusercontent.com/u/2454540?v=3","gravatar_id":"","url":"https://api.github.com/users/TomBZombie","html_url":"https://github.com/TomBZombie","followers_url":"https://api.github.com/users/TomBZombie/followers","following_url":"https://api.github.com/users/TomBZombie/following{/other_user}","gists_url":"https://api.github.com/users/TomBZombie/gists{/gist_id}","starred_url":"https://api.github.com/users/TomBZombie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomBZombie/subscriptions","organizations_url":"https://api.github.com/users/TomBZombie/orgs","repos_url":"https://api.github.com/users/TomBZombie/repos","events_url":"https://api.github.com/users/TomBZombie/events{/privacy}","received_events_url":"https://api.github.com/users/TomBZombie/received_events","type":"User","site_admin":false},"created_at":"2015-06-23T16:32:28Z","updated_at":"2015-06-23T16:32:28Z","body":"Personally I'd prefer to have the version specified in the xml file itself:\r\n\r\n```xml\r\n<?xml version=\"1.0\"?>\r\n<dice version=\"2.0\">\r\n...\r\n</dice>\r\n```\r\n\r\nThan ask people to call a different method but am happy see either approach implemented\r\n\r\n"}}