2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.ihc.internal.ws.datatypes;
15 import java.io.IOException;
17 import javax.xml.xpath.XPathExpressionException;
19 import org.openhab.binding.ihc.internal.ws.exeptions.IhcExecption;
22 * Class for WSFile complex type.
24 * @author Pauli Anttila - Initial contribution
28 private String filename;
33 public WSFile(byte[] data, String filename) {
35 this.filename = filename;
39 * Gets the data value for this WSFile.
43 public byte[] getData() {
48 * Sets the data value for this WSFile.
52 public void setData(byte[] data) {
57 * Gets the filename value for this WSFile.
61 public String getFilename() {
66 * Sets the filename value for this WSFile.
70 public void setFilename(String filename) {
71 this.filename = filename;
74 public WSFile parseXMLData(String data) throws IhcExecption {
76 filename = XPathUtils.parseXMLValue(data,
77 "/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:getIHCProjectSegment4/ns1:filename");
78 this.data = XPathUtils
79 .parseXMLValue(data, "/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:getIHCProjectSegment4/ns1:data")
82 } catch (IOException | XPathExpressionException e) {
83 throw new IhcExecption("Error occured during XML data parsing", e);