< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java

Print this page




 355      * Marshal the content tree rooted at {@code jaxbElement} into the specified
 356      * {@code javax.xml.transform.Result}.
 357      *
 358      * <p>
 359      * All JAXB Providers must at least support
 360      * {@link javax.xml.transform.dom.DOMResult},
 361      * {@link javax.xml.transform.sax.SAXResult}, and
 362      * {@link javax.xml.transform.stream.StreamResult}. It can
 363      * support other derived classes of {@code Result} as well.
 364      *
 365      * @param jaxbElement
 366      *      The root of content tree to be marshalled.
 367      * @param result
 368      *      XML will be sent to this Result
 369      *
 370      * @throws JAXBException
 371      *      If any unexpected problem occurs during the marshalling.
 372      * @throws MarshalException
 373      *      If the {@link ValidationEventHandler ValidationEventHandler}
 374      *      returns false from its {@code handleEvent} method or the
 375      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 376      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 377      *      Marshalling a JAXB element</a>.
 378      * @throws IllegalArgumentException
 379      *      If any of the method parameters are null
 380      */
 381     public void marshal( Object jaxbElement, javax.xml.transform.Result result )
 382         throws JAXBException;
 383 
 384     /**
 385      * Marshal the content tree rooted at {@code jaxbElement} into an output stream.
 386      *
 387      * @param jaxbElement
 388      *      The root of content tree to be marshalled.
 389      * @param os
 390      *      XML will be added to this stream.
 391      *
 392      * @throws JAXBException
 393      *      If any unexpected problem occurs during the marshalling.
 394      * @throws MarshalException
 395      *      If the {@link ValidationEventHandler ValidationEventHandler}
 396      *      returns false from its {@code handleEvent} method or the
 397      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 398      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 399      *      Marshalling a JAXB element</a>.
 400      * @throws IllegalArgumentException
 401      *      If any of the method parameters are null
 402      */
 403     public void marshal( Object jaxbElement, java.io.OutputStream os )
 404         throws JAXBException;
 405 
 406     /**
 407      * Marshal the content tree rooted at {@code jaxbElement} into a file.
 408      *
 409      * @param jaxbElement
 410      *      The root of content tree to be marshalled.
 411      * @param output
 412      *      File to be written. If this file already exists, it will be overwritten.
 413      *
 414      * @throws JAXBException
 415      *      If any unexpected problem occurs during the marshalling.
 416      * @throws MarshalException
 417      *      If the {@link ValidationEventHandler ValidationEventHandler}
 418      *      returns false from its {@code handleEvent} method or the
 419      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 420      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 421      *      Marshalling a JAXB element</a>.
 422      * @throws IllegalArgumentException
 423      *      If any of the method parameters are null
 424      * @since 1.6, JAXB 2.1
 425      */
 426     public void marshal( Object jaxbElement, File output )
 427         throws JAXBException;
 428 
 429     /**
 430      * Marshal the content tree rooted at {@code jaxbElement} into a Writer.
 431      *
 432      * @param jaxbElement
 433      *      The root of content tree to be marshalled.
 434      * @param writer
 435      *      XML will be sent to this writer.
 436      *
 437      * @throws JAXBException
 438      *      If any unexpected problem occurs during the marshalling.
 439      * @throws MarshalException
 440      *      If the {@link ValidationEventHandler ValidationEventHandler}
 441      *      returns false from its {@code handleEvent} method or the
 442      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 443      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 444      *      Marshalling a JAXB element</a>.
 445      * @throws IllegalArgumentException
 446      *      If any of the method parameters are null
 447      */
 448     public void marshal( Object jaxbElement, java.io.Writer writer )
 449         throws JAXBException;
 450 
 451     /**
 452      * Marshal the content tree rooted at {@code jaxbElement} into SAX2 events.
 453      *
 454      * @param jaxbElement
 455      *      The root of content tree to be marshalled.
 456      * @param handler
 457      *      XML will be sent to this handler as SAX2 events.
 458      *
 459      * @throws JAXBException
 460      *      If any unexpected problem occurs during the marshalling.
 461      * @throws MarshalException
 462      *      If the {@link ValidationEventHandler ValidationEventHandler}
 463      *      returns false from its {@code handleEvent} method or the
 464      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 465      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 466      *      Marshalling a JAXB element</a>.
 467      * @throws IllegalArgumentException
 468      *      If any of the method parameters are null
 469      */
 470     public void marshal( Object jaxbElement, org.xml.sax.ContentHandler handler )
 471         throws JAXBException;
 472 
 473     /**
 474      * Marshal the content tree rooted at {@code jaxbElement} into a DOM tree.
 475      *
 476      * @param jaxbElement
 477      *      The content tree to be marshalled.
 478      * @param node
 479      *      DOM nodes will be added as children of this node.
 480      *      This parameter must be a Node that accepts children
 481      *      ({@link org.w3c.dom.Document},
 482      *      {@link  org.w3c.dom.DocumentFragment}, or
 483      *      {@link  org.w3c.dom.Element})
 484      *
 485      * @throws JAXBException


 493      * @throws IllegalArgumentException
 494      *      If any of the method parameters are null
 495      */
 496     public void marshal( Object jaxbElement, org.w3c.dom.Node node )
 497         throws JAXBException;
 498 
 499     /**
 500      * Marshal the content tree rooted at {@code jaxbElement} into a
 501      * {@link javax.xml.stream.XMLStreamWriter}.
 502      *
 503      * @param jaxbElement
 504      *      The content tree to be marshalled.
 505      * @param writer
 506      *      XML will be sent to this writer.
 507      *
 508      * @throws JAXBException
 509      *      If any unexpected problem occurs during the marshalling.
 510      * @throws MarshalException
 511      *      If the {@link ValidationEventHandler ValidationEventHandler}
 512      *      returns false from its {@code handleEvent} method or the
 513      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 514      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 515      *      Marshalling a JAXB element</a>.
 516      * @throws IllegalArgumentException
 517      *      If any of the method parameters are null
 518      * @since 1.6, JAXB 2.0
 519      */
 520     public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer )
 521         throws JAXBException;
 522 
 523     /**
 524      * Marshal the content tree rooted at {@code jaxbElement} into a
 525      * {@link javax.xml.stream.XMLEventWriter}.
 526      *
 527      * @param jaxbElement
 528      *      The content tree rooted at jaxbElement to be marshalled.
 529      * @param writer
 530      *      XML will be sent to this writer.
 531      *
 532      * @throws JAXBException
 533      *      If any unexpected problem occurs during the marshalling.
 534      * @throws MarshalException
 535      *      If the {@link ValidationEventHandler ValidationEventHandler}
 536      *      returns false from its {@code handleEvent} method or the
 537      *      {@code Marshaller} is unable to marshal {@code obj} (or any
 538      *      object reachable from {@code obj}).  See <a href="#elementMarshalling">
 539      *      Marshalling a JAXB element</a>.
 540      * @throws IllegalArgumentException
 541      *      If any of the method parameters are null
 542      * @since 1.6, JAXB 2.0
 543      */
 544     public void marshal( Object jaxbElement, javax.xml.stream.XMLEventWriter writer )
 545         throws JAXBException;
 546 
 547     /**
 548      * Get a DOM tree view of the content tree(Optional).
 549      *
 550      * If the returned DOM tree is updated, these changes are also
 551      * visible in the content tree.
 552      * Use {@link #marshal(Object, org.w3c.dom.Node)} to force
 553      * a deep copy of the content tree to a DOM representation.
 554      *
 555      * @param contentTree - JAXB Java representation of XML content
 556      *
 557      * @return the DOM tree view of the contentTree
 558      *




 355      * Marshal the content tree rooted at {@code jaxbElement} into the specified
 356      * {@code javax.xml.transform.Result}.
 357      *
 358      * <p>
 359      * All JAXB Providers must at least support
 360      * {@link javax.xml.transform.dom.DOMResult},
 361      * {@link javax.xml.transform.sax.SAXResult}, and
 362      * {@link javax.xml.transform.stream.StreamResult}. It can
 363      * support other derived classes of {@code Result} as well.
 364      *
 365      * @param jaxbElement
 366      *      The root of content tree to be marshalled.
 367      * @param result
 368      *      XML will be sent to this Result
 369      *
 370      * @throws JAXBException
 371      *      If any unexpected problem occurs during the marshalling.
 372      * @throws MarshalException
 373      *      If the {@link ValidationEventHandler ValidationEventHandler}
 374      *      returns false from its {@code handleEvent} method or the
 375      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 376      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 377      *      Marshalling a JAXB element</a>.
 378      * @throws IllegalArgumentException
 379      *      If any of the method parameters are null
 380      */
 381     public void marshal( Object jaxbElement, javax.xml.transform.Result result )
 382         throws JAXBException;
 383 
 384     /**
 385      * Marshal the content tree rooted at {@code jaxbElement} into an output stream.
 386      *
 387      * @param jaxbElement
 388      *      The root of content tree to be marshalled.
 389      * @param os
 390      *      XML will be added to this stream.
 391      *
 392      * @throws JAXBException
 393      *      If any unexpected problem occurs during the marshalling.
 394      * @throws MarshalException
 395      *      If the {@link ValidationEventHandler ValidationEventHandler}
 396      *      returns false from its {@code handleEvent} method or the
 397      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 398      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 399      *      Marshalling a JAXB element</a>.
 400      * @throws IllegalArgumentException
 401      *      If any of the method parameters are null
 402      */
 403     public void marshal( Object jaxbElement, java.io.OutputStream os )
 404         throws JAXBException;
 405 
 406     /**
 407      * Marshal the content tree rooted at {@code jaxbElement} into a file.
 408      *
 409      * @param jaxbElement
 410      *      The root of content tree to be marshalled.
 411      * @param output
 412      *      File to be written. If this file already exists, it will be overwritten.
 413      *
 414      * @throws JAXBException
 415      *      If any unexpected problem occurs during the marshalling.
 416      * @throws MarshalException
 417      *      If the {@link ValidationEventHandler ValidationEventHandler}
 418      *      returns false from its {@code handleEvent} method or the
 419      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 420      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 421      *      Marshalling a JAXB element</a>.
 422      * @throws IllegalArgumentException
 423      *      If any of the method parameters are null
 424      * @since 1.6, JAXB 2.1
 425      */
 426     public void marshal( Object jaxbElement, File output )
 427         throws JAXBException;
 428 
 429     /**
 430      * Marshal the content tree rooted at {@code jaxbElement} into a Writer.
 431      *
 432      * @param jaxbElement
 433      *      The root of content tree to be marshalled.
 434      * @param writer
 435      *      XML will be sent to this writer.
 436      *
 437      * @throws JAXBException
 438      *      If any unexpected problem occurs during the marshalling.
 439      * @throws MarshalException
 440      *      If the {@link ValidationEventHandler ValidationEventHandler}
 441      *      returns false from its {@code handleEvent} method or the
 442      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 443      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 444      *      Marshalling a JAXB element</a>.
 445      * @throws IllegalArgumentException
 446      *      If any of the method parameters are null
 447      */
 448     public void marshal( Object jaxbElement, java.io.Writer writer )
 449         throws JAXBException;
 450 
 451     /**
 452      * Marshal the content tree rooted at {@code jaxbElement} into SAX2 events.
 453      *
 454      * @param jaxbElement
 455      *      The root of content tree to be marshalled.
 456      * @param handler
 457      *      XML will be sent to this handler as SAX2 events.
 458      *
 459      * @throws JAXBException
 460      *      If any unexpected problem occurs during the marshalling.
 461      * @throws MarshalException
 462      *      If the {@link ValidationEventHandler ValidationEventHandler}
 463      *      returns false from its {@code handleEvent} method or the
 464      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 465      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 466      *      Marshalling a JAXB element</a>.
 467      * @throws IllegalArgumentException
 468      *      If any of the method parameters are null
 469      */
 470     public void marshal( Object jaxbElement, org.xml.sax.ContentHandler handler )
 471         throws JAXBException;
 472 
 473     /**
 474      * Marshal the content tree rooted at {@code jaxbElement} into a DOM tree.
 475      *
 476      * @param jaxbElement
 477      *      The content tree to be marshalled.
 478      * @param node
 479      *      DOM nodes will be added as children of this node.
 480      *      This parameter must be a Node that accepts children
 481      *      ({@link org.w3c.dom.Document},
 482      *      {@link  org.w3c.dom.DocumentFragment}, or
 483      *      {@link  org.w3c.dom.Element})
 484      *
 485      * @throws JAXBException


 493      * @throws IllegalArgumentException
 494      *      If any of the method parameters are null
 495      */
 496     public void marshal( Object jaxbElement, org.w3c.dom.Node node )
 497         throws JAXBException;
 498 
 499     /**
 500      * Marshal the content tree rooted at {@code jaxbElement} into a
 501      * {@link javax.xml.stream.XMLStreamWriter}.
 502      *
 503      * @param jaxbElement
 504      *      The content tree to be marshalled.
 505      * @param writer
 506      *      XML will be sent to this writer.
 507      *
 508      * @throws JAXBException
 509      *      If any unexpected problem occurs during the marshalling.
 510      * @throws MarshalException
 511      *      If the {@link ValidationEventHandler ValidationEventHandler}
 512      *      returns false from its {@code handleEvent} method or the
 513      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 514      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 515      *      Marshalling a JAXB element</a>.
 516      * @throws IllegalArgumentException
 517      *      If any of the method parameters are null
 518      * @since 1.6, JAXB 2.0
 519      */
 520     public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer )
 521         throws JAXBException;
 522 
 523     /**
 524      * Marshal the content tree rooted at {@code jaxbElement} into a
 525      * {@link javax.xml.stream.XMLEventWriter}.
 526      *
 527      * @param jaxbElement
 528      *      The content tree rooted at jaxbElement to be marshalled.
 529      * @param writer
 530      *      XML will be sent to this writer.
 531      *
 532      * @throws JAXBException
 533      *      If any unexpected problem occurs during the marshalling.
 534      * @throws MarshalException
 535      *      If the {@link ValidationEventHandler ValidationEventHandler}
 536      *      returns false from its {@code handleEvent} method or the
 537      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
 538      *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
 539      *      Marshalling a JAXB element</a>.
 540      * @throws IllegalArgumentException
 541      *      If any of the method parameters are null
 542      * @since 1.6, JAXB 2.0
 543      */
 544     public void marshal( Object jaxbElement, javax.xml.stream.XMLEventWriter writer )
 545         throws JAXBException;
 546 
 547     /**
 548      * Get a DOM tree view of the content tree(Optional).
 549      *
 550      * If the returned DOM tree is updated, these changes are also
 551      * visible in the content tree.
 552      * Use {@link #marshal(Object, org.w3c.dom.Node)} to force
 553      * a deep copy of the content tree to a DOM representation.
 554      *
 555      * @param contentTree - JAXB Java representation of XML content
 556      *
 557      * @return the DOM tree view of the contentTree
 558      *


< prev index next >