Skip to content

Commit

Permalink
Reformatting code with spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
bumann-sbb committed Sep 11, 2024
1 parent 52de5e3 commit ff81f73
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions xoai-common/src/main/java/io/gdcc/xoai/xml/EchoElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ private void write(final XmlWriter writer, final InputStream inStream)
private void addNamespaceIfRequired(XmlWriter writer, QName name) throws XMLStreamException {
// Search for namespace in scope, starting from the root.
for (Set<String> ancestorNamespaces : declaredPrefixes) {
if (ancestorNamespaces.contains(
name.getPrefix() + name.getNamespaceURI()) || name.getNamespaceURI().isBlank()) { // Prefixes might be reused.
if (ancestorNamespaces.contains(name.getPrefix() + name.getNamespaceURI())
|| name.getNamespaceURI().isBlank()) { // Prefixes might be reused.
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public class EchoElementTest {
* are likely to be used later.
*/
@Test
public void handleEarlyNamespaceDeclarations()
throws XMLStreamException {
public void handleEarlyNamespaceDeclarations() throws XMLStreamException {
String xml =
"<?xml version='1.0' encoding='UTF-8'?><oai_dc:dc"
+ " xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\""
Expand All @@ -45,8 +44,7 @@ public void handleEarlyNamespaceDeclarations()
* a namespace declaration.
*/
@Test
public void repeatingNamespaceDeclarations()
throws XMLStreamException {
public void repeatingNamespaceDeclarations() throws XMLStreamException {
String xml =
"<?xml version='1.0' encoding='UTF-8'?><oai_dc:dc"
+ " xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\""
Expand Down Expand Up @@ -103,37 +101,39 @@ public void copyFromInputStream() throws XMLStreamException, IOException {

@Test
public void defaultNamespaceDeclaration() throws XMLStreamException {
// given
String xml =
"<?xml version='1.0' encoding='UTF-8'?>"
+ "<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">\n"
+ " <teiHeader xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" xml:lang=\"de\">\n"
+ " <fileDesc>\n"
+ " <titleStmt>\n"
+ " <title>Titel\n"
+ " </title>\n"
+ " <respStmt>\n"
+ " <resp>Published by</resp>\n"
+ " <name type=\"org\">Organisation</name>\n"
+ " </respStmt>\n"
+ " </titleStmt>\n"
+ " <publicationStmt>\n"
+ " <publisher>\n"
+ " <name type=\"org\">Organisation</name>\n"
+ " <ptr target=\"http://www.organisation.org\"/>\n"
+ " </publisher>\n"
+ " <date when=\"2022-11-30\" type=\"issued\">2022-11-30</date>\n"
+ " <distributor>Handschriftenportal</distributor>\n"
+ " <availability status=\"free\">\n"
+ " <licence target=\"https://creativecommons.org/publicdomain/zero/1.0/deed.de\">\n"
+ " </licence>\n"
+ " </availability>\n"
+ " <pubPlace>\n"
+ " </pubPlace>\n"
+ " </publicationStmt>\n"
+ " </fileDesc>\n"
+ " </teiHeader>\n"
+ "</TEI>";
// given
String xml =
"<?xml version='1.0' encoding='UTF-8'?><TEI"
+ " xmlns=\"http://www.tei-c.org/ns/1.0\">\n"
+ " <teiHeader xmlns:xml=\"http://www.w3.org/XML/1998/namespace\""
+ " xml:lang=\"de\">\n"
+ " <fileDesc>\n"
+ " <titleStmt>\n"
+ " <title>Titel\n"
+ " </title>\n"
+ " <respStmt>\n"
+ " <resp>Published by</resp>\n"
+ " <name type=\"org\">Organisation</name>\n"
+ " </respStmt>\n"
+ " </titleStmt>\n"
+ " <publicationStmt>\n"
+ " <publisher>\n"
+ " <name type=\"org\">Organisation</name>\n"
+ " <ptr target=\"http://www.organisation.org\"/>\n"
+ " </publisher>\n"
+ " <date when=\"2022-11-30\" type=\"issued\">2022-11-30</date>\n"
+ " <distributor>Handschriftenportal</distributor>\n"
+ " <availability status=\"free\">\n"
+ " <licence"
+ " target=\"https://creativecommons.org/publicdomain/zero/1.0/deed.de\">\n"
+ " </licence>\n"
+ " </availability>\n"
+ " <pubPlace>\n"
+ " </pubPlace>\n"
+ " </publicationStmt>\n"
+ " </fileDesc>\n"
+ " </teiHeader>\n"
+ "</TEI>";

String result = echoXml(xml);

Expand Down

0 comments on commit ff81f73

Please sign in to comment.