public SchemaLocationFilter( String _schemaLocation, String _noNSSchemaLocation, ContentHandler _writer ) { schemaLocation = _schemaLocation; noNSSchemaLocation = _noNSSchemaLocation; setContentHandler( _writer ); }
private void write( XMLSerializable obj, ContentHandler writer ) throws JAXBException { try { if( getSchemaLocation()!=null || getNoNSSchemaLocation()!=null ) { // if we need to add xsi:schemaLocation or its brother, // throw in the component to do that. writer = new SchemaLocationFilter( getSchemaLocation(), getNoNSSchemaLocation(), writer ); } SAXMarshaller serializer = new SAXMarshaller(writer,this); // set a DocumentLocator that doesn't provide any information writer.setDocumentLocator( new LocatorImpl() ); writer.startDocument(); obj.serializeElements(serializer); writer.endDocument(); } catch( SAXException e ) { throw new MarshalException(e); } }
private void write( XMLSerializable obj, ContentHandler writer ) throws JAXBException { try { if( getSchemaLocation()!=null || getNoNSSchemaLocation()!=null ) { // if we need to add xsi:schemaLocation or its brother, // throw in the component to do that. writer = new SchemaLocationFilter( getSchemaLocation(), getNoNSSchemaLocation(), writer ); } SAXMarshaller serializer = new SAXMarshaller(writer,prefixMapper,this); // set a DocumentLocator that doesn't provide any information writer.setDocumentLocator( new LocatorImpl() ); writer.startDocument(); serializer.childAsBody(obj,null); writer.endDocument(); serializer.reconcileID(); // extra check } catch( SAXException e ) { throw new MarshalException(e); } }
private void write( XMLSerializable obj, ContentHandler writer ) throws JAXBException { try { if( getSchemaLocation()!=null || getNoNSSchemaLocation()!=null ) { // if we need to add xsi:schemaLocation or its brother, // throw in the component to do that. writer = new SchemaLocationFilter( getSchemaLocation(), getNoNSSchemaLocation(), writer ); } SAXMarshaller serializer = new SAXMarshaller(writer,prefixMapper,this); // set a DocumentLocator that doesn't provide any information writer.setDocumentLocator( new LocatorImpl() ); writer.startDocument(); serializer.childAsBody(obj,null); writer.endDocument(); serializer.reconcileID(); // extra check } catch( SAXException e ) { throw new MarshalException(e); } }
private void write( XMLSerializable obj, ContentHandler writer ) throws JAXBException { try { if( getSchemaLocation()!=null || getNoNSSchemaLocation()!=null ) { // if we need to add xsi:schemaLocation or its brother, // throw in the component to do that. writer = new SchemaLocationFilter( getSchemaLocation(), getNoNSSchemaLocation(), writer ); } SAXMarshaller serializer = new SAXMarshaller(writer,prefixMapper,this); // set a DocumentLocator that doesn't provide any information writer.setDocumentLocator( new LocatorImpl() ); writer.startDocument(); serializer.childAsBody(obj,null); writer.endDocument(); serializer.reconcileID(); // extra check } catch( SAXException e ) { throw new MarshalException(e); } }
private void write( XMLSerializable obj, ContentHandler writer ) throws JAXBException { try { if( getSchemaLocation()!=null || getNoNSSchemaLocation()!=null ) { // if we need to add xsi:schemaLocation or its brother, // throw in the component to do that. writer = new SchemaLocationFilter( getSchemaLocation(), getNoNSSchemaLocation(), writer ); } SAXMarshaller serializer = new SAXMarshaller(writer,prefixMapper,this); // set a DocumentLocator that doesn't provide any information writer.setDocumentLocator( new LocatorImpl() ); writer.startDocument(); serializer.childAsBody(obj,null); writer.endDocument(); serializer.reconcileID(); // extra check } catch( SAXException e ) { throw new MarshalException(e); } }