2 * Copyright (c) 2010-2022 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 WSControllerState complex type.
24 * @author Pauli Anttila - Initial contribution
27 public class WSControllerState {
30 public WSControllerState() {
33 public WSControllerState(String state) {
38 * Gets the state value for this WSControllerState.
42 public String getState() {
47 * Sets the state value for this WSControllerState.
51 public void setState(String state) {
55 public WSControllerState parseXMLData(String data) throws IhcExecption {
57 if (data.contains("getState1")) {
58 state = XPathUtils.parseXMLValue(data, "/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:getState1/ns1:state");
59 } else if (data.contains("waitForControllerStateChange3")) {
60 state = XPathUtils.parseXMLValue(data,
61 "/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:waitForControllerStateChange3/ns1:state");
63 throw new IhcExecption("Encoding error, unsupported data");
66 } catch (IOException | XPathExpressionException e) {
67 throw new IhcExecption("Error occured during XML data parsing", e);