Hi,
kann mir mal jemand sagen, wie ich eine svg manipulieren kann?
Für mich ist das xml, "kann ja nicht so schwer sein" an die Attribute zu kommen^^
hab folgende svg
lese die aus einer Datei, will die Punke manipulieren bei <path d="M32 0.."
anschließend speichern
kann mir mal jemand sagen, wie ich eine svg manipulieren kann?
Für mich ist das xml, "kann ja nicht so schwer sein" an die Attribute zu kommen^^
hab folgende svg
Code:
<svg width="600" height="450" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(10,0)">
<text id="textLeft" x="0" y="35" font-family="Verdana" font-size="15">
vcore
</text>
<text id="textBottom" x ="460" y="390" font-family="Verdana" font-size="15">
errors
</text>
</g>
<g transform="translate(90,0)">
<title>title</title>
<line id="y-axis" x1="32" y1="10" y2="370" x2="32" stroke="#000" fill="none"/>
<line id="y-axis" x1="32.5" y1="370" y2="370" x2="600" stroke="#000" fill="none"/>
<rect id="red-area" fill-opacity="0.5" height="150" width="200" y="10" x="330" stroke="#8B4D4B" fill="#ff0a02"/>
<path id="green-area" d="M32 50, 102 90, 172 102, 242 153, 312 155, 382 195, 452 215, 527 220, 527 370, 32 370"
opacity="0.5" fill-opacity="0.5" stroke="#8B4D4B" fill="#7fff00" />
</g>
</svg>
lese die aus einer Datei, will die Punke manipulieren bei <path d="M32 0.."
anschließend speichern
Code:
import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilder;
...
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
File file = new File("c:\\bla.svg");
Document doc = builder.parse(file);//dom objekt
..
NodeList nList = doc.getElementsByTagName("path");