javax.xml.bind.helpers

Class AbstractMarshallerImpl

    • Constructor Detail

      • AbstractMarshallerImpl

        public AbstractMarshallerImpl()
    • Method Detail

      • marshal

        public void marshal(Object jaxbElement,
                   File output)
                     throws JAXBException
        Description copied from interface: Marshaller
        Marshal the content tree rooted at jaxbElement into a file.
        Specified by:
        marshal in interface Marshaller
        Parameters:
        jaxbElement - The root of content tree to be marshalled.
        output - File to be written. If this file already exists, it will be overwritten.
        Throws:
        JAXBException - If any unexpected problem occurs during the marshalling.
        MarshalException - If the ValidationEventHandler returns false from its handleEvent method or the Marshaller is unable to marshal obj (or any object reachable from obj). See Marshalling a JAXB element.
      • getNode

        public Node getNode(Object obj)
                     throws JAXBException
        By default, the getNode method is unsupported and throw an UnsupportedOperationException. Implementations that choose to support this method must override this method.
        Specified by:
        getNode in interface Marshaller
        Parameters:
        obj - - JAXB Java representation of XML content
        Returns:
        the DOM tree view of the contentTree
        Throws:
        JAXBException - If any unexpected problem occurs
      • getEncoding

        protected String getEncoding()
        Convenience method for getting the current output encoding.
        Returns:
        the current encoding or "UTF-8" if it hasn't been set.
      • setEncoding

        protected void setEncoding(String encoding)
        Convenience method for setting the output encoding.
        Parameters:
        encoding - a valid encoding as specified in the Marshaller class documentation
      • getSchemaLocation

        protected String getSchemaLocation()
        Convenience method for getting the current schemaLocation.
        Returns:
        the current schemaLocation or null if it hasn't been set
      • setSchemaLocation

        protected void setSchemaLocation(String location)
        Convenience method for setting the schemaLocation.
        Parameters:
        location - the schemaLocation value
      • getNoNSSchemaLocation

        protected String getNoNSSchemaLocation()
        Convenience method for getting the current noNamespaceSchemaLocation.
        Returns:
        the current noNamespaceSchemaLocation or null if it hasn't been set
      • setNoNSSchemaLocation

        protected void setNoNSSchemaLocation(String location)
        Convenience method for setting the noNamespaceSchemaLocation.
        Parameters:
        location - the noNamespaceSchemaLocation value
      • isFormattedOutput

        protected boolean isFormattedOutput()
        Convenience method for getting the formatted output flag.
        Returns:
        the current value of the formatted output flag or false if it hasn't been set.
      • setFormattedOutput

        protected void setFormattedOutput(boolean v)
        Convenience method for setting the formatted output flag.
        Parameters:
        v - value of the formatted output flag.
      • isFragment

        protected boolean isFragment()
        Convenience method for getting the fragment flag.
        Returns:
        the current value of the fragment flag or false if it hasn't been set.
      • setFragment

        protected void setFragment(boolean v)
        Convenience method for setting the fragment flag.
        Parameters:
        v - value of the fragment flag.
      • getJavaEncoding

        protected String getJavaEncoding(String encoding)
                                  throws UnsupportedEncodingException
        Gets the corresponding Java encoding name from an IANA name. This method is a helper method for the derived class to convert encoding names.
        Throws:
        UnsupportedEncodingException - If this implementation couldn't find the Java encoding name.
      • setProperty

        public void setProperty(String name,
                       Object value)
                         throws PropertyException
        Default implementation of the setProperty method handles the four defined properties in Marshaller. If a provider needs to handle additional properties, it should override this method in a derived class.
        Specified by:
        setProperty in interface Marshaller
        Parameters:
        name - the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.
        value - the value of the property to be set
        Throws:
        PropertyException - when there is an error processing the given property or value
      • getProperty

        public Object getProperty(String name)
                           throws PropertyException
        Default implementation of the getProperty method handles the four defined properties in Marshaller. If a provider needs to support additional provider specific properties, it should override this method in a derived class.
        Specified by:
        getProperty in interface Marshaller
        Parameters:
        name - the name of the property to retrieve
        Returns:
        the value of the requested property
        Throws:
        PropertyException - when there is an error retrieving the given property or value property name
      • setEventHandler

        public void setEventHandler(ValidationEventHandler handler)
                             throws JAXBException
        Description copied from interface: Marshaller
        Allow an application to register a validation event handler.

        The validation event handler will be called by the JAXB Provider if any validation errors are encountered during calls to any of the marshal API's. If the client application does not register a validation event handler before invoking one of the marshal methods, then validation events will be handled by the default event handler which will terminate the marshal operation after the first error or fatal error is encountered.

        Calling this method with a null parameter will cause the Marshaller to revert back to the default default event handler.

        Specified by:
        setEventHandler in interface Marshaller
        Parameters:
        handler - the validation event handler
        Throws:
        JAXBException - if an error was encountered while setting the event handler
        See Also:
        Marshaller.setEventHandler(ValidationEventHandler)
      • setSchema

        public void setSchema(Schema schema)
        Description copied from interface: Marshaller
        Specify the JAXP 1.3 Schema object that should be used to validate subsequent marshal operations against. Passing null into this method will disable validation.

        This method allows the caller to validate the marshalled XML as it's marshalled.

        Initially this property is set to null.

        Specified by:
        setSchema in interface Marshaller
        Parameters:
        schema - Schema object to validate marshal operations against or null to disable validation
      • getSchema

        public Schema getSchema()
        Description copied from interface: Marshaller
        Get the JAXP 1.3 Schema object being used to perform marshal-time validation. If there is no Schema set on the marshaller, then this method will return null indicating that marshal-time validation will not be performed.
        Specified by:
        getSchema in interface Marshaller
        Returns:
        the Schema object being used to perform marshal-time validation or null if not present.
      • setAdapter

        public <A extends XmlAdapter> void setAdapter(Class<A> type,
                                             A adapter)
        Description copied from interface: Marshaller
        Associates a configured instance of XmlAdapter with this marshaller.

        Every marshaller internally maintains a Map<Class,XmlAdapter>, which it uses for marshalling classes whose fields/methods are annotated with XmlJavaTypeAdapter.

        This method allows applications to use a configured instance of XmlAdapter. When an instance of an adapter is not given, a marshaller will create one by invoking its default constructor.

        Specified by:
        setAdapter in interface Marshaller
        Parameters:
        type - The type of the adapter. The specified instance will be used when XmlJavaTypeAdapter.value() refers to this type.
        adapter - The instance of the adapter to be used. If null, it will un-register the current adapter set for this type.
      • setAttachmentMarshaller

        public void setAttachmentMarshaller(AttachmentMarshaller am)
        Description copied from interface: Marshaller

        Associate a context that enables binary data within an XML document to be transmitted as XML-binary optimized attachment. The attachment is referenced from the XML document content model by content-id URIs(cid) references stored within the xml document.

        Specified by:
        setAttachmentMarshaller in interface Marshaller

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/xml/bind/helpers/abstractmarshallerimpl.html/

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut