src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/XMLSerializer.java

Print this page




 795 
 796     public Transformer getIdentityTransformer() {
 797         if (identityTransformer==null)
 798             identityTransformer = JAXBContextImpl.createTransformer(grammar.disableSecurityProcessing);
 799         return identityTransformer;
 800     }
 801 
 802     public void setPrefixMapper(NamespacePrefixMapper prefixMapper) {
 803         nsContext.setPrefixMapper(prefixMapper);
 804     }
 805 
 806     /**
 807      * Reset this object to write to the specified output.
 808      *
 809      * @param schemaLocation
 810      *      if non-null, this value is printed on the root element as xsi:schemaLocation
 811      * @param noNsSchemaLocation
 812      *      Similar to 'schemaLocation' but this one works for xsi:noNamespaceSchemaLocation
 813      */
 814     public void startDocument(XmlOutput out,boolean fragment,String schemaLocation,String noNsSchemaLocation) throws IOException, SAXException, XMLStreamException {
 815         setThreadAffinity();
 816         pushCoordinator();
 817         nsContext.reset();
 818         nse = nsContext.getCurrent();
 819         if(attachmentMarshaller!=null && attachmentMarshaller.isXOPPackage())
 820             out = new MTOMXmlOutput(out);
 821         this.out = out;
 822         objectsWithId.clear();
 823         idReferencedObjects.clear();
 824         textHasAlreadyPrinted = false;
 825         seenRoot = false;
 826         this.schemaLocation = schemaLocation;
 827         this.noNsSchemaLocation = noNsSchemaLocation;
 828         this.fragment = fragment;
 829         this.inlineBinaryFlag = false;
 830         this.expectedMimeType = null;
 831         cycleDetectionStack.reset();
 832 
 833         out.startDocument(this,fragment,knownUri2prefixIndexMap,nsContext);
 834     }
 835 
 836     public void endDocument() throws IOException, SAXException, XMLStreamException {
 837         out.endDocument(fragment);
 838     }
 839 
 840     public void close() {
 841         out = null;
 842         clearCurrentProperty();
 843         popCoordinator();
 844         resetThreadAffinity();
 845     }
 846 
 847     /**
 848      * This method can be called after {@link #startDocument} is called
 849      * but before the marshalling begins, to set the currently in-scope namespace
 850      * bindings.
 851      *
 852      * <p>
 853      * This method is useful to avoid redundant namespace declarations when
 854      * the marshalling is producing a sub-document.
 855      */
 856     public void addInscopeBinding(String nsUri,String prefix) {
 857         nsContext.put(nsUri,prefix);
 858     }
 859 
 860     /**
 861      * Gets the MIME type with which the binary content shall be printed.
 862      *
 863      * <p>
 864      * This method shall be used from those {@link RuntimeBuiltinLeafInfo} that are




 795 
 796     public Transformer getIdentityTransformer() {
 797         if (identityTransformer==null)
 798             identityTransformer = JAXBContextImpl.createTransformer(grammar.disableSecurityProcessing);
 799         return identityTransformer;
 800     }
 801 
 802     public void setPrefixMapper(NamespacePrefixMapper prefixMapper) {
 803         nsContext.setPrefixMapper(prefixMapper);
 804     }
 805 
 806     /**
 807      * Reset this object to write to the specified output.
 808      *
 809      * @param schemaLocation
 810      *      if non-null, this value is printed on the root element as xsi:schemaLocation
 811      * @param noNsSchemaLocation
 812      *      Similar to 'schemaLocation' but this one works for xsi:noNamespaceSchemaLocation
 813      */
 814     public void startDocument(XmlOutput out,boolean fragment,String schemaLocation,String noNsSchemaLocation) throws IOException, SAXException, XMLStreamException {

 815         pushCoordinator();
 816         nsContext.reset();
 817         nse = nsContext.getCurrent();
 818         if(attachmentMarshaller!=null && attachmentMarshaller.isXOPPackage())
 819             out = new MTOMXmlOutput(out);
 820         this.out = out;
 821         objectsWithId.clear();
 822         idReferencedObjects.clear();
 823         textHasAlreadyPrinted = false;
 824         seenRoot = false;
 825         this.schemaLocation = schemaLocation;
 826         this.noNsSchemaLocation = noNsSchemaLocation;
 827         this.fragment = fragment;
 828         this.inlineBinaryFlag = false;
 829         this.expectedMimeType = null;
 830         cycleDetectionStack.reset();
 831 
 832         out.startDocument(this,fragment,knownUri2prefixIndexMap,nsContext);
 833     }
 834 
 835     public void endDocument() throws IOException, SAXException, XMLStreamException {
 836         out.endDocument(fragment);
 837     }
 838 
 839     public void close() {
 840         out = null;
 841         clearCurrentProperty();
 842         popCoordinator();

 843     }
 844 
 845     /**
 846      * This method can be called after {@link #startDocument} is called
 847      * but before the marshalling begins, to set the currently in-scope namespace
 848      * bindings.
 849      *
 850      * <p>
 851      * This method is useful to avoid redundant namespace declarations when
 852      * the marshalling is producing a sub-document.
 853      */
 854     public void addInscopeBinding(String nsUri,String prefix) {
 855         nsContext.put(nsUri,prefix);
 856     }
 857 
 858     /**
 859      * Gets the MIME type with which the binary content shall be printed.
 860      *
 861      * <p>
 862      * This method shall be used from those {@link RuntimeBuiltinLeafInfo} that are