ph-fatturapa

Library for reading and writing fatturaPA documents

Лицензия

Лицензия

Группа

Группа

com.helger
Идентификатор

Идентификатор

ph-fatturapa
Последняя версия

Последняя версия

1.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

ph-fatturapa
Library for reading and writing fatturaPA documents
Ссылка на сайт

Ссылка на сайт

https://github.com/phax/ph-fatturapa
Организация-разработчик

Организация-разработчик

Philip Helger
Система контроля версий

Система контроля версий

http://github.com/phax/ph-fatturapa

Скачать ph-fatturapa

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.helger/ph-fatturapa/ -->
<dependency>
    <groupId>com.helger</groupId>
    <artifactId>ph-fatturapa</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.helger/ph-fatturapa/
implementation 'com.helger:ph-fatturapa:1.2.0'
// https://jarcasting.com/artifacts/com.helger/ph-fatturapa/
implementation ("com.helger:ph-fatturapa:1.2.0")
'com.helger:ph-fatturapa:jar:1.2.0'
<dependency org="com.helger" name="ph-fatturapa" rev="1.2.0">
  <artifact name="ph-fatturapa" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.helger', module='ph-fatturapa', version='1.2.0')
)
libraryDependencies += "com.helger" % "ph-fatturapa" % "1.2.0"
[com.helger/ph-fatturapa "1.2.0"]

Зависимости

compile (5)

Идентификатор библиотеки Тип Версия
com.helger.commons : ph-commons jar
com.helger.commons : ph-xml jar
com.helger.commons : ph-jaxb jar
com.helger.commons : ph-jaxb-adapter jar
com.helger.xsd : ph-xsds-xmldsig jar

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13.1
org.slf4j : slf4j-simple jar 1.7.30
com.sun.xml.bind : jaxb-impl jar

Модули Проекта

Данный проект не имеет модулей.

ph-fatturapa

Java library to easily read and write XML Schema compliant fatturaPA invoices.

Supported versions are:

  • v1.2 (valid until 2020-12-31)
  • v1.2.1 (valid from 2020-10-01)

It is licensed under Apache 2.0 license.

It requires at least Java 8 to be used.

Usage guide

All XML Schema files are converted using JAXB. For version 1.2 the generated types are prefixed with "FPA120", for version 1.2.1 they are prefixed with "FPA121" for easy differentiation.

Read and write fatturaPA invoices

Using the classes FatturaPA120Marshaller and FatturaPA121Marshaller you can read and write fatturaPA invoices. Class FatturaPA120Marshaller handles version 1.2 and class FatturaPA121Marshaller handles version 1.2.1.

Reading

Reading an existing fatturaPA 1.2 from an existing File is as easy as this:

FPA120FatturaElettronicaType aInvoice = new FatturaPA120Marshaller ().read (new File ("invoice.xml"));
if (aInvoice != null) { 
  // Reading was successful
} else {
  // Error handling
}

There are several overloads of read to read from different kind of sources.

Writing

Writing an existing FPA120FatturaElettronicaType is also very simple:

FPA120FatturaElettronicaType aInvoice = ....;
if (new FatturaPA120Marshaller ().write (aInvoice, new File ("new-invoice.xml")).isSuccess ()) { 
  // Writing was successful
} else {
  // Error handling
}

There are several overloads of write to write from different kind of targets and getAs... methods to convert the invoice to different formats.

By default a namespace context is present that uses the "p" prefix for the main element. If you want to change that, see the method setNamespaceContext of the Marshaller classes.

Building from source

To build from source you need Apache Maven and Java 1.8 or later. Just run this on the commandline:

mvn clean install

Usage in an IDE

If you have build errors in your IDE, ensure that you once call mvn process-sources on the project. This will create the Java classes representing the XML schema objects.

Afterwards you might need to manually add the following folders to your buildpath:

  • target/generated-sources/fatturapa120
  • target/generated-sources/fatturapa121

Maven usage

Add the following to your pom.xml to use this artifact, replacing x.y.z with the real version number:

<dependency>
  <groupId>com.helger</groupId>
  <artifactId>ph-fatturapa</artifactId>
  <version>x.y.z</version>
</dependency>

References

News and noteworthy

  • v1.2.0 - 2021-05-02
    • Updated to ph-commons 10.1
  • v1.1.0 - 2021-03-21
    • Updated to ph-commons 10
  • v1.0.3 - 2020-09-17
    • Updated to Jakarta JAXB 2.3.3
  • v1.0.2 - 2020-08-28
    • Using Java 8 date and time classes for JAXB created classes
  • v1.0.1 - 2020-06-30
    • Minor API extension
  • v1.0.0 - 2020-06-17
    • Initial version

My personal Coding Styleguide | On Twitter: @philiphelger | Kindly supported by YourKit Java Profiler

Версии библиотеки

Версия
1.2.0
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0