[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-libeufin] 09/25: load xsd from resources
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-libeufin] 09/25: load xsd from resources |
Date: |
Fri, 20 Sep 2019 19:32:47 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
commit fd23fea563a0bf63c40c8ab4563eb319030e2ffc
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sun Sep 15 18:40:45 2019 +0200
load xsd from resources
---
src/main/java/tech/libeufin/XMLManagement.java | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/main/java/tech/libeufin/XMLManagement.java
b/src/main/java/tech/libeufin/XMLManagement.java
index 0c21cc9..0d883d2 100644
--- a/src/main/java/tech/libeufin/XMLManagement.java
+++ b/src/main/java/tech/libeufin/XMLManagement.java
@@ -25,13 +25,22 @@ public class XMLManagement {
* Load all the XSDs from disk.
*/
public XMLManagement(){
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
- Source ebics_hev_file = new StreamSource(new
File("resources/ebics_hev.xsd"));
- Source xsds[] = {ebics_hev_file};
- SchemaFactory sf = new
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ File ebics_hev_file = new
File(classLoader.getResource("ebics_hev.xsd").getFile());
+ // other schemas in other similar lines ..
+
+ /* Ideally, there will be a method that return some "iterable"
+ * object for all the files in the resources directory. */
+
+ Source schemas[] = {
+ new StreamSource(ebics_hev_file)
+ // other StreamSources for other schemas here ..
+ };
+ SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
try{
- this.bundle = sf.newSchema(xsds);
+ this.bundle = sf.newSchema(schemas;
this.validator = this.bundle.newValidator();
} catch (IOException e){
System.out.println("Could not import all XSDs from disk" + "(" + e
+ ")");
@@ -47,6 +56,6 @@ public class XMLManagement {
System.out.println("Could not pass XML to validator.");
return false;
}
-
+ return true;
}
};
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [taler-libeufin] branch master created (now 62598ec), gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 04/25: Instructions for running under MS Windows., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 08/25: Drafting XSD import from disk, and XML validation., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 02/25: instructions for running the sandbox, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 09/25: load xsd from resources,
gnunet <=
- [GNUnet-SVN] [taler-libeufin] 07/25: Test stub., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 06/25: readme, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 05/25: Copyright header., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 01/25: Import initial project structure., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 10/25: fix resource loading, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 03/25: AGPL license, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 12/25: Local test of XML validation., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 11/25: import sample hev, gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 14/25: Test with XML imported from string., gnunet, 2019/09/20
- [GNUnet-SVN] [taler-libeufin] 13/25: fix test, gnunet, 2019/09/20