diff options
author | Manuel Bentele | 2021-04-26 15:34:02 +0200 |
---|---|---|
committer | Manuel Bentele | 2021-04-26 15:34:02 +0200 |
commit | 32c3d1b552016c4303ff7abf887bb62a736db9f8 (patch) | |
tree | 6214794ada75089744e3e625b1ad5da8b3691c22 | |
parent | Add supported virtualizer versions for Libvirt/QEMU (diff) | |
download | master-sync-shared-32c3d1b552016c4303ff7abf887bb62a736db9f8.tar.gz master-sync-shared-32c3d1b552016c4303ff7abf887bb62a736db9f8.tar.xz master-sync-shared-32c3d1b552016c4303ff7abf887bb62a736db9f8.zip |
Fix error while parsing Libvirt XML document from String
-rw-r--r-- | src/main/java/org/openslx/libvirt/xml/LibvirtXmlDocument.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlDocument.java b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlDocument.java index 9382ced..f24ba4f 100644 --- a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlDocument.java +++ b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlDocument.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; +import java.io.StringReader; import java.io.StringWriter; import javax.xml.parsers.DocumentBuilder; @@ -252,16 +253,7 @@ public abstract class LibvirtXmlDocument implements LibvirtXmlSerializable, Libv @Override public void fromXml( String xml ) throws LibvirtXmlSerializationException { - try { - this.xmlDocument = this.domBuilder.parse( xml ); - this.xmlDocument.getDocumentElement().normalize(); - } catch ( SAXException e ) { - e.printStackTrace(); - } catch ( IOException e ) { - e.printStackTrace(); - } - - this.rootXmlNode = new LibvirtXmlNode( this.xmlDocument, this.xmlDocument.getDocumentElement() ); + this.fromXml( new InputSource( new StringReader( xml ) ) ); } @Override |