diff --git a/.editorconfig b/.editorconfig
index a798a08..d950a5e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -13,5 +13,5 @@ trim_trailing_whitespace = true
[{*.yml,*.json,gradlew}]
indent_size = 2
-[{*.yml,*.md,*.txt}]
+[{*.yml,*.md,*.txt,*.kts}]
max_line_length = off
diff --git a/.gitignore b/.gitignore
index 9d4419f..53ad9dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,7 @@
/.idea/uiDesigner.xml
/.idea/vcs.xml
/.idea/workspace.xml
-/.idea/xmpcore.iml
+/.idea/*.iml
/.kotlin/
/build/
/local.properties
diff --git a/README.md b/README.md
index 7592d33..d5ae5ac 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,6 @@



-[](https://maven-badges.herokuapp.com/maven-central/com.ashampoo/xmpcore)
This library is a port of Adobe's XMP SDK to Kotlin Multiplatform by Ashampoo.
@@ -19,7 +18,7 @@ It's part of [Ashampoo Photo Organizer](https://ashampoo.com/photo-organizer).
## Installation
```
-implementation("com.ashampoo:xmpcore:1.6.0")
+implementation("com.ashampoo:xmpcore:1.6.1")
```
## How to use
diff --git a/build.gradle.kts b/build.gradle.kts
index b834ccc..22eb0df 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -311,8 +311,12 @@ mavenPublishing {
developers {
developer {
- name = "Software Rangers GmbH"
- url = "https://software-rangers.com/"
+ name = "Stefan Oltmann"
+ url = "https://stefan-oltmann.de/"
+ organization = "Software Rangers GmbH"
+ organizationUrl = "https://software-rangers.com/"
+ roles = listOf("maintainer", "developer")
+ properties = mapOf("github" to "StefanOltmann")
}
}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index d8a0ce0..a3da164 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -17,7 +17,7 @@ maven-publish = "0.34.0"
resources = "0.10.1"
# Libraries
-xmlutil = "0.91.1"
+xmlutil = "0.91.2"
kotlinx-io = "0.8.0"
[libraries]
diff --git a/src/commonMain/kotlin/com/ashampoo/xmp/XMPVersionInfo.kt b/src/commonMain/kotlin/com/ashampoo/xmp/XMPVersionInfo.kt
index 514cd11..14b60a9 100644
--- a/src/commonMain/kotlin/com/ashampoo/xmp/XMPVersionInfo.kt
+++ b/src/commonMain/kotlin/com/ashampoo/xmp/XMPVersionInfo.kt
@@ -9,7 +9,7 @@ public object XMPVersionInfo {
public const val MAJOR: Int = 1
public const val MINOR: Int = 6
- public const val PATCH: Int = 0
+ public const val PATCH: Int = 1
public const val VERSION_MESSAGE: String =
"Ashampoo XMP Core $MAJOR.$MINOR.$PATCH"
diff --git a/src/commonMain/kotlin/com/ashampoo/xmp/internal/DomParser.kt b/src/commonMain/kotlin/com/ashampoo/xmp/internal/DomParser.kt
index d18033f..37ad4de 100644
--- a/src/commonMain/kotlin/com/ashampoo/xmp/internal/DomParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/xmp/internal/DomParser.kt
@@ -12,6 +12,9 @@ internal object DomParser {
private const val RDF_RDF_END = ""
+ private const val SINGLE_SELF_CLOSING_RDF_TAG =
+ """"""
+
@OptIn(XmlUtilInternal::class, ExperimentalXmlUtilApi::class)
fun parseDocumentFromString(input: String): Document {
@@ -39,20 +42,37 @@ internal object DomParser {
if (rdfStartPos == -1)
throw XMPException("String ' the document may contain a single self-closing RDF tag.
+ */
+ if (input.contains(SINGLE_SELF_CLOSING_RDF_TAG))
+ return parseDocumentFromStringInternal(SINGLE_SELF_CLOSING_RDF_TAG)
+
throw XMPException("String '' was not found in XMP.", XMPErrorConst.BADXMP)
+ }
val trimmedInput = input.substring(
rdfStartPos until rdfEndPos + RDF_RDF_END.length
)
+ return parseDocumentFromStringInternal(trimmedInput)
+ }
+
+ @OptIn(ExperimentalXmlUtilApi::class)
+ private fun parseDocumentFromStringInternal(input: String): Document {
+
+ if (input.isBlank())
+ throw XMPException("XMP is empty.", XMPErrorConst.BADXMP)
+
try {
val document = xmlStreaming.genericDomImplementation.createDocument()
val writer = xmlStreaming.newWriter(document)
- val reader = xmlStreaming.newReader(trimmedInput)
+ val reader = xmlStreaming.newReader(input)
do {
val event = reader.next()
diff --git a/src/commonTest/kotlin/com/ashampoo/xmp/RewriteXmpTest.kt b/src/commonTest/kotlin/com/ashampoo/xmp/RewriteXmpTest.kt
index fec78ba..c8865cf 100644
--- a/src/commonTest/kotlin/com/ashampoo/xmp/RewriteXmpTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/xmp/RewriteXmpTest.kt
@@ -230,7 +230,7 @@ class RewriteXmpTest {
* triggers XMPNormalizer.tweakOldXMP()
*/
- const val TEST_PHOTO_COUNT = 109
+ const val TEST_PHOTO_COUNT = 110
private const val RESOURCE_PATH: String = "src/commonTest/resources/com/ashampoo/xmp"
}
diff --git a/src/commonTest/resources/com/ashampoo/xmp/README b/src/commonTest/resources/com/ashampoo/xmp/README
index 0dab985..6561904 100644
--- a/src/commonTest/resources/com/ashampoo/xmp/README
+++ b/src/commonTest/resources/com/ashampoo/xmp/README
@@ -35,3 +35,6 @@ Triggers XMPNormalizer.tweakOldXMP()
# sample_101.xml to sample_109.xmp
Collection of problematic files from QA
+
+# sample_110.xml
+File that has a RDF with self-closing tag
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_100_formatted_canonical.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_100_formatted_canonical.xmp
index 1119b79..163510b 100644
--- a/src/commonTest/resources/com/ashampoo/xmp/sample_100_formatted_canonical.xmp
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_100_formatted_canonical.xmp
@@ -1,5 +1,5 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_110_canonical_to_compact.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_110_canonical_to_compact.xmp
new file mode 100644
index 0000000..1af3d77
--- /dev/null
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_110_canonical_to_compact.xmp
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_110_compact_to_canonical.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_110_compact_to_canonical.xmp
new file mode 100644
index 0000000..1af3d77
--- /dev/null
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_110_compact_to_canonical.xmp
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_110_formatted_canonical.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_110_formatted_canonical.xmp
new file mode 100644
index 0000000..b3be1ea
--- /dev/null
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_110_formatted_canonical.xmp
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_110_formatted_compact.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_110_formatted_compact.xmp
new file mode 100644
index 0000000..b3be1ea
--- /dev/null
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_110_formatted_compact.xmp
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_110_roundtrip_canonical.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_110_roundtrip_canonical.xmp
new file mode 100644
index 0000000..1af3d77
--- /dev/null
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_110_roundtrip_canonical.xmp
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_110_roundtrip_compact.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_110_roundtrip_compact.xmp
new file mode 100644
index 0000000..1af3d77
--- /dev/null
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_110_roundtrip_compact.xmp
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_11_formatted_canonical.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_11_formatted_canonical.xmp
index 3cb4739..4cec581 100644
--- a/src/commonTest/resources/com/ashampoo/xmp/sample_11_formatted_canonical.xmp
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_11_formatted_canonical.xmp
@@ -1,5 +1,5 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_13_formatted_compact.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_13_formatted_compact.xmp
index 181bbd0..554e0b3 100644
--- a/src/commonTest/resources/com/ashampoo/xmp/sample_13_formatted_compact.xmp
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_13_formatted_compact.xmp
@@ -1,5 +1,5 @@
-
+
-
+
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_14_formatted_compact.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_14_formatted_compact.xmp
index 8c758af..25c3884 100644
--- a/src/commonTest/resources/com/ashampoo/xmp/sample_14_formatted_compact.xmp
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_14_formatted_compact.xmp
@@ -1,5 +1,5 @@
-
+
-
+
diff --git a/src/commonTest/resources/com/ashampoo/xmp/sample_15_formatted_compact.xmp b/src/commonTest/resources/com/ashampoo/xmp/sample_15_formatted_compact.xmp
index 57a1cf1..f3db2bc 100644
--- a/src/commonTest/resources/com/ashampoo/xmp/sample_15_formatted_compact.xmp
+++ b/src/commonTest/resources/com/ashampoo/xmp/sample_15_formatted_compact.xmp
@@ -1,5 +1,5 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+