diff options
author | kitfox | 2012-08-24 17:48:06 +0200 |
---|---|---|
committer | kitfox | 2012-08-24 17:48:06 +0200 |
commit | 23ddae130a53fa38327505e0538156bcd3697187 (patch) | |
tree | b35f063616357a93614c8cac004299fd935fd913 /src | |
parent | Now trimming text in <text> tag. (diff) | |
download | svg-salamander-core-23ddae130a53fa38327505e0538156bcd3697187.tar.gz svg-salamander-core-23ddae130a53fa38327505e0538156bcd3697187.tar.xz svg-salamander-core-23ddae130a53fa38327505e0538156bcd3697187.zip |
Fixing parsing empty content in style attribute.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@122 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/kitfox/svg/xml/XMLParseUtil.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java index 0d0121b..85199f4 100644 --- a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java +++ b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java @@ -789,10 +789,6 @@ public class XMLParseUtil */
public static HashMap parseStyle(String styleString, HashMap map) {
final Pattern patSemi = Pattern.compile(";");
- final Pattern patColonSpace = Pattern.compile(":");
-
- //Strips left and right whitespace
- final Matcher matcherContent = Pattern.compile("\\s*([^\\s](.*[^\\s])?)\\s*").matcher("");
String[] styles = patSemi.split(styleString);
@@ -803,17 +799,16 @@ public class XMLParseUtil continue;
}
- String[] vals = patColonSpace.split(styles[i]);
-
- matcherContent.reset(vals[0]);
- matcherContent.matches();
- vals[0] = matcherContent.group(1);
+ int colon = styles[i].indexOf(':');
+ if (colon == -1)
+ {
+ continue;
+ }
- matcherContent.reset(vals[1]);
- matcherContent.matches();
- vals[1] = matcherContent.group(1);
+ String key = styles[i].substring(0, colon).trim();
+ String value = styles[i].substring(colon + 1).trim();
- map.put(vals[0], new StyleAttribute(vals[0], vals[1]));
+ map.put(key, new StyleAttribute(key, value));
}
return map;
|