Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit b5f1c56

Browse files
author
weissarn
committed
Add basic structure of the aasx-validator
1 parent 25936a3 commit b5f1c56

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

dataformat-aasx/src/main/java/io/adminshell/aas/v3/dataformat/aasx/AASXDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public AssetAdministrationShellEnvironment read() throws InvalidFormatException,
9090
* @throws InvalidFormatException
9191
* @throws IOException
9292
*/
93-
private String getXMLResourceString(OPCPackage aasxPackage) throws InvalidFormatException, IOException {
93+
public String getXMLResourceString(OPCPackage aasxPackage) throws InvalidFormatException, IOException {
9494

9595
// Get the "/aasx/aasx-origin" Part. It is Relationship source for the
9696
// XML-Document
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.adminshell.aas.v3.dataformat.aasx;
17+
18+
import io.adminshell.aas.v3.dataformat.xml.XmlSchemaValidator;
19+
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
20+
import org.apache.poi.openxml4j.opc.OPCPackage;
21+
import org.xml.sax.SAXException;
22+
23+
import java.io.IOException;
24+
import java.io.InputStream;
25+
import java.util.Set;
26+
27+
public class AASXValidator {
28+
29+
private XmlSchemaValidator xmlValidator;
30+
private AASXDeserializer deserializer;
31+
32+
public AASXValidator(InputStream is) throws SAXException, IOException, InvalidFormatException {
33+
this.xmlValidator = new XmlSchemaValidator();
34+
this.deserializer = new AASXDeserializer(is);
35+
}
36+
37+
public Set<String> validateSchema(OPCPackage p) throws IOException, InvalidFormatException {
38+
String file = deserializer.getXMLResourceString(p);
39+
return xmlValidator.validateSchema(file);
40+
}
41+
42+
}

0 commit comments

Comments
 (0)