
net.sf.xolite.XMLSerializable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xo-lite Show documentation
Show all versions of xo-lite Show documentation
This project provides a lightweight framework to
serialize/deserialize (or marshall/unmarshall) java objects into
XML. The implementation is based on standard SAX (Simple Api for
Xml) but it follows a original approach based on the strong data
encapsulation paradigm of Object Oriented (OO)
programming.
The newest version!
/*-------------------------------------------------------------------------
Copyright 2006 Olivier Berlanger
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------*/
package net.sf.xolite;
/**
* Interface implemented by object to be serialisable (back and forth) to XML.
*
* @author Olivier Berlanger
* @see XMLEventParser
* @see XMLSerializer
*/
public interface XMLSerializable {
/**
* Receive notification of the start of an element. (Method for simplified event-driven parsing = simplified SAX)
*
* @param uri
* The started element namespace URI.
* @param localName
* The started element local name (= name without the namespace prefix) .
* @param parser
* The current XML event parser. From this parser you can get the attributes of the started element, the SAX
* Locator, the defined namespace prefix mappings.
* @exception XMLParseException
* Any SAX exception, possibly wrapping another exception.
* @see org.xml.sax.ContentHandler#startElement
*/
public void startElement(String uri, String localName, XMLEventParser parser) throws XMLParseException;
/**
* Receive notification of the end of an element. (Method for simplified event-driven parsing = simplified SAX)
*
* @param uri
* The ended element namespace URI.
* @param localName
* The ended element local name (= name without the namespace prefix) .
* @param parser
* The current XML event parser. From this parser you can get SAX Locator or the text content of the ended
* element.
* @exception XMLParseException
* Any SAX exception, possibly wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
*/
public void endElement(String uri, String localName, XMLEventParser parser) throws XMLParseException;
/**
* Serialize this object to an XML representation (in a DOM tree, a Stream, ...). (Method for serialisation using a visitor
* pattern.)
*
* @param serializer
* The object implementing the actual serialization.
* @exception XMLSerializeException
* if something fails.
*/
public void serialize(XMLSerializer serializer) throws XMLSerializeException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy