private void marshalDocument(IMarshallingContext marshallingContext, Object graph) throws IOException, JiBXException { if (StringUtils.hasLength(this.docTypeRootElementName)) { IXMLWriter xmlWriter = marshallingContext.getXmlWriter(); xmlWriter.writeDocType(this.docTypeRootElementName, this.docTypeSystemId, this.docTypePublicId, this.docTypeInternalSubset); } marshallingContext.marshalDocument(graph); }
/** * Create a new {@code IMarshallingContext}, configured with the correct indentation. * @return the created marshalling context * @throws JiBXException in case of errors */ protected IMarshallingContext createMarshallingContext() throws JiBXException { Assert.state(this.bindingFactory != null, "JibxMarshaller not initialized"); IMarshallingContext marshallingContext = this.bindingFactory.createMarshallingContext(); marshallingContext.setIndent(this.indent); return marshallingContext; }
/** * Create a new {@code IUnmarshallingContext}. * @return the created unmarshalling context * @throws JiBXException in case of errors */ protected IUnmarshallingContext createUnmarshallingContext() throws JiBXException { Assert.state(this.bindingFactory != null, "JibxMarshaller not initialized"); return this.bindingFactory.createUnmarshallingContext(); }
public SchemaMarshaller() throws JiBXException { IBindingFactory ifact = BindingDirectory.getFactory(SchemaUtils.XS_PREFIX_BINDING, SchemaElement.class); m_schemaContext = (MarshallingContext)ifact.createMarshallingContext(); }
"] using binding [" + this.bindingName + "]"); this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetClass); logger.debug("Configured for target class [" + this.targetClass + "]"); this.bindingFactory = BindingDirectory.getFactory(this.targetClass); "] using binding [" + this.bindingName + "]"); this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetPackage);
@Override protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException { try { IUnmarshallingContext unmarshallingContext = createUnmarshallingContext(); return unmarshallingContext.unmarshalDocument(inputStream, this.encoding); } catch (JiBXException ex) { throw convertJibxException(ex, false); } }
public void marshal(Object obj, IMarshallingContext ctx) throws JiBXException { try { m_schemaContext.setFromContext((MarshallingContext)ctx); ((IMarshallable)obj).marshal(m_schemaContext); m_schemaContext.getXmlWriter().flush(); } catch (IOException e) { throw new JiBXException("Error writing schema", e); } } }
private void marshalDocument(IMarshallingContext marshallingContext, Object graph) throws IOException, JiBXException { if (StringUtils.hasLength(this.docTypeRootElementName)) { IXMLWriter xmlWriter = marshallingContext.getXmlWriter(); xmlWriter.writeDocType(this.docTypeRootElementName, this.docTypeSystemId, this.docTypePublicId, this.docTypeInternalSubset); } marshallingContext.marshalDocument(graph); }
@Override public boolean supports(Class<?> clazz) { Assert.notNull(clazz, "Class must not be null"); if (this.targetClass != null) { return (this.targetClass == clazz); } Assert.state(this.bindingFactory != null, "JibxMarshaller not initialized"); String[] mappedClasses = this.bindingFactory.getMappedClasses(); String className = clazz.getName(); for (String mappedClass : mappedClasses) { if (className.equals(mappedClass)) { return true; } } return false; }
@Override protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException { try { IMarshallingContext marshallingContext = createMarshallingContext(); marshallingContext.startDocument(this.encoding, this.standalone, writer); marshalDocument(marshallingContext, graph); } catch (JiBXException ex) { throw convertJibxException(ex, true); } }
/** * Get the xs:union handling text value set specifically for this element. * * @return text (<code>null</code> if not set) */ public String getUnionHandling() { if (m_unionCode >= 0) { return s_selectionValues.getName(m_unionCode); } else { return null; } }
/** * Get binding qualified name * * @return binding qualified name */ public QName getBindingQName() { return new QName(m_wsdlNamespace, m_bindingName); }
/** * Check for element present. * * @param ictx * @return <code>true</code> if present, <code>false</code> if not * @throws JiBXException on error */ public boolean isPresent(IUnmarshallingContext ictx) throws JiBXException { return ictx.isAt(null, m_name); }
/** * Set the xs:any handling type code. * * @param code handling code, <code>-1</code> if to be unset */ public void setAnyType(int code) { if (code != -1) { s_anyValues.checkValue(code); } m_anyCode = code; }
/** * Creates a new <code>IMarshallingContext</code>, set with the correct indentation. * * @return the created marshalling context * @throws JiBXException in case of errors */ protected IMarshallingContext createMarshallingContext() throws JiBXException { IMarshallingContext marshallingContext = bindingFactory.createMarshallingContext(); marshallingContext.setIndent(indent); return marshallingContext; }
public IBindingFactory run() throws Exception { return BindingDirectory.getFactory(RepositoryServiceConfiguration.class); } });
@Override protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException { try { IUnmarshallingContext unmarshallingContext = createUnmarshallingContext(); return unmarshallingContext.unmarshalDocument(reader); } catch (JiBXException ex) { throw convertJibxException(ex, false); } }
@Override protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException { try { IMarshallingContext marshallingContext = createMarshallingContext(); marshallingContext.startDocument(this.encoding, this.standalone, outputStream); marshalDocument(marshallingContext, graph); } catch (JiBXException ex) { throw convertJibxException(ex, true); } }
/** * Get the enumeration representation text value set specifically for this element. * * @return text (<code>null</code> if not set) */ public String getEnumerationTypeText() { if (m_enumCode >= 0) { return s_enumValues.getName(m_enumCode); } else { return null; } }
/** * Set the xs:choice handling type code. * * @param code handling code, <code>-1</code> if to be unset */ public void setChoiceType(int code) { if (code != -1) { s_selectionValues.checkValue(code); } m_choiceCode = code; }