{"id":17861161,"url":"https://github.com/jonathanstowe/xml-class","last_synced_at":"2025-08-14T14:30:49.625Z","repository":{"id":66980527,"uuid":"52084369","full_name":"jonathanstowe/XML-Class","owner":"jonathanstowe","description":"Role to Serialize/De-Serialize a Raku class to/from XML","archived":false,"fork":false,"pushed_at":"2022-08-07T08:46:20.000Z","size":112,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-22T17:07:00.374Z","etag":null,"topics":["raku","serialisation","xml"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanstowe.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-19T11:49:32.000Z","updated_at":"2022-08-07T08:46:23.000Z","dependencies_parsed_at":"2023-02-25T01:30:53.065Z","dependency_job_id":null,"html_url":"https://github.com/jonathanstowe/XML-Class","commit_stats":null,"previous_names":[],"tags_count":10,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FXML-Class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FXML-Class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FXML-Class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FXML-Class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanstowe","download_url":"https://codeload.github.com/jonathanstowe/XML-Class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229834332,"owners_count":18131454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["raku","serialisation","xml"],"created_at":"2024-10-28T08:43:08.062Z","updated_at":"2024-12-15T14:40:47.874Z","avatar_url":"https://github.com/jonathanstowe.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XML::Class\n\nRole to Serialize/De-Serialize a Raku class to/from XML\n\n![Build Status](https://github.com/jonathanstowe/XML-Class/workflows/CI/badge.svg)\n\n\n## Synopsis\n\n```raku\n\nuse XML::Class;\n\nclass Foo does XML::Class[xml-element =\u003e 'foo', xml-namespace =\u003e \"http://example.com/\"] {\n    has Int $.version = 0;\n    has Str $.zub is xml-element;\n}\n\nmy $f = Foo.new(zub =\u003e \"pow\");\n\nsay $f.to-xml; # \u003c?xml version=\"1.0\"?\u003e\u003cfoo xmlns=\"http://example.com/\" version=\"0\"\u003e\u003czub\u003epow\u003c/zub\u003e\u003c/foo\u003e\n\n\n```\n\n\n## Description\n\nThis provides a relatively easy way to instantiate a Raku object from\nXML and create XML that describes the Raku class in a consistent manner.\n\nIt is somewhat inspired by the XmlSerialization class of the .Net\nframework, but there are other antecedents.\n\nUsing a relatively static definition of the relation between a class\nand XML that represents it means that XML can be consistently parsed\nand generated in a way that should always remain valid to the original\ndescription.\n\nThis module aims to map between Raku object attributes and XML by\nproviding some default behaviours and some attribute traits to alter\nthat behaviour to model the XML.\n\nBy default scalar attributes whose value type can be expressed as an XML\nsimple type (e.g.  strings, real numbers, boolean, datetimes) will be\nserialised as attribute values or (with an ```xml-element``` trait,)\nas elements with simple content.  Positional attributes will always\nbe serialised as a sequence of elements (with an optional container\nspecified by a trait,) likewise associative attributes (though the use\nof these is discouraged as there is no constraint on the names of the\nelements which are taken from the keys of the Hash.)  Raku classes are\nexpressed as XML complex types with the same serialisation as above.\nProvision is also made for the serialisation and de-serialisation of\nother than the builtin types to simple contemt (trivial examples might\nbe Version objects for instance,) and for the handling of data that\nmight be unknown at definition time (such as the xsd:Any in SOAP head\nand body elements,) by the use of \"namespace maps\".\n\nThere are things that explicitly aren't catered for such as  \"mixed\ncontent\" (that is where XML markup may be within text content as in\nXHTML for example,) but that shouldn't be a problem for data storage or\nmessaging applications for the most part.\n\nThe full documentation is available as POD or as\n[Markdown](Documentation.md)\n\n## Installation\n\nAssuming you have a working Rakudo installation you should be able to install this with *zef* :\n\n    # From the source directory\n   \n    zef install .\n\n    # Remote installation\n\n    zef install XML::Class\n\nOther install mechanisms may be become available in the future.\n\n## Support\n\nAlthough there are quite a few tests for this I'm sure they don't\ncover all the possible cases. So if you find something that isn't\ntested for and doesn't work quite as expected please let me know.\n\n\nSuggestions/patches are welcomed via [github](https://github.com/jonathanstowe/XML-Class)\n\n## Licence\n\nThis is free software.\n\nPlease see the [LICENCE](LICENCE) file in the distribution\n\n© Jonathan Stowe 2016 - 2021\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanstowe%2Fxml-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanstowe%2Fxml-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanstowe%2Fxml-class/lists"}