-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xml formatting #267
Comments
Have you tried the indentSchemaLocation parameter? |
That results in -<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> I need each attribute on its own line because, although not applicable for poms, other xml files sometimes have many attributes on a tag. |
Let me have a look |
Branch issue-267-Xml_formatting created! |
I did some experiments with this. I have some form of functionality, but it breaks existing tests. |
@Ekryd how do I configure it though? |
Check out the branch, compile it and use the parameter indentSchemaLocation to get the extra line breaks (this is just a concept code) |
You asked me to try out indentSchemaLocation parameter earlier. What have you done on the branch to get each attribute on its own line, or leave the line breaks alone? |
The branch makes sure that each attribute gets its own line:
I cannot preserve line breaks, as the whole xml file is parsed as a DOM tree and recreated completely during sorting. |
Hi Björn. I don't know how you got that output. Using the released 3.2.1, I get either all attributes on one line or, with I tried changing diff --git a/sorter/src/main/java/sortpom/output/PatchedXMLWriter.java b/sorter/src/main/java/sortpom/output/PatchedXMLWriter.java
index 67dc29d..e0b3cd7 100644
--- a/sorter/src/main/java/sortpom/output/PatchedXMLWriter.java
+++ b/sorter/src/main/java/sortpom/output/PatchedXMLWriter.java
@@ -99 +99 @@ class PatchedXMLWriter extends XMLWriter {
- if (indentSchemaLocation && "xsi:schemaLocation".equals(qualifiedName)) {
+ if (indentSchemaLocation) { the test failed with
Since it breaks before |
You have to use git to checkout the branch issue-267-Xml_formatting in order to see the changes. The branch should compile, although some tests will fail on it. |
hi. I have my IDE format xml to make it more readable, but the changes keep being overridden by sortpom plugin
Can this be configurable?
The text was updated successfully, but these errors were encountered: