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.XmlException;
18 import org.apache.xmlbeans.XmlObject;
19
20
21 public class DefaultXmlDocument extends AbstractXmlDocument
22 {
23 private String xml;
24 private SchemaTypeSystem typeSystem;
25
26 public DefaultXmlDocument( String xml )
27 {
28 this.xml = xml;
29 }
30
31 public void setTypeSystem( SchemaTypeSystem typeSystem )
32 {
33 this.typeSystem = typeSystem;
34 }
35
36 public SchemaTypeSystem getTypeSystem()
37 {
38 if( typeSystem != null )
39 return typeSystem;
40
41 try
42 {
43 typeSystem = XmlObject.Factory.parse( xml ).schemaType().getTypeSystem();
44 return typeSystem;
45 }
46 catch (XmlException e)
47 {
48 return XmlBeans.getBuiltinTypeSystem();
49 }
50 }
51
52 public String getXml()
53 {
54 return xml;
55 }
56
57 public void setXml(String xml)
58 {
59 String oldXml = this.xml;
60 this.xml = xml;
61 typeSystem = null;
62
63 fireXmlChanged( oldXml, xml );
64 }
65 }