All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.msv.writer.XMLWriter Maven / Gradle / Ivy

There is a newer version: 2.2.5.1
Show newest version
package com.sun.msv.writer;

import org.xml.sax.DocumentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributeListImpl;

/**
 * Helper class that wraps {@link DocumentHandler} and provides utility methods.
 * 
 * 

* Note that this class uses DocumentHandler, not ContentHandler. * This generally allows the caller better control. * *

* This class throws {@link SAXRuntimeException}, instead of SAXException. */ public class XMLWriter { protected DocumentHandler handler; /** this DocumentHandler will receive XML. */ public void setDocumentHandler( DocumentHandler handler ) { this.handler = handler; } public DocumentHandler getDocumentHandler() { return handler; } public void element( String name ) { element( name, new String[0] ); } public void element( String name, String[] attributes ) { start(name,attributes); end(name); } public void start( String name ) { start(name, new String[0] ); } public void start( String name, String[] attributes ) { // create attributes. AttributeListImpl as = new AttributeListImpl(); for( int i=0; i





© 2015 - 2025 Weber Informatics LLC | Privacy Policy