2 * Copyright (c) 2015. Developed by Hedgecode.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.hedgecode.xml.xspf;
19 import java.nio.charset.Charset;
20 import java.nio.charset.StandardCharsets;
21 import javax.xml.namespace.QName;
24 * Store of library constants.
26 * @author Dmitry Samoshin aka gotty
28 public final class XSPFConstants {
30 public static final Charset DEF_CHARSET = StandardCharsets.UTF_8;
32 public static final String XSD_FORMAT = "xsd";
33 public static final String RNG_FORMAT = "rng";
35 public static enum Format {
38 RELAX_NG ( RNG_FORMAT );
40 private String formatName;
43 this.formatName = name;
46 public String getName() {
50 public static Format byName(String formatName) {
51 for (Format format : Format.values()) {
52 if (format.getName().equals(formatName))
59 public static final String VER_1_0_2 = "1_0.2";
60 public static final String VER_1_0_7 = "1_0.7";
62 public static enum Version {
67 private String versionName;
69 Version(String name) {
70 this.versionName = name;
73 public String getName() {
77 public static Version byName(String versionName) {
78 for (Version version : Version.values()) {
79 if (version.getName().equals(versionName))
86 public static final String XSPF_VERSION = "1";
88 public static final QName PLAYLIST_QNAME = new QName("http://xspf.org/ns/0/", "playlist");
90 public static final String XML_HEADER_NAME = "com.sun.xml.internal.bind.xmlHeaders";
91 public static final String XML_HEADER_VALUE = "<?xml version=\"1.0\" encoding=\"%CHARSET%\"?>";
94 public static interface Errors {
95 public static final int NULL_PLAYLIST = 101;
96 public static final int VALIDATE_ERROR = 201;
97 public static final int BINDING_ERROR = 301;
98 public static final int ENCODING_ERROR = 401;
101 private XSPFConstants() {
102 throw new AssertionError(
103 "No org.hedgecode.xml.xspf.XSPFConstants instances!"