diff --git a/src/main/java/net/vhati/modmanager/core/SloppyXMLParser.java b/src/main/java/net/vhati/modmanager/core/SloppyXMLParser.java index 0688c45..dfc2e28 100644 --- a/src/main/java/net/vhati/modmanager/core/SloppyXMLParser.java +++ b/src/main/java/net/vhati/modmanager/core/SloppyXMLParser.java @@ -28,7 +28,9 @@ import org.jdom2.input.JDOMParseException; * * Sloppiness: * Any closing tag, regardless of its name, closes the parent tag. - * is valid (but the extra dashes will be discarded). + * is valid. + * The example above will become two comments. Any extra dashes will + * be discarded. * --> can occur alone (discarded). * An attribute name can start right after the quote from a prior value. * Namespace prefixes for nodes and attributes are unique. @@ -109,9 +111,33 @@ public class SloppyXMLParser { factory.addContent( parentNode, factory.text( whitespace ) ); tmp = m.group( 2 ); - tmp = tmp.replaceAll( "^-+|(?<=-)-+|-+$", "" ); - Comment commentNode = factory.comment( tmp ); - factory.addContent( parentNode, commentNode ); + if ( tmp.length() == 0 ) { + factory.addContent( parentNode, factory.comment( "" ) ); + } + else { + Matcher splicedMatcher = Pattern.compile( "(\\s*)