1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.panels.request.components.editor.support;
14
15 import org.apache.xmlbeans.SchemaTypeSystem;
16 import org.apache.xmlbeans.XmlBeans;
17 import org.apache.xmlbeans.XmlObject;
18
19 /***
20 * Default XmlDocument that works on a standard xml string
21 *
22 * @author ole.matzura
23 */
24
25 public class DefaultXmlDocument extends AbstractXmlDocument
26 {
27 private String xml;
28 private SchemaTypeSystem typeSystem;
29
30 public DefaultXmlDocument( String xml )
31 {
32 this.xml = xml;
33 }
34
35 public void setTypeSystem( SchemaTypeSystem typeSystem )
36 {
37 this.typeSystem = typeSystem;
38 }
39
40 public SchemaTypeSystem getTypeSystem()
41 {
42 if( typeSystem != null )
43 return typeSystem;
44
45 try
46 {
47 typeSystem = XmlObject.Factory.parse( xml ).schemaType().getTypeSystem();
48 return typeSystem;
49 }
50 catch (Exception e)
51 {
52 return XmlBeans.getBuiltinTypeSystem();
53 }
54 }
55
56 public String getXml()
57 {
58 return xml;
59 }
60
61 public void setXml(String xml)
62 {
63 String oldXml = this.xml;
64 this.xml = xml;
65 typeSystem = null;
66
67 fireXmlChanged( oldXml, xml );
68 }
69
70 public void release()
71 {
72 typeSystem = null;
73 }
74 }