You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2002/05/29 23:28:02 UTC
cvs commit: xml-xerces/c/src/xercesc/dom DOMBuilder.hpp DOMEntityResolver.hpp DOMImplementationLS.hpp DOMInputSource.hpp
knoaman 02/05/29 14:28:02
Added: c/src/xercesc/dom DOMBuilder.hpp DOMEntityResolver.hpp
DOMImplementationLS.hpp DOMInputSource.hpp
Log:
DOM L3 LS: DOMInputSource, DOMEntityResolver, DOMImplementationLS and DOMBuilder
Revision Changes Path
1.1 xml-xerces/c/src/xercesc/dom/DOMBuilder.hpp
Index: DOMBuilder.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DOMBuilder.hpp,v 1.1 2002/05/29 21:28:02 knoaman Exp $
*
*/
#ifndef DOMBUILDER_HPP
#define DOMBUILDER_HPP
#include <xercesc/util/XercesDefs.hpp>
class DOMErrorHandler;
class DOMEntityResolver;
class DOMInputSource;
class DOMBuilderFilter;
class DOMNode;
class DOMDocument;
/**
* DOMBuilder provides an API for parsing XML documents and building the
* corresponding DOM document tree. A DOMBuilder instance is obtained from
* the DOMImplementationLS interface by invoking its createDOMBuilder method.
* This implementation also allows the applications to install an error and
* an entity handler (useful extensions to the DOM specification).
*
*/
class CDOM_EXPORT DOMBuilder
{
protected :
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
/** @name Constructors */
//@{
/** Default constructor */
DOMBuilder() {};
//@}
public :
// -----------------------------------------------------------------------
// Class types
// -----------------------------------------------------------------------
enum ActionType
{
ACTION_REPLACE = 1,
ACTION_APPEND_AS_CHILDREN = 2,
ACTION_INSERT_AFTER = 3,
ACTION_INSERT_BEFORE = 4
};
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
/** @name Destructor */
//@{
/**
* Destructor
*
*/
virtual ~DOMBuilder() {};
//@}
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
/** @name Getter methods */
//@{
/** Get a pointer to the error handler
*
* This method returns the installed error handler. If no handler
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed error handler object.
*/
virtual DOMErrorHandler* getErrorHandler() = 0;
/** Get a const pointer to the error handler
*
* This method returns the installed error handler. If no handler
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed error handler object.
*/
virtual const DOMErrorHandler* getErrorHandler() const = 0;
/** Get a pointer to the entity resolver
*
* This method returns the installed entity resolver. If no resolver
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed entity resolver object.
*/
virtual DOMEntityResolver* getEntityResolver() = 0;
/** Get a const pointer to the entity resolver
*
* This method returns the installed entity resolver. If no resolver
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed entity resolver object.
*/
virtual const DOMEntityResolver* getEntityResolver() const = 0;
/** Get a pointer to the application filter
*
* This method returns the installed application filter. If no filter
* has been installed, then it will be a zero pointer.
*
* @return The pointer to the installed application filter.
*/
virtual DOMBuilderFilter* getFilter() = 0;
/** Get a const pointer to the application filter
*
* This method returns the installed application filter. If no filter
* has been installed, then it will be a zero pointer.
*
* @return A const pointer to the installed application filter
*/
virtual const DOMBuilderFilter* getFilter() const = 0;
//@}
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
/** @name Setter methods */
//@{
/** Set the error handler
*
* This method allows applications to install their own error handler
* to trap error and warning messages.
*
* <i>Any previously set handler is merely dropped, since the parser
* does not own them.</i>
*
* @param handler A const pointer to the user supplied error
* handler.
*
* @see #getErrorHandler
*/
virtual void setErrorHandler(DOMErrorHandler* const handler) = 0;
/** Set the entity resolver
*
* This method allows applications to install their own entity
* resolver. By installing an entity resolver, the applications
* can trap and potentially redirect references to external
* entities.
*
* <i>Any previously set resolver is merely dropped, since the parser
* does not own them.</i>
*
* @param handler A const pointer to the user supplied entity
* resolver.
*
* @see #getEntityResolver
*/
virtual void setEntityResolver(DOMEntityResolver* const handler) = 0;
/** Set the application filter
*
* When the application provides a filter, the parser will call out to
* the filter at the completion of the construction of each Element node.
* The filter implementation can choose to remove the element from the
* document being constructed (unless the element is the document element)
* or to terminate the parse early. If the document is being validated
* when it's loaded the validation happens before the filter is called.
*
* <i>Any previously set filter is merely dropped, since the parser
* does not own them.</i>
*
* @param filter A const pointer to the user supplied application
* filter.
*
* @see #getFilter
*/
virtual void setFilter(DOMBuilderFilter* const filter) = 0;
//@}
// -----------------------------------------------------------------------
// Feature methods
// -----------------------------------------------------------------------
/** @name Feature methods */
//@{
/** Set the state of a feature
*
* It is possible for a DOMBuilder to recognize a feature name but to be
* unable to set its value.
*
* @param name The feature name.
* @param state The requested state of the feature (true or false).
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the DOMBuilder recognizes the
* feature name but cannot set the requested value.
* <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
* the feature name.
*
* @see #setFeature
* @see #canSetFeature
*/
virtual void setFeature(const XMLCh* const name, const bool state) = 0;
/** Look up the value of a feature.
*
* @param name The feature name.
* @return The current state of the feature (true or false)
* @exception DOMException
* NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
* the feature name.
*
* @see #getFeature
* @see #canSetFeature
*/
virtual bool getFeature(const XMLCh* const name) = 0;
/** Query whether setting a feature to a specific value is supported.
*
* @param name The feature name.
* @param state The requested state of the feature (true or false).
* @return <code>true</code> if the feature could be successfully set
* to the specified value, or <code>false</code> if the feature
* is not recognized or the requested value is not supported. The
* value of the feature itself is not changed.
*
* @see #getFeature
* @see #setFeature
*/
virtual bool canSetFeature(const XMLCh* const name, const bool state) = 0;
//@}
// -----------------------------------------------------------------------
// Parsing methods
// -----------------------------------------------------------------------
/** @name Parsing methods */
//@{
/** Parse via an input source object
*
* This method invokes the parsing process on the XML file specified
* by the DOMInputSource parameter. This API is borrowed from the
* SAX Parser interface.
*
* @param source A const reference to the DOMInputSource object which
* points to the XML file to be parsed.
* @param reuseGrammar The flag indicating whether the existing Grammar
* should be reused or not for this parsing run.
* If true, there cannot be any internal subset.
* @return If the DOMBuilder is a synchronous DOMBuilder the newly created
* and populated Document is returned. If the DOMBuilder is
* asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOMException A DOM exception as per DOM spec.
*
* @see DOMInputSource#DOMInputSource
* @see #setEntityResolver
* @see #setErrorHandler
*/
virtual DOMDocument* parse(const DOMInputSource& source, const bool reuseGrammar = false) = 0;
/** Parse via a file path or URL
*
* This method invokes the parsing process on the XML file specified by
* the Unicode string parameter 'systemId'.
*
* @param systemId A const XMLCh pointer to the Unicode string which
* contains the path to the XML file to be parsed.
* @param reuseGrammar The flag indicating whether the existing Grammar
* should be reused or not for this parsing run.
* If true, there cannot be any internal subset.
* @return If the DOMBuilder is a synchronous DOMBuilder the newly created
* and populated Document is returned. If the DOMBuilder is
* asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOMException A DOM exception as per DOM spec.
*
* @see #parse(DOMInputSource,...)
*/
virtual DOMDocument* parseURI(const XMLCh* const systemId, const bool reuseGrammar = false) = 0;
/** Parse via a file path or URL (in the local code page)
*
* This method invokes the parsing process on the XML file specified by
* the native char* string parameter 'systemId'.
*
* @param systemId A const char pointer to a native string which
* contains the path to the XML file to be parsed.
* @param reuseGrammar The flag indicating whether the existing Grammar
* should be reused or not for this parsing run.
* If true, there cannot be any internal subset.
* @return If the DOMBuilder is a synchronous DOMBuilder the newly created
* and populated Document is returned. If the DOMBuilder is
* asynchronous then <code>null</code> is returned since the
* document object is not yet parsed when this method returns.
* @exception SAXException Any SAX exception, possibly
* wrapping another exception.
* @exception XMLException An exception from the parser or client
* handler code.
* @exception DOMException A DOM exception as per DOM spec.
*
* @see #parse(DOMInputSource,...)
*/
virtual DOMDocument* parseURI(const char* const systemId, const bool reuseGrammar = false) = 0;
/** Parse via an input source object
*
* This method invokes the parsing process on the XML file specified
* by the DOMInputSource parameter, and inserts the content into an
* existing document at the position specified with the contextNode
* and action arguments. When parsing the input stream the context node
* is used for resolving unbound namespace prefixes.
*
* @param source A const reference to the DOMInputSource object which
* points to the XML file to be parsed.
* @param contextNode The node that is used as the context for the data
* that is being parsed. This node must be a Document
* node, a DocumentFragment node, or a node of a type
* that is allowed as a child of an element, e.g. it
* can not be an attribute node.
* @param action This parameter describes which action should be taken
* between the new set of node being inserted and the
* existing children of the context node.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised when the DOMBuilder doesn't support
* this method.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is
* readonly.
*/
virtual void parseWithContext
(
const DOMInputSource& source
, DOMNode* const contextNode
, const short action
) = 0;
private :
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
DOMBuilder(const DOMBuilder&);
void operator=(const DOMBuilder&);
};
#endif
1.1 xml-xerces/c/src/xercesc/dom/DOMEntityResolver.hpp
Index: DOMEntityResolver.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: DOMEntityResolver.hpp,v $
* Revision 1.1 2002/05/29 21:28:02 knoaman
* DOM L3 LS: DOMInputSource, DOMEntityResolver, DOMImplementationLS and DOMBuilder
*
*/
#ifndef DOMENTITYRESOLVER_HPP
#define DOMENTITYRESOLVER_HPP
#include <xercesc/util/XercesDefs.hpp>
class DOMInputSource;
/**
* DOMEntityResolver provides a way for applications to redirect references
* to external entities.
*
* <p>Applications needing to implement customized handling for external
* entities must implement this interface and register their implementation
* by setting the entityResolver attribute of the DOMBuilder.</p>
*
* <p>The DOMBuilder will then allow the application to intercept any
* external entities (including the external DTD subset and external parameter
* entities) before including them.</p>
*
* <p>Many DOM applications will not need to implement this interface, but it
* will be especially useful for applications that build XML documents from
* databases or other specialized input sources, or for applications that use
* URNs.</p>
*
* @see DOMBuilder#setEntityResolver
* @see DOMInputSource#DOMInputSource
*/
class CDOM_EXPORT DOMEntityResolver
{
protected:
/** @name Constructors */
//@{
/** Default Constructor */
DOMEntityResolver() {};
//@}
public:
/** @name Destructor */
//@{
/** Destructor */
virtual ~DOMEntityResolver() {};
//@}
/** @name The DOMEntityResolver interface */
//@{
/**
* Allow the application to resolve external entities.
*
* <p>The DOMBuilder will call this method before opening any external
* entity except the top-level document entity (including the
* external DTD subset, external entities referenced within the
* DTD, and external entities referenced within the document
* element): the application may request that the DOMBuilder resolve
* the entity itself, that it use an alternative URI, or that it
* use an entirely different input source.</p>
*
* <p>Application writers can use this method to redirect external
* system identifiers to secure and/or local URIs, to look up
* public identifiers in a catalogue, or to read an entity from a
* database or other input source (including, for example, a dialog
* box).</p>
*
* <p>If the system identifier is a URL, the DOMBuilder parser must
* resolve it fully before reporting it to the application.</p>
*
* @param publicId The public identifier of the external entity
* being referenced, or null if none was supplied.
* @param systemId The system identifier of the external entity
* being referenced.
* @param baseURI The absolute base URI of the resource being parsed, or
* <code>null</code> if there is no base URI.
* @return A DOMInputSource object describing the new input source,
* or <code>null</code> to request that the parser open a regular
* URI connection to the system identifier.
* @exception DOMSystemException Any DOMSystemException exception, possibly
* wrapping another exception.
* @see DOMInputSource#DOMInputSource
*/
virtual DOMInputSource* resolveEntity
(
const XMLCh* const publicId
, const XMLCh* const systemId
, const XMLCh* const baseURI
) = 0;
//@}
private :
/* Unimplemented constructors and operators */
/* Copy constructor */
DOMEntityResolver(const DOMEntityResolver&);
/* Assignment operator */
void operator=(const DOMEntityResolver&);
};
#endif
1.1 xml-xerces/c/src/xercesc/dom/DOMImplementationLS.hpp
Index: DOMImplementationLS.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: DOMImplementationLS.hpp,v $
* Revision 1.1 2002/05/29 21:28:02 knoaman
* DOM L3 LS: DOMInputSource, DOMEntityResolver, DOMImplementationLS and DOMBuilder
*
*/
#ifndef DOMIMPLEMENTATIONLS_HPP
#define DOMIMPLEMENTATIONLS_HPP
#include <xercesc/util/XercesDefs.hpp>
class DOMBuilder;
class DOMWriter;
class DOMInputSource;
/**
*
* <p><code>DOMImplementationLS</code> contains the factory methods for
* creating objects that implement the <code>DOMBuilder</code> (parser) and
* <code>DOMWriter</code> (serializer) interfaces.</p>
*
* <p>An object that implements DOMImplementationLS is obtained by doing a
* binding specific cast from DOMImplementation to DOMImplementationLS.
* Implementations supporting the Load and Save feature must implement the
* DOMImplementationLS interface on whatever object implements the
* DOMImplementation interface.</p>
*/
class CDOM_EXPORT DOMImplementationLS
{
protected :
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
/** @name Constructors */
//@{
/** Default constructor */
DOMImplementationLS() {};
//@}
public:
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
/** @name Destructor */
//@{
/**
* Destructor
*
*/
virtual ~DOMImplementationLS() {};
//@}
// -----------------------------------------------------------------------
// Public constants
// -----------------------------------------------------------------------
enum
{
MODE_SYNCHRONOUS = 1,
MODE_ASYNCHRONOUS = 2
};
// -----------------------------------------------------------------------
/** @name Virtual DOMImplementation LS interface */
//@{
/**
* <p>Create a new DOMBuilder. The newly constructed parser may then be
* configured by means of its setFeature method, and used to parse
* documents by means of its parse method.</p>
*
* @param mode The mode argument is either <code>MODE_SYNCHRONOUS</code> or
* <code>MODE_ASYNCHRONOUS</code>, if mode is <code>MODE_SYNCHRONOUS</code>
* then the <code>DOMBuilder</code> that is created will operate in
* synchronous mode, if it's <code>MODE_ASYNCHRONOUS</code> then the
* <code>DOMBuilder</code> that is created will operate in asynchronous
* mode.
* @param schemaType An absolute URI representing the type of the schema
* language used during the load of a Document using the newly created
* <code>DOMBuilder</code>. Note that no lexical checking is done on the
* absolute URI. In order to create a DOMBuilder for any kind of schema
* types (i.e. the DOMBuilder will be free to use any schema found), use
* the value <code>null</code>.
* @return The newly created <code>DOMBuilder<code> object. This
* <code>DOMBuilder</code> is either synchronous or asynchronous depending
* on the value of the <code>mode<code> argument.
* @exception DOMException NOT_SUPPORTED_ERR: Raised if the requested mode
* or schema type is not supported.
*
* @see DOMBuilder
*/
virtual DOMBuilder* createDOMBuilder(const short mode,
const XMLCh* const schemaType) = 0;
/**
* <p>Create a new DOMWriter. DOMWriters are used to serialize a DOM tree
* back into an XML document.</p>
*
* @return The newly created <code>DOMWriter<code> object.
*
* @see DOMWriter
*/
virtual DOMWriter* createDOMWriter() = 0;
/**
* <p>Create a new "empty" DOMInputSource.</p>
*
* @return The newly created <code>DOMInputSource<code> object.
*
* @see DOMInputSource
*/
virtual DOMInputSource* createDOMInputSource() = 0;
//@}
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
DOMImplementationLS(const DOMImplementationLS&);
void operator=(const DOMImplementationLS&);
};
#endif
1.1 xml-xerces/c/src/xercesc/dom/DOMInputSource.hpp
Index: DOMInputSource.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: DOMInputSource.hpp,v $
* Revision 1.1 2002/05/29 21:28:02 knoaman
* DOM L3 LS: DOMInputSource, DOMEntityResolver, DOMImplementationLS and DOMBuilder
*
*/
#ifndef DOMINPUTSOURCE_HPP
#define DOMINPUTSOURCE_HPP
#include <xercesc/util/XercesDefs.hpp>
class BinInputStream;
/**
* This interface represents a single input source for an XML entity.
*
* <p>This interface allows an application to encapsulate information about
* an input source in a single object, which may include a public identifier,
* a system identifier, a byte stream (possibly with a specified encoding),
* and/or a character stream.</p>
*
* <p>There are two places that the application will deliver this input source
* to the parser: as the argument to the parse method, or as the return value
* of the DOMEntityResolver.resolveEntity method.</p>
*
* <p>The DOMBuilder will use the DOMInputSource object to determine how to
* read XML input. If there is a character stream available, the parser will
* read that stream directly; if not, the parser will use a byte stream, if
* available; if neither a character stream nor a byte stream is available,
* the parser will attempt to open a URI connection to the resource identified
* by the system identifier.</p>
*
* <p>A DOMInputSource object belongs to the application: the parser shall
* never modify it in any way (it may modify a copy if necessary).</p>
*
* @see DOMBuilder#parse
* @see DOMEntityResolver#resolveEntity
*/
class CDOM_EXPORT DOMInputSource
{
protected :
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
/** @name Constructors */
//@{
/** Default constructor */
DOMInputSource() {};
//@}
public:
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
/** @name Destructor */
//@{
/**
* Destructor
*
*/
virtual ~DOMInputSource() {};
//@}
// -----------------------------------------------------------------------
/** @name Virtual input source interface */
//@{
/**
* Makes the byte stream for this input source.
*
* <p>The derived class must create and return a binary input stream of an
* appropriate type for its kind of data source. The returned stream must
* be dynamically allocated and becomes the parser's property.
* </p>
*
* @see BinInputStream
*/
virtual BinInputStream* makeStream() const = 0;
//@}
// -----------------------------------------------------------------------
/** @name Getter methods */
//@{
/**
* An input source can be set to force the parser to assume a particular
* encoding for the data that input source reprsents, via the setEncoding()
* method. This method returns name of the encoding that is to be forced.
* If the encoding has never been forced, it returns a null pointer.
*
* @return The forced encoding, or null if none was supplied.
* @see #setEncoding
*/
virtual const XMLCh* getEncoding() const = 0;
/**
* Get the public identifier for this input source.
*
* @return The public identifier, or null if none was supplied.
* @see #setPublicId
*/
virtual const XMLCh* getPublicId() const = 0;
/**
* Get the system identifier for this input source.
*
* <p>If the system ID is a URL, it will be fully resolved.</p>
*
* @return The system identifier.
* @see #setSystemId
*/
virtual const XMLCh* getSystemId() const = 0;
/**
* Get the base URI to be used for resolving relative URIs to absolute
* URIs. If the baseURI is itself a relative URI, the behavior is
* implementation dependent.
*
* @return The base URI.
* @see #setBaseURI
*/
virtual const XMLCh* getBaseURI() const = 0;
/**
* Get the flag that indicates if the parser should issue fatal error if this input source
* is not found.
*
* @return True if the parser should issue fatal error if this input source is not found.
* False if the parser issue warning message instead.
* @see #setIssueFatalErrorIfNotFound
*/
virtual const bool getIssueFatalErrorIfNotFound() const = 0;
//@}
// -----------------------------------------------------------------------
/** @name Setter methods */
//@{
/**
* Set the encoding which will be required for use with the XML text read
* via a stream opened by this input source.
*
* <p>This is usually not set, allowing the encoding to be sensed in the
* usual XML way. However, in some cases, the encoding in the file is known
* to be incorrect because of intermediate transcoding, for instance
* encapsulation within a MIME document.
*
* @param encodingStr The name of the encoding to force.
*/
virtual void setEncoding(const XMLCh* const encodingStr) = 0;
/**
* Set the public identifier for this input source.
*
* <p>The public identifier is always optional: if the application writer
* includes one, it will be provided as part of the location information.</p>
*
* @param publicId The public identifier as a string.
* @see #getPublicId
*/
virtual void setPublicId(const XMLCh* const publicId) = 0;
/**
* Set the system identifier for this input source.
*
* <p>Set the system identifier for this input source.
*
* </p>The system id is always required. The public id may be used to map
* to another system id, but the system id must always be present as a fall
* back.
*
* <p>If the system ID is a URL, it must be fully resolved.</p>
*
* @param systemId The system identifier as a string.
* @see #getSystemId
*/
virtual void setSystemId(const XMLCh* const systemId) = 0;
/**
* Set the base URI to be used for resolving relative URIs to absolute
* URIs. If the baseURI is itself a relative URI, the behavior is
* implementation dependent.
*
* @param baseURI The base URI.
* @see #getBaseURI
*/
virtual void setBaseURI(const XMLCh* const baseURI) = 0;
/**
* Indicates if the parser should issue fatal error if this input source
* is not found. If set to false, the parser issue warning message instead.
*
* @param flag True if the parser should issue fatal error if this input source is not found.
* If set to false, the parser issue warning message instead. (Default: true)
*
* @see #getIssueFatalErrorIfNotFound
*/
virtual void setIssueFatalErrorIfNotFound(const bool flag) = 0;
//@}
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
DOMInputSource(const DOMInputSource&);
void operator=(const DOMInputSource&);
};
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org