diff --git a/src/main/java/com/kosherjava/zmanim/util/Zman.java b/src/main/java/com/kosherjava/zmanim/util/Zman.java
index 9c415025..22cde870 100644
--- a/src/main/java/com/kosherjava/zmanim/util/Zman.java
+++ b/src/main/java/com/kosherjava/zmanim/util/Zman.java
@@ -1,6 +1,6 @@
/*
* Zmanim Java API
- * Copyright (C) 2004-2020 Eliyahu Hershfeld
+ * Copyright (C) 2004-2024 Eliyahu Hershfeld
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
@@ -54,7 +54,7 @@
* // will sort shaah 1.6, shaah GRA, sunrise, sunset
*
*
- * @author © Eliyahu Hershfeld 2007-2020
+ * @author © Eliyahu Hershfeld 2007-2024
* @todo Add secondary sorting. As of now the {@code Comparator}s in this class do not sort by secondary order. This means that when sorting a
* {@link java.util.Collection} of zmanim and using the {@link #DATE_ORDER} {@code Comparator} will have the duration based zmanim
* at the end, but they will not be sorted by duration. This should be N/A for label based sorting.
@@ -230,12 +230,39 @@ public int compare(Zman zman1, Zman zman2) {
return firstDuration == secondDuration ? 0 : firstDuration > secondDuration ? 1 : -1;
}
};
+
+ /**
+ * A method that returns an XML formatted String
representing the serialized Object
. Very
+ * similar to the toString method but the return value is in an xml format. The format currently used (subject to
+ * change) is:
+ *
+ *
+ * <Zman> + * <Label>Sof Zman Krias Shema GRA</Label> + * <Zman>1969-02-08T09:37:56.820</Zman> + * <Duration>0</Duration> + * <Description>Sof Zman Krias Shema GRA is 3 sha'os zmaniyos calculated from sunrise to sunset.</Description> + * </Zman> + *+ * @return The XML formatted
String
.
+ */
+ public String toXML() {
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+ StringBuilder sb = new StringBuilder();
+ sb.append("