Skip to content

Commit 9d2bfa0

Browse files
add docs
1 parent 85d4ce8 commit 9d2bfa0

File tree

8 files changed

+87
-6
lines changed

8 files changed

+87
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# XBuilder
88

9-
Java library for creating XML files based on UBL standards.
9+
Java library for creating and signing XML files based on UBL standards.
1010

1111
XBuilder can be found in [Maven Central](https://mvnrepository.com/artifact/io.github.project-openubl/xbuilder)
1212

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/docs/create_xml.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
id: create_xml
3+
title: Create XML
4+
---
5+
6+
Before creating an XML you need to decide which type of XML you will create; there are multiple types of XML files like:
7+
8+
- Invoices
9+
- Credit notes
10+
- Debit notes, etc.
11+
12+
Once you decided which type of document you want to create:
13+
14+
- Create your input POJO
15+
- Send your POJO to `DocumentManager`
16+
17+
```java
18+
// Create Invoice
19+
DocumentWrapper<InvoiceOutputModel> result = DocumentManager.createXML(input, config, systemClock);
20+
21+
InvoiceOutputModel output = result.getOutput(); // XML Var values
22+
String xml = result.getXml(); // XML content
23+
```
24+
25+
## A fully working example
26+
27+
A fully working example of how to create an XML file is located in:
28+
29+
- [Example](./example)

docs/docs/example.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,18 @@ The content of the variable `xml` will be:
207207
</cac:InvoiceLine>
208208
</Invoice>
209209
```
210+
211+
## Sign XML
212+
213+
For signing a XML you need to load your `X509Certificate` and `PrivateKey` using the method of your preference.
214+
215+
```java
216+
String xml; // This is comes from the example above
217+
String signID = "mySignID"; // Your Signature ID
218+
219+
// Get your certificate using the method of your preference
220+
X509Certificate certificate;
221+
PrivateKey privateKey;
222+
223+
Document signedXML = XMLSigner.signXML(xml, signID, certificate, privateKey);
224+
```

docs/docs/sign_xml.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
id: sign_xml
3+
title: Sign XML
4+
---
5+
6+
For signing a XML you need to load your `X509Certificate` and `PrivateKey` using the method of your preference.
7+
8+
```java
9+
String xml; // Use docs for create an XML
10+
String signID = "mySignID"; // Your Signature ID
11+
12+
// Get your certificate using the method of your preference
13+
X509Certificate certificate;
14+
PrivateKey privateKey;
15+
16+
Document signedXML = XMLSigner.signXML(xml, signID, certificate, privateKey);
17+
```

docs/docusaurus.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
title: "XBuilder",
3-
tagline: "Java library for creating XML files based on Universal Bussiness Language (UBL)",
3+
tagline: "Java library for creating and signing XML files based on Universal Bussiness Language (UBL)",
44
url: "https://project-openubl.github.io/xbuilder-docs/",
55
baseUrl: "/xbuilder-docs/",
66
favicon: "img/favicon.ico",
@@ -86,13 +86,13 @@ module.exports = {
8686
sidebarPath: require.resolve("./sidebars.js"),
8787
// Please change this to your repo.
8888
editUrl:
89-
"https://github.com/facebook/docusaurus/edit/master/website/",
89+
"https://github.com/project-openubl/xbuilder/edit/master/docs/",
9090
},
9191
blog: {
9292
showReadingTime: true,
9393
// Please change this to your repo.
9494
editUrl:
95-
"https://github.com/facebook/docusaurus/edit/master/website/blog/",
95+
"https://github.com/project-openubl/xbuilder/edit/master/docs/blog/",
9696
},
9797
theme: {
9898
customCss: require.resolve("./src/css/custom.css"),

docs/sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module.exports = {
22
someSidebar: {
33
XBuilder: ["introduction", "design_principles", "contributing"],
44
"Getting started": ["installation", "example"],
5-
Guides: ["concepts"],
5+
Guides: ["concepts", "create_xml", "sign_xml"],
66
},
77
};

docs/src/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function Home() {
6363
return (
6464
<Layout
6565
title={`${siteConfig.title}`}
66-
description="Java library for creating XML files based on Universal Bussiness Language (UBL) <head />"
66+
description="Java library for creating and signing XML files based on Universal Bussiness Language (UBL) <head />"
6767
>
6868
<header className={clsx("hero hero--primary", styles.heroBanner)}>
6969
<div className="container">

0 commit comments

Comments
 (0)