Java Code Examples for org.apache.xml.serializer.ToStream

Following code examples demonstrate how to use org.apache.xml.serializer.ToStreamfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.apache.xml.serializer.ToStreamand various code implementation of this class.

    protected ToStream makeStream(String encodingName) {
		ToXMLStream stream = new ToXMLStream();
		stream.setEncoding(encodingName);
		
		return stream;
	} 


	protected String outputCharacters(ToStream stream, String input) throws SAXException {
		StringWriter writer = new StringWriter();
		stream.setOmitXMLDeclaration(true);
		stream.setWriter(writer);
		stream.characters(input);
		stream.flushPending();
		return writer.getBuffer().toString();
	} 

	protected String outputAttrValue(ToStream stream, String input) throws SAXException, IOException {
		StringWriter writer = new StringWriter();
		stream.setOmitXMLDeclaration(true);
		stream.setWriter(writer);
		stream.writeAttrString(writer, input, "???");
		stream.flushPending();
		return writer.getBuffer().toString();
	} 

    private char hiSurrogate(int codepoint) {
    	int offset = codepoint - MIN_SUPPLEMENTARY_CODE_POINT;
    	return (char)((offset >>> 10) + MIN_HIGH_SURROGATE);
    } 

Advertisement
Javadoc
This abstract class is a base class for other stream serializers (xml, html, text ...) that write ou

tput to a stream. @xsl.usage internal

Read More
Advertisement