1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.support.editor.xml.support;
14
15 import org.apache.xmlbeans.SchemaTypeSystem;
16 import org.apache.xmlbeans.XmlBeans;
17 import org.apache.xmlbeans.XmlObject;
18
19 import com.eviware.soapui.SoapUI;
20
21 /***
22 * Default XmlDocument that works on an existing XmlObject
23 *
24 * @author ole.matzura
25 */
26
27 public class XmlObjectXmlDocument extends AbstractXmlDocument
28 {
29 private XmlObject xmlObject;
30
31 public XmlObjectXmlDocument( XmlObject xmlObject )
32 {
33 this.xmlObject = xmlObject;}
34
35 public SchemaTypeSystem getTypeSystem()
36 {
37 return xmlObject == null ? XmlBeans.getBuiltinTypeSystem() : xmlObject.schemaType().getTypeSystem();
38 }
39
40 public String getXml()
41 {
42 return xmlObject.toString();
43 }
44
45 public void setXml(String xml)
46 {
47 try
48 {
49 String old = getXml();
50 xmlObject = XmlObject.Factory.parse( xml );
51 fireXmlChanged( old, getXml() );
52 }
53 catch (Exception e)
54 {
55 SoapUI.logError( e );
56 }
57 }
58
59 public void release()
60 {
61 xmlObject = null;
62 }
63 }