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 WSNumberOfSegments complex type.
24 * @author Pauli Anttila - Initial contribution
26 public class WSNumberOfSegments {
30 public WSNumberOfSegments() {
33 public WSNumberOfSegments(int segments) {
34 this.segments = segments;
38 * Gets the number of segments.
40 * @return segmentation size
42 public int getNumberOfSegments() {
47 * Sets the number of segmentations.
51 public void setNumberOfSegments(int segments) {
52 this.segments = segments;
55 public WSNumberOfSegments parseXMLData(String data) throws IhcExecption {
57 String value = XPathUtils.parseXMLValue(data,
58 "/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:getIHCProjectNumberOfSegments1");
59 setNumberOfSegments(Integer.parseInt(value));
61 } catch (IOException | XPathExpressionException | NumberFormatException e) {
62 throw new IhcExecption("Error occured during XML data parsing", e);