org.jboss.xb.binding
Class XsMarshaller

java.lang.Object
  extended by org.jboss.xb.binding.AbstractMarshaller
      extended by org.jboss.xb.binding.XsMarshaller
All Implemented Interfaces:
Marshaller

public class XsMarshaller
extends AbstractMarshaller

An XML schema based org.jboss.xb.binding.Marshaller implementation.

Version:
$Revision: 1.1.2.3 $
Author:
Alexey Loubyansky

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.xb.binding.AbstractMarshaller
AbstractMarshaller.ClassMapping, AbstractMarshaller.Stack, AbstractMarshaller.StackImpl
 
Nested classes/interfaces inherited from interface org.jboss.xb.binding.Marshaller
Marshaller.FACTORY
 
Field Summary
 
Fields inherited from class org.jboss.xb.binding.AbstractMarshaller
encoding, rootQNames, version
 
Fields inherited from interface org.jboss.xb.binding.Marshaller
ENCODING, PROP_MARSHALLER, PROP_OUTPUT_INDENTATION, PROP_OUTPUT_XML_VERSION, VERSION
 
Constructor Summary
XsMarshaller()
           
 
Method Summary
 void addAttribute(String prefix, String localName, String type, String value)
          Adds an attribute to the top most elements.
 void addAttribute(String namespaceUri, String prefix, String localName, String type, String value)
          Adds an attribute to the top most elements declaring namespace prefix if it is not yet declared.
 void declareNamespace(String prefix, String uri)
          Defines a namespace.
 void marshal(Reader schema, ObjectModelProvider provider, Object root, Writer writer)
           
 
Methods inherited from class org.jboss.xb.binding.AbstractMarshaller
addRootElement, addRootElement, getClassMapping, getProperty, mapClassToNamespace, mapClassToNamespace, mapPublicIdToSystemId, marshal, propertyIsTrueOrNotSet, setEncoding, setProperty, setVersion, writeXmlVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XsMarshaller

public XsMarshaller()
Method Detail

marshal

public void marshal(Reader schema,
                    ObjectModelProvider provider,
                    Object root,
                    Writer writer)
             throws IOException,
                    SAXException,
                    ParserConfigurationException
Throws:
IOException
SAXException
ParserConfigurationException

declareNamespace

public void declareNamespace(String prefix,
                             String uri)
Defines a namespace. The namespace declaration will appear in the root element.

If name argument is null or is an empty string then the passed in URI will be used for the default namespace, i.e. xmlns. Otherwise, the declaration will follow the format xmlns:name=uri.

If the namespace with the given name was already declared, its value is overwritten.

Parameters:
prefix - the prefix of the namespace to declare
uri - the URI of the namespace.

addAttribute

public void addAttribute(String prefix,
                         String localName,
                         String type,
                         String value)
Adds an attribute to the top most elements. First, we check whether there is a namespace associated with the passed in prefix. If the prefix was not declared, an exception is thrown.

Parameters:
prefix - the prefix of the attribute to be declared
localName - local name of the attribute
type - the type of the attribute
value - the value of the attribute

addAttribute

public void addAttribute(String namespaceUri,
                         String prefix,
                         String localName,
                         String type,
                         String value)
Adds an attribute to the top most elements declaring namespace prefix if it is not yet declared.

Parameters:
namespaceUri - attribute's namespace URI
prefix - attribute's prefix
localName - attribute's local name
type - attribute's type
value - attribute's value


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.