View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2007 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  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.XmlException;
17  import org.apache.xmlbeans.XmlObject;
18  
19  
20  public class XmlObjectXmlDocument extends AbstractXmlDocument
21  {
22  	private XmlObject xmlObject;
23  
24  	public XmlObjectXmlDocument( XmlObject xmlObject )
25  	{
26  		this.xmlObject = xmlObject;}
27  	
28  	public SchemaTypeSystem getTypeSystem()
29  	{
30  		return xmlObject == null ? null : xmlObject.schemaType().getTypeSystem();
31  	}
32  
33  	public String getXml()
34  	{
35  		return xmlObject.toString();
36  	}
37  
38  	public void setXml(String xml)
39  	{
40  		try
41  		{
42  			String old = getXml();
43  			xmlObject = XmlObject.Factory.parse( xml );
44  			fireXmlChanged( old, getXml() );
45  		}
46  		catch (XmlException e)
47  		{
48  			e.printStackTrace();
49  		}
50  	}
51  
52  }