Fix SVG export tests...

This commit is contained in:
Paulo Gustavo Veiga 2013-03-10 19:45:21 -03:00
parent 202c3f28a3
commit b6ee7e61b8
2 changed files with 25 additions and 25 deletions

View File

@ -105,8 +105,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.3.2</version>
<configuration> <configuration>
<source>1.6</source> <source>1.7</source>
<target>1.6</target> <target>1.7</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -140,9 +140,7 @@ public class ExporterFactory {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilder documentBuilder = factory.newDocumentBuilder(); final DocumentBuilder documentBuilder = factory.newDocumentBuilder();
if (!svgXml.trim().startsWith("<svg xmlns=\"http://www.w3.org/2000/svg\"")) { if (!svgXml.contains("xmlns:xlink=\"http://www.w3.org/1999/xlink\"")) {
svgXml = svgXml.replaceFirst("<svg ", "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
} else {
svgXml = svgXml.replaceFirst("<svg ", "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" "); svgXml = svgXml.replaceFirst("<svg ", "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
} }
@ -222,8 +220,9 @@ public class ExporterFactory {
Element elem = (Element) node; Element elem = (Element) node;
// Cook image href ... // If the image is a external URL, embeed it...
String imgUrl = elem.getAttribute("href"); String imgUrl = elem.getAttribute("href");
if (!imgUrl.startsWith("image/png;base64") ||!imgUrl.startsWith("data:image/png;base64") ) {
elem.removeAttribute("href"); elem.removeAttribute("href");
if (imgUrl == null || imgUrl.isEmpty()) { if (imgUrl == null || imgUrl.isEmpty()) {
@ -250,6 +249,7 @@ public class ExporterFactory {
} }
} }
} }
}
private File iconFile(@NotNull final String imgUrl) throws IOException { private File iconFile(@NotNull final String imgUrl) throws IOException {
int index = imgUrl.lastIndexOf("/"); int index = imgUrl.lastIndexOf("/");