{"id":25806013,"url":"https://github.com/alipsa/sieparser","last_synced_at":"2026-04-19T22:20:02.662Z","repository":{"id":57722047,"uuid":"72979559","full_name":"Alipsa/SIEParser","owner":"Alipsa","description":"Java port of the .NET jsisie project at https://github.com/idstam/jsisie","archived":false,"fork":false,"pushed_at":"2016-12-10T17:53:27.000Z","size":911,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-01T11:27:03.540Z","etag":null,"topics":["accounting","java","parser"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alipsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-06T09:55:41.000Z","updated_at":"2023-07-22T12:02:39.000Z","dependencies_parsed_at":"2022-09-26T21:50:29.941Z","dependency_job_id":null,"html_url":"https://github.com/Alipsa/SIEParser","commit_stats":null,"previous_names":["pernyfelt/sieparser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2FSIEParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2FSIEParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2FSIEParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2FSIEParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alipsa","download_url":"https://codeload.github.com/Alipsa/SIEParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241052529,"owners_count":19901043,"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":["accounting","java","parser"],"created_at":"2025-02-27T19:52:38.964Z","updated_at":"2026-04-19T22:20:02.649Z","avatar_url":"https://github.com/Alipsa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"SIEParser\n=========\n\nA Java library for reading, writing, and comparing [SIE](https://sie.se/) files (the Swedish standard accounting file format). Supports SIE types 1 through 4 (including 4i) and SIE 5 (XML format).\n\nOriginally ported from the .NET [jsisie](https://github.com/idstam/jsisie) parser.\nVersion 2.0 has been substantially modernized: all upstream fixes ported, Java 17+ APIs adopted, and test coverage expanded.\nSeveral spec compliance fixes have also been applied, bringing the parser to full spec compliance.\n\n## Requirements\n\n- Java 17 or later\n- Gradle 9+ (wrapper included)\n\n## Installation\n\n**Gradle:**\n```groovy\nimplementation 'se.alipsa:SieParser:2.1.0'\n```\n\n**Maven:**\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n    \u003cartifactId\u003eSieParser\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003e **Note:** Prior to version 2.0, this library was published under `com.github.pernyfelt.sieparser:SieParser`.\n\u003e The old coordinates include a relocation POM pointing to the new group ID.\n\n## Read a SIE file\n\n```java\nSieDocumentReader reader = new SieDocumentReader();\nSieDocument doc = reader.readDocument(\"path/to/file.SE\");\n\n// Company info\nString companyName = doc.getFNAMN().getName();\nString orgNr = doc.getFNAMN().getOrgIdentifier();\n\n// Accounts\nfor (SieAccount account : doc.getKONTO().values()) {\n    System.out.println(account.getNumber() + \" \" + account.getName());\n}\n\n// Vouchers (SIE type 4)\nfor (SieVoucher voucher : doc.getVER()) {\n    System.out.println(voucher.getSeries() + \" \" + voucher.getNumber());\n    for (SieVoucherRow row : voucher.getRows()) {\n        System.out.println(\"  \" + row.getAccount().getNumber() + \" \" + row.getAmount());\n    }\n}\n```\n\n### Reader options\n\nThe following flags on `SieDocumentReader` control parsing behavior:\n\n| Flag                      | Default | Description                                                                       |\n|---------------------------|---------|-----------------------------------------------------------------------------------|\n| `ignoreMissingOMFATTNING` | `false` | Skip validation of missing `#OMFATTN`                                             |\n| `ignoreBTRANS`            | `false` | Ignore `#BTRANS` (removed transaction) rows                                       |\n| `ignoreRTRANS`            | `false` | Ignore `#RTRANS` (added transaction) rows                                         |\n| `allowUnbalancedVoucher`  | `false` | Skip the zero-sum check on voucher rows                                           |\n| `ignoreKSUMMA`            | `false` | Skip `#KSUMMA` checksum verification                                              |\n| `ignoreMissingDIM`        | `false` | Allow unresolved temporary dimensions                                             |\n| `streamValues`            | `false` | Don't store values internally; use callbacks instead                              |\n| `throwErrors`             | `true`  | Throw exceptions on errors (when `false`, collect in `getValidationExceptions()`) |\n\nYou can also restrict which SIE types are accepted:\n\n```java\nreader.setAcceptSIETypes(EnumSet.of(SieType.TYPE_4));\n```\n\n### Streaming with callbacks\n\nFor large files, use callbacks to process records without storing them all in memory:\n\n```java\nSieDocumentReader reader = new SieDocumentReader();\nreader.setStreamValues(true);\nreader.getCallbacks().setVER(voucher -\u003e {\n    // Process each voucher as it is parsed\n});\nreader.getCallbacks().setIB(periodValue -\u003e {\n    // Process each opening balance entry\n});\nreader.readDocument(\"large-file.SE\");\n```\n\n## Write a SIE file\n\n```java\nSieDocumentWriter writer = new SieDocumentWriter(doc);\n\n// Write to a file\nwriter.write(\"output.SE\");\n\n// Or write to an OutputStream\nwriter.write(outputStream);\n```\n\nTo enable `#KSUMMA` checksum writing:\n\n```java\nWriteOptions options = new WriteOptions();\noptions.setWriteKSUMMA(true);\nSieDocumentWriter writer = new SieDocumentWriter(doc, options);\nwriter.write(\"output.SE\");\n```\n\n## Compare SIE documents\n\n```java\nList\u003cString\u003e differences = SieDocumentComparer.compare(docA, docB);\nif (differences.isEmpty()) {\n    System.out.println(\"Documents are identical\");\n} else {\n    differences.forEach(System.out::println);\n}\n```\n\n## SIE 5 (XML format)\n\nSIE 5 is the XML-based successor to SIE 1-4. It uses the `http://www.sie.se/sie5` namespace and supports a richer data model including customer/supplier invoices, fixed assets, multi-currency, and documents.\n\nAll SIE 5 classes are in the `alipsa.sieparser.sie5` package.\n\n### Read a SIE 5 file\n\n```java\nSie5DocumentReader reader = new Sie5DocumentReader();\n\n// Full document\nSie5Document doc = reader.readDocument(\"path/to/file.sie\");\nString companyName = doc.getFileInfo().getCompany().getName();\nString currency = doc.getFileInfo().getAccountingCurrency().getCurrency();\n\nfor (Account account : doc.getAccounts()) {\n    System.out.println(account.getId() + \" \" + account.getName() + \" (\" + account.getType() + \")\");\n}\n\nfor (Journal journal : doc.getJournals()) {\n    for (JournalEntry entry : journal.getJournalEntries()) {\n        System.out.println(entry.getJournalDate() + \" \" + entry.getText());\n    }\n}\n\n// Entry (import) document\nSie5Entry entry = reader.readEntry(\"path/to/entry.sie\");\n```\n\n`Sie5DocumentReader` verifies signatures using XMLDSig secure validation by default.  \nIf you need to read legacy SIE 5 documents signed with deprecated algorithms (for example RSA-SHA1), enable compatibility mode explicitly:\n\n```java\nreader.setAllowLegacyInsecureSignatureAlgorithms(true);\n```\n\n### Write a SIE 5 file\n\n```java\nPrivateKey privateKey = ...;\nX509Certificate certificate = ...;\nSie5SigningCredentials credentials = new Sie5SigningCredentials(privateKey, certificate);\nSie5DocumentWriter writer = new Sie5DocumentWriter(credentials);\n\n// Write full document\nwriter.write(doc, \"output.sie\");\n\n// Write entry document\nwriter.writeEntry(entry, \"output-entry.sie\");\n\n// Or write to an OutputStream\nwriter.write(doc, outputStream);\n```\n\n### Build a SIE 5 document programmatically\n\n```java\nSie5Entry entry = new Sie5Entry();\n\nFileInfoEntry fileInfo = new FileInfoEntry();\nSoftwareProduct sp = new SoftwareProduct();\nsp.setName(\"MyApp\");\nsp.setVersion(\"1.0\");\nfileInfo.setSoftwareProduct(sp);\n\nCompanyEntry company = new CompanyEntry();\ncompany.setOrganizationId(\"556789-1234\");\ncompany.setName(\"Demo AB\");\nfileInfo.setCompany(company);\n\nentry.setFileInfo(fileInfo);\n\nAccountEntry acc = new AccountEntry();\nacc.setId(\"1910\");\nacc.setName(\"Kassa\");\nacc.setType(AccountTypeValue.ASSET);\nentry.setAccounts(List.of(acc));\n\nnew Sie5DocumentWriter().writeEntry(entry, \"new-entry.sie\");\n```\n\n## SIE specification\n\nThe SIE file format is defined by SIE-gruppen (formerly SIE-föreningen). The specification is available at [sie.se](https://sie.se/).\n\nEven if you use this parser, you should familiarize yourself with the file specification to understand the data model.\n\n## Spec compliance\n\nThis implementation targets full compliance with the bundled specifications:\n\n- `docs/SIE_filformat_ver_4B_080930.pdf` (SIE 1-4)\n- `docs/SIE-5-rev-161209-konsoliderad.pdf` (SIE 5)\n\nAll identified compliance issues have been resolved. See [`spec-compliance-report.md`](spec-compliance-report.md) for a detailed list of issues and their fix status. Coverage includes strict `#KSUMMA` CRC handling, SIE 4 `#RTRANS`/mirror-`#TRANS` behavior, mandatory-field and forbidden-record validation, and SIE 5 XML digital signature writing and verification for full documents.\n\n## License\n\nMIT License. See [LICENSE](LICENSE) or the file headers for details.\n\n## Change log\n\nSee [release.md](release.md) for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Fsieparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falipsa%2Fsieparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Fsieparser/lists"}