franta-hg@88: /** franta-hg@88: * Alt2XML franta-hg@88: * Copyright © 2014 František Kučera (frantovo.cz) franta-hg@88: * franta-hg@88: * This program is free software: you can redistribute it and/or modify franta-hg@88: * it under the terms of the GNU General Public License as published by franta-hg@111: * the Free Software Foundation, version 3 of the License. franta-hg@88: * franta-hg@88: * This program is distributed in the hope that it will be useful, franta-hg@88: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@88: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@88: * GNU General Public License for more details. franta-hg@88: * franta-hg@88: * You should have received a copy of the GNU General Public License franta-hg@88: * along with this program. If not, see . franta-hg@88: */ franta-hg@88: package cz.frantovo.alt2xml.in; franta-hg@88: franta-hg@88: /** franta-hg@88: * franta-hg@88: * @author Ing. František Kučera (frantovo.cz) franta-hg@88: */ franta-hg@88: public class Functions { franta-hg@88: franta-hg@88: /** franta-hg@88: * TODO: real lossless encoding + decoding (this is just a dummy code) franta-hg@88: * franta-hg@88: * @param name any string franta-hg@88: * @return valid name of XML element or attribute franta-hg@88: */ franta-hg@88: public static String encodeXmlName(String name) { franta-hg@89: if (name == null) { franta-hg@89: return String.valueOf(name); franta-hg@89: } else { franta-hg@89: return name.replaceAll("\\s", "-"); franta-hg@89: } franta-hg@88: } franta-hg@88: franta-hg@88: private Functions() { franta-hg@88: } franta-hg@88: }