javax.xml.stream

Interface XMLEventWriter

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void add(XMLEvent event)
      Add an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.
      void add(XMLEventReader reader)
      Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.
      void close()
      Frees any resources associated with this stream
      void flush()
      Writes any cached events to the underlying output mechanism
      NamespaceContext getNamespaceContext()
      Returns the current namespace context.
      String getPrefix(String uri)
      Gets the prefix the uri is bound to
      void setDefaultNamespace(String uri)
      Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.
      void setNamespaceContext(NamespaceContext context)
      Sets the current namespace context for prefix and uri bindings.
      void setPrefix(String prefix, String uri)
      Sets the prefix the uri is bound to.

      Eerste pagina van API Java Inhoudsopgave Haut

    • Method Detail

      • add

        void add(XMLEvent event)
                 throws XMLStreamException
        Add an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.
        Required and optional fields for events added to the writer
        Event Type Required Fields Optional Fields Required Behavior
        START_ELEMENT QName name namespaces , attributes A START_ELEMENT will be written by writing the name, namespaces, and attributes of the event in XML 1.0 valid syntax for START_ELEMENTs. The name is written by looking up the prefix for the namespace uri. The writer can be configured to respect prefixes of QNames. If the writer is respecting prefixes it must use the prefix set on the QName. The default behavior is to lookup the value for the prefix on the EventWriter's internal namespace context. Each attribute (if any) is written using the behavior specified in the attribute section of this table. Each namespace (if any) is written using the behavior specified in the namespace section of this table.
        END_ELEMENT Qname name None A well formed END_ELEMENT tag is written. The name is written by looking up the prefix for the namespace uri. The writer can be configured to respect prefixes of QNames. If the writer is respecting prefixes it must use the prefix set on the QName. The default behavior is to lookup the value for the prefix on the EventWriter's internal namespace context. If the END_ELEMENT name does not match the START_ELEMENT name an XMLStreamException is thrown.
        ATTRIBUTE QName name , String value QName type An attribute is written using the same algorithm to find the lexical form as used in START_ELEMENT. The default is to use double quotes to wrap attribute values and to escape any double quotes found in the value. The type value is ignored.
        NAMESPACE String prefix, String namespaceURI, boolean isDefaultNamespaceDeclaration None A namespace declaration is written. If the namespace is a default namespace declaration (isDefault is true) then xmlns="$namespaceURI" is written and the prefix is optional. If isDefault is false, the prefix must be declared and the writer must prepend xmlns to the prefix and write out a standard prefix declaration.
        PROCESSING_INSTRUCTION None String target, String data The data does not need to be present and may be null. Target is required and many not be null. The writer will write data section directly after the target, enclosed in appropriate XML 1.0 syntax
        COMMENT None String comment If the comment is present (not null) it is written, otherwise an an empty comment is written
        START_DOCUMENT None String encoding , boolean standalone, String version A START_DOCUMENT event is not required to be written to the stream. If present the attributes are written inside the appropriate XML declaration syntax
        END_DOCUMENT None None Nothing is written to the output
        DTD String DocumentTypeDefinition None The DocumentTypeDefinition is written to the output

        Eerste pagina van API Java Inhoudsopgave Haut

        Specified by:
        add in interface XMLEventConsumer
        Parameters:
        event - the event to be added
        Throws:
        XMLStreamException
      • add

        void add(XMLEventReader reader)
                 throws XMLStreamException
        Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.
        Parameters:
        reader - the event stream to add to the output
        Throws:
        XMLStreamException
      • setPrefix

        void setPrefix(String prefix,
                     String uri)
                       throws XMLStreamException
        Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.
        Parameters:
        prefix - the prefix to bind to the uri
        uri - the uri to bind to the prefix
        Throws:
        XMLStreamException
      • setDefaultNamespace

        void setDefaultNamespace(String uri)
                                 throws XMLStreamException
        Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.
        Parameters:
        uri - the uri to bind to the default namespace
        Throws:
        XMLStreamException
      • setNamespaceContext

        void setNamespaceContext(NamespaceContext context)
                                 throws XMLStreamException
        Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces.
        Parameters:
        context - the namespace context to use for this writer
        Throws:
        XMLStreamException
      • getNamespaceContext

        NamespaceContext getNamespaceContext()
        Returns the current namespace context.
        Returns:
        the current namespace context

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/stream/XMLEventWriter.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