1 16 17 package org.apache.ws.jaxme.pm.ino.api4j; 18 19 import java.io.Writer ; 20 import java.lang.reflect.UndeclaredThrowableException ; 21 22 import javax.xml.bind.JAXBException; 23 import javax.xml.namespace.QName ; 24 25 import org.apache.ws.jaxme.pm.ino.InoObject; 26 27 import com.softwareag.tamino.db.api.objectModel.sax.TSAXDocument; 28 import com.softwareag.tamino.db.api.objectModel.sax.TSAXElement; 29 30 31 34 public class TJMElement implements TSAXDocument, TSAXElement { 35 private final InoObject element; 36 37 public TJMElement(InoObject pElement) { 38 element = pElement; 39 } 40 41 public InoObject getJMElement() { 42 return element; 43 } 44 45 public TSAXElement getRootElement() { 46 return this; 47 } 48 49 public void writeTo(Writer pWriter) { 50 try { 51 TaminoAPI4JPm.getJAXBContext().createMarshaller().marshal(getJMElement(), pWriter); 52 } catch (JAXBException e) { 53 throw new UndeclaredThrowableException (e); 54 } 55 } 56 57 public void setDocname(String pDocname) { 58 element.setInoDocname(pDocname); 59 } 60 61 public void setId(String pId) { 62 element.setInoId(pId); 63 } 64 65 public String getDoctype() { 66 QName qName = element.getQName(); 67 String prefix = qName.getPrefix(); 68 if (prefix == null || prefix.length() == 0) { 69 return qName.getLocalPart(); 70 } else { 71 return prefix + ':' + qName.getLocalPart(); 72 } 73 } 74 75 public String getDocname() { 76 String result = element.getInoDocname(); 77 return result == null ? "" : result; 78 } 79 80 public String getId() { 81 String result = element.getInoId(); 82 return result == null ? "" : result; 83 } 84 } 85 | Popular Tags |