01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
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.XmlObject;
17:
18: import com.eviware.soapui.SoapUI;
19:
20: /**
21: * Default XmlDocument that works on an existing XmlObject
22: *
23: * @author ole.matzura
24: */
25:
26: public class XmlObjectXmlDocument extends AbstractXmlDocument {
27: private XmlObject xmlObject;
28:
29: public XmlObjectXmlDocument(XmlObject xmlObject) {
30: this .xmlObject = xmlObject;
31: }
32:
33: public SchemaTypeSystem getTypeSystem() {
34: return xmlObject == null ? null : xmlObject.schemaType()
35: .getTypeSystem();
36: }
37:
38: public String getXml() {
39: return xmlObject.toString();
40: }
41:
42: public void setXml(String xml) {
43: try {
44: String old = getXml();
45: xmlObject = XmlObject.Factory.parse(xml);
46: fireXmlChanged(old, getXml());
47: } catch (Exception e) {
48: SoapUI.logError(e);
49: }
50: }
51:
52: public void release() {
53: xmlObject = null;
54: }
55: }
|