{"id":16096845,"url":"https://github.com/simon04/jelementtree","last_synced_at":"2025-04-05T21:16:18.942Z","repository":{"id":28582416,"uuid":"32100411","full_name":"simon04/jelementtree","owner":"simon04","description":"An easy-to-use Java library for working with XML in a pythonic way","archived":false,"fork":false,"pushed_at":"2016-11-10T08:09:05.000Z","size":8,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T00:08:57.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/simon04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-12T20:24:30.000Z","updated_at":"2021-11-17T04:53:04.000Z","dependencies_parsed_at":"2022-08-01T21:29:41.093Z","dependency_job_id":null,"html_url":"https://github.com/simon04/jelementtree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon04%2Fjelementtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon04%2Fjelementtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon04%2Fjelementtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon04%2Fjelementtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simon04","download_url":"https://codeload.github.com/simon04/jelementtree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399884,"owners_count":20932880,"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":[],"created_at":"2024-10-09T17:25:38.855Z","updated_at":"2025-04-05T21:16:18.916Z","avatar_url":"https://github.com/simon04.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JElementTree\nJElementTree is an easy-to-use Java library for working with XML in a pythonic way. A big advantage is its powerful, but minimalistic implementation. There is one class, ElementTree, you'll be confronted with.\n\n## Features\n* no additional library required\n* hierarchical representation of XML tree\n* lightweight namespace support\n* simple XPath support\n* parsing XML documents (currently based on StAX from JDK 1.6)\n* method chaining like Java's StringBuilder\n\n## Origin\nThe concept originates from the ElementTree package of Python which can be found on http://effbot.org/zone/element-index.htm\n\n## Examples\n### Example 1: construction of KML document\nThe following two different codes will a tiny KML document.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003ckml xmlns=\"http://earth.google.com/kml/2.2\"\u003e\n  \u003cDocument\u003e\n    \u003cname\u003eWorld\u003c/name\u003e\n    \u003cFolder\u003e\n      \u003cname\u003eAustria\u003c/name\u003e\n      \u003cPlacemark\u003e\n        \u003cname\u003eInnsbruck\u003c/name\u003e\n        \u003cPoint\u003e\n          \u003ccoordinates\u003e11.40,47.26\u003c/coordinates\u003e\n        \u003c/Point\u003e\n      \u003c/Placemark\u003e\n    \u003c/Folder\u003e\n  \u003c/Document\u003e\n\u003c/kml\u003e\n```\n\n```java\nString xml = new ElementTree(\"kml\").setNamespace(\"http://earth.google.com/kml/2.2\").\n                createChild(\"Document\").\n                createChild(\"name\").\n                setText(\"World\").\n                getParent().\n                createChild(\"Folder\").\n                createChild(\"name\").\n                setText(\"Austria\").\n                getParent().\n                createChild(\"Placemark\").\n                createChild(\"name\").\n                setText(\"Innsbruck\").\n                getParent().\n                createChild(\"Point\").\n                createChild(\"coordinates\").\n                setText(\"11.40,47.26\").\n                getRoot().\n                toXML();\n```\n```java\nString xml2 = new ElementTree(\"kml\").setNamespace(\"http://earth.google.com/kml/2.2\").\n                createChild(\"Document\").\n                addChild(new ElementTree(\"name\").setText(\"World\")).\n                createChild(\"Folder\").\n                addChild(new ElementTree(\"name\").setText(\"Austria\")).\n                createChild(\"Placemark\").\n                addChild(new ElementTree(\"name\").setText(\"Innsbruck\")).\n                createChild(\"Point\").\n                addChild(new ElementTree(\"coordinates\").setText(\"11.40,47.26\")).\n                getRoot().\n                toXML();\n```\n\n### Example 2: geocoding with OpenStreetMap\n```java\nElementTree geo = ElementTree.fromStream(new URI(\"http://nominatim.openstreetmap.org/search?format=xml\u0026q=innsbruck\").toURL().openStream());\nfor (ElementTree i : geo.findAll(\"//place\")) {\n        System.out.println(i.getAttribute(\"display_name\"));\n        System.out.println(\"\\t\" + i.getAttribute(\"lon\") + \",\" + i.getAttribute(\"lat\"));\n}\n```\n\n```\nInnsbruck, Innsbruck-Stadt, Tirol, Österreich, Europe\n        11.3936859,47.2656269\nInnsbruck, Innsbruck-Stadt, Tirol, Österreich\n        11.3936828,47.26565\nInnsbruck, Carroll, United States of America\n        -71.1338615946084,43.5341678362733\nInnsbruck, Aspenhoff, Warren, Missouri, United States of America\n        -91.1552550683042,38.6957456083531\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimon04%2Fjelementtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimon04%2Fjelementtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimon04%2Fjelementtree/lists"}