Reordered files in all libs - now all includes are in "libname/include" dir - logical, isn't it? This should break compilation however.
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: BinOutputStream.hpp 553915 2007-07-06 14:57:08Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_BIN_OUTPUT_STREAM_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_BIN_OUTPUT_STREAM_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLUTIL_EXPORT BinOutputStream : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual destructor for derived classes
|
||||
// -----------------------------------------------------------------------
|
||||
virtual ~BinOutputStream();
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual output stream interface
|
||||
// -----------------------------------------------------------------------
|
||||
virtual XMLFilePos curPos() const = 0;
|
||||
|
||||
virtual void writeBytes
|
||||
(
|
||||
const XMLByte* const toGo
|
||||
, const XMLSize_t maxToWrite
|
||||
) = 0;
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
BinOutputStream();
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
BinOutputStream(const BinOutputStream&);
|
||||
BinOutputStream& operator=(const BinOutputStream&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: LocalFileFormatTarget.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP
|
||||
|
||||
#include <xercesc/framework/XMLFormatter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget {
|
||||
public:
|
||||
|
||||
/** @name constructors and destructor */
|
||||
//@{
|
||||
LocalFileFormatTarget
|
||||
(
|
||||
const XMLCh* const
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
LocalFileFormatTarget
|
||||
(
|
||||
const char* const
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
~LocalFileFormatTarget();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Implementations of the format target interface
|
||||
// -----------------------------------------------------------------------
|
||||
virtual void writeChars(const XMLByte* const toWrite
|
||||
, const XMLSize_t count
|
||||
, XMLFormatter* const formatter);
|
||||
|
||||
virtual void flush();
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented methods.
|
||||
// -----------------------------------------------------------------------
|
||||
LocalFileFormatTarget(const LocalFileFormatTarget&);
|
||||
LocalFileFormatTarget& operator=(const LocalFileFormatTarget&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private helpers
|
||||
// -----------------------------------------------------------------------
|
||||
void ensureCapacity(const XMLSize_t extraNeeded);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fSource
|
||||
// The source file that we represent. The FileHandle type is defined
|
||||
// per platform.
|
||||
//
|
||||
// fDataBuf
|
||||
// The pointer to the buffer data. Its always
|
||||
// one larger than fCapacity, to leave room for the null terminator.
|
||||
//
|
||||
// fIndex
|
||||
// The current index into the buffer, as characters are appended
|
||||
// to it. If its zero, then the buffer is empty.
|
||||
//
|
||||
// fCapacity
|
||||
// The current capacity of the buffer. Its actually always one
|
||||
// larger, to leave room for the null terminator.
|
||||
// -----------------------------------------------------------------------
|
||||
FileHandle fSource;
|
||||
XMLByte* fDataBuf;
|
||||
XMLSize_t fIndex;
|
||||
XMLSize_t fCapacity;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: LocalFileInputSource.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEINPUTSOURCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_LOCALFILEINPUTSOURCE_HPP
|
||||
|
||||
#include <xercesc/sax/InputSource.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class BinInputStream;
|
||||
|
||||
/**
|
||||
* This class is a derivative of the standard InputSource class. It provides
|
||||
* for the parser access to data which is referenced via a local file path,
|
||||
* as apposed to remote file or URL. This is the most efficacious mechanism
|
||||
* by which local files can be parsed, since the parse knows that it refers
|
||||
* to a local file and will make no other attempts to interpret the passed
|
||||
* path.
|
||||
*
|
||||
* The path provided can either be a fully qualified path or a relative path.
|
||||
* If relative, it will be completed either relative to a passed base path
|
||||
* or relative to the current working directory of the process.
|
||||
*
|
||||
* As with all InputSource derivatives. The primary objective of an input
|
||||
* source is to create an input stream via which the parser can spool in
|
||||
* data from the referenced source.
|
||||
*/
|
||||
class XMLPARSER_EXPORT LocalFileInputSource : public InputSource
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* A local file input source requires a path to the file to load. This
|
||||
* can be provided either as a fully qualified path, a path relative to
|
||||
* the current working directly, or a path relative to a provided base
|
||||
* path.
|
||||
*
|
||||
* The completed path will become the system id of this input source.
|
||||
* The constructors don't take any public id for local files, but you
|
||||
* still set them via the parent class' setPublicId() method of course.
|
||||
*
|
||||
* This constructor takes an explicit base path and a possibly relative
|
||||
* path. If the relative path is seen to be fully qualified, it is used
|
||||
* as is. Otherwise, it is made relative to the passed base path.
|
||||
*
|
||||
* @param basePath The base path from which the passed relative path
|
||||
* will be based, if the relative part is indeed
|
||||
* relative.
|
||||
*
|
||||
* @param relativePath The relative part of the path. It can actually
|
||||
* be fully qualified, in which case it is taken
|
||||
* as is.
|
||||
*
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*
|
||||
* @exception XMLException If the path is relative and doesn't properly
|
||||
* resolve to a file.
|
||||
*/
|
||||
LocalFileInputSource
|
||||
(
|
||||
const XMLCh* const basePath
|
||||
, const XMLCh* const relativePath
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* This constructor takes a single parameter which is the fully qualified
|
||||
* or relative path. If it is fully qualified, it is taken as is. If it is
|
||||
* relative, then it is completed relative to the current working directory
|
||||
* (or the equivalent on the local host machine.)
|
||||
*
|
||||
* The completed path will become the system id of this input source.
|
||||
* The constructors don't take any public id for local files, but you
|
||||
* still set them via the parent class' setPublicId() method of course.
|
||||
*
|
||||
* @param filePath The relative or fully qualified path.
|
||||
*
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*
|
||||
* @exception XMLException If the path is relative and doesn't properly
|
||||
* resolve to a file.
|
||||
*/
|
||||
LocalFileInputSource
|
||||
(
|
||||
const XMLCh* const filePath
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~LocalFileInputSource();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual input source interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method will return a binary input stream derivative that will
|
||||
* parse from the local file indicatedby the system id.
|
||||
*
|
||||
* @return A dynamically allocated binary input stream derivative that
|
||||
* can parse from the file indicated by the system id.
|
||||
*/
|
||||
virtual BinInputStream* makeStream() const;
|
||||
|
||||
//@}
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
LocalFileInputSource(const LocalFileInputSource&);
|
||||
LocalFileInputSource& operator=(const LocalFileInputSource&);
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: MemBufFormatTarget.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_MEMBUFFORMATTARGET_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_MEMBUFFORMATTARGET_HPP
|
||||
|
||||
#include <xercesc/framework/XMLFormatter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/*
|
||||
* The MemBufFormatTarget is a derivative from XMLFormatTarget, which user code
|
||||
* may plug into DOMLSSerializer to retrieve the serialized XML stream (from DOM Tree)
|
||||
* in a memory buffer.
|
||||
*
|
||||
* The MemBufFormatTarget is initialized to have a memory buffer of 1023 upon
|
||||
* construction, which grows as needed. The buffer will be deleted when
|
||||
* MemBufFormatTarget is destructed; or will be reset when the reset() function
|
||||
* is called.
|
||||
*
|
||||
* The MemBufFormatTarget returns a NULL terminated XMLByte stream upon request,
|
||||
* through the method getRawBuffer(), and user should make its own copy of the
|
||||
* returned buffer if it intends to keep it independent on the state of the
|
||||
* MemBufFormatTarget.
|
||||
*/
|
||||
|
||||
class XMLPARSER_EXPORT MemBufFormatTarget : public XMLFormatTarget {
|
||||
public:
|
||||
|
||||
/** @name constructors and destructor */
|
||||
//@{
|
||||
MemBufFormatTarget
|
||||
(
|
||||
XMLSize_t initCapacity = 1023
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
) ;
|
||||
~MemBufFormatTarget();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Implementations of the format target interface
|
||||
// -----------------------------------------------------------------------
|
||||
virtual void writeChars(const XMLByte* const toWrite
|
||||
, const XMLSize_t count
|
||||
, XMLFormatter* const formatter);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name getRawBuffer */
|
||||
//@{
|
||||
/**
|
||||
* Returned the internal raw buffer.
|
||||
*
|
||||
*/
|
||||
//@}
|
||||
const XMLByte* getRawBuffer() const;
|
||||
|
||||
/** @name getLen */
|
||||
//@{
|
||||
/**
|
||||
* Returned the length of the raw buffer.
|
||||
*
|
||||
*/
|
||||
//@}
|
||||
XMLSize_t getLen() const
|
||||
{
|
||||
return fIndex;
|
||||
}
|
||||
|
||||
/** @name reset */
|
||||
//@{
|
||||
/**
|
||||
* Reset the internal string buffer.
|
||||
*
|
||||
*/
|
||||
void reset();
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented methods.
|
||||
// -----------------------------------------------------------------------
|
||||
MemBufFormatTarget(const MemBufFormatTarget&);
|
||||
MemBufFormatTarget& operator=(const MemBufFormatTarget&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private helpers
|
||||
// -----------------------------------------------------------------------
|
||||
void ensureCapacity(const XMLSize_t extraNeeded);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fDataBuf
|
||||
// The pointer to the buffer data. Its grown as needed. Its always
|
||||
// one larger than fCapacity, to leave room for the null terminator.
|
||||
//
|
||||
// fIndex
|
||||
// The current index into the buffer, as characters are appended
|
||||
// to it. If its zero, then the buffer is empty.
|
||||
//
|
||||
// fCapacity
|
||||
// The current capacity of the buffer. Its actually always one
|
||||
// larger, to leave room for the null terminator.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
MemoryManager* fMemoryManager;
|
||||
XMLByte* fDataBuf;
|
||||
XMLSize_t fIndex;
|
||||
XMLSize_t fCapacity;
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: MemBufInputSource.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_MEMBUFINPUTSOURCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_MEMBUFINPUTSOURCE_HPP
|
||||
|
||||
#include <xercesc/sax/InputSource.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class BinInputStream;
|
||||
|
||||
|
||||
/**
|
||||
* This class is a derivative of the standard InputSource class. It provides
|
||||
* for the parser access to data stored in a memory buffer. The type of
|
||||
* buffer and its host specific attributes are of little concern here. The
|
||||
* only real requirement is that the memory be readable by the current
|
||||
* process.
|
||||
*
|
||||
* Note that the memory buffer size is expressed in <b>bytes</b>, not in
|
||||
* characters. If you pass it text data, you must account for the bytes
|
||||
* per character when indicating the buffer size.
|
||||
*
|
||||
* As with all InputSource derivatives. The primary objective of an input
|
||||
* source is to create an input stream via which the parser can spool in
|
||||
* data from the referenced source. In this case, there are two options
|
||||
* available.
|
||||
*
|
||||
* The passed buffer can be adopted or merely referenced. If it is adopted,
|
||||
* then it must be dynamically allocated and will be destroyed when the
|
||||
* input source is destroyed (no reference counting!.) If not adopted, the
|
||||
* caller must insure that it remains valid until the input source object
|
||||
* is destroyed.
|
||||
*
|
||||
* The other option indicates whether each stream created for this input
|
||||
* source should get its own copy of the data, or whether it should just
|
||||
* stream the data directly from this object's copy of the data. The same
|
||||
* rules apply here, in that the buffer must either be copied by the
|
||||
* stream or it must remain valid until the stream is destroyed.
|
||||
*/
|
||||
class XMLPARSER_EXPORT MemBufInputSource : public InputSource
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* A memory buffer input source is constructed from a buffer of byte
|
||||
* data, and the count of bytes in that buffer. The parser will parse
|
||||
* from this memory buffer until it has eaten the indicated number of
|
||||
* bytes.
|
||||
*
|
||||
* Note that the system id provided serves two purposes. Firstly it is
|
||||
* going to be displayed in error messages as the source of the error.
|
||||
* And secondly, any entities which are referred to from this entity
|
||||
* via relative paths/URLs will be relative to this fake system id.
|
||||
*
|
||||
* @param srcDocBytes The actual data buffer to be parsed from.
|
||||
* @param byteCount The count of bytes (not characters, bytes!)
|
||||
* in the buffer.
|
||||
* @param bufId A fake system id for the buffer.
|
||||
* @param adoptBuffer Indicates whether this object should adopt
|
||||
* the buffer (i.e. become responsible for
|
||||
* deletion) or just
|
||||
* use it in place.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
MemBufInputSource
|
||||
(
|
||||
const XMLByte* const srcDocBytes
|
||||
, const XMLSize_t byteCount
|
||||
, const XMLCh* const bufId
|
||||
, const bool adoptBuffer = false
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* This constructor is identical to the previous one, except that it takes
|
||||
* the fake system id in local code page form and transcodes it internally.
|
||||
*/
|
||||
MemBufInputSource
|
||||
(
|
||||
const XMLByte* const srcDocBytes
|
||||
, const XMLSize_t byteCount
|
||||
, const char* const bufId
|
||||
, const bool adoptBuffer = false
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
/**
|
||||
* If the buffer was adopted, the copy made during construction is deleted
|
||||
* at this point.
|
||||
*/
|
||||
~MemBufInputSource();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual input source interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method will return a binary input stream derivative that will
|
||||
* parse from the memory buffer. If setCopyBufToStream() has been set,
|
||||
* then the stream will make its own copy. Otherwise, it will use the
|
||||
* buffer as is (in which case it must remain valid until the stream
|
||||
* is no longer in use, i.e. the parse completes.)
|
||||
*
|
||||
* @return A dynamically allocated binary input stream derivative that
|
||||
* can parse from the memory buffer.
|
||||
*/
|
||||
BinInputStream* makeStream() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* By default, for safety's sake, each newly created stream from this
|
||||
* input source will make its own copy of the buffer to stream from. This
|
||||
* avoids having to deal with aliasing of the buffer for simple work. But,
|
||||
* for higher performance applications or for large buffers, this is
|
||||
* obviously not optimal.
|
||||
*
|
||||
* In such cases, you can call this method to turn off that default
|
||||
* action. Once turned off, the streams will just get a pointer to the
|
||||
* buffer and parse directly from that. In this case, you must insure that
|
||||
* the buffer remains valid for as long as any parse events are still
|
||||
* using it.
|
||||
*
|
||||
* @param newState The new boolean flag state to set.
|
||||
*/
|
||||
void setCopyBufToStream(const bool newState);
|
||||
|
||||
/**
|
||||
* This methods allows the MemBufInputSource to be used for more than
|
||||
* one input source, instead of destructing/constructing another
|
||||
* MemBufInputSource.
|
||||
*
|
||||
* @param srcDocBytes The actual data buffer to be parsed from.
|
||||
* @param byteCount The count of bytes (not characters, bytes!)
|
||||
* in the buffer.
|
||||
*/
|
||||
void resetMemBufInputSource(const XMLByte* const srcDocBytes
|
||||
, const XMLSize_t byteCount);
|
||||
//@}
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
MemBufInputSource(const MemBufInputSource&);
|
||||
MemBufInputSource& operator=(const MemBufInputSource&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fAdopted
|
||||
// Indicates whether the buffer is adopted or not. If so, then it
|
||||
// is destroyed when the input source is destroyed.
|
||||
//
|
||||
// fByteCount
|
||||
// The size of the source document.
|
||||
//
|
||||
// fCopyBufToStream
|
||||
// This defaults to true (the safe option), which causes it to
|
||||
// give a copy of the buffer to any streams it creates. If you set
|
||||
// it to false, it will allow the streams to just reference the
|
||||
// buffer (in which case this input source must stay alive as long
|
||||
// as the buffer is in use by the stream.)
|
||||
//
|
||||
// fSrcBytes
|
||||
// The source memory buffer that is being spooled from. Whether it
|
||||
// belongs to the this input source or not is controlled by the
|
||||
// fAdopted flag.
|
||||
// -----------------------------------------------------------------------
|
||||
bool fAdopted;
|
||||
XMLSize_t fByteCount;
|
||||
bool fCopyBufToStream;
|
||||
const XMLByte* fSrcBytes;
|
||||
};
|
||||
|
||||
|
||||
inline void MemBufInputSource::setCopyBufToStream(const bool newState)
|
||||
{
|
||||
fCopyBufToStream = newState;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
125
project/jni/xerces/include/xercesc/framework/MemoryManager.hpp
Normal file
125
project/jni/xerces/include/xercesc/framework/MemoryManager.hpp
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: MemoryManager.hpp 673975 2008-07-04 09:23:56Z borisk $
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_MEMORYMANAGER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_MEMORYMANAGER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* Configurable memory manager
|
||||
*
|
||||
* <p>This interface allows outside applications to plug in their own memory
|
||||
* manager to be used by Xerces for memory allocation/deallocation.</p>
|
||||
*/
|
||||
class XMLPARSER_EXPORT MemoryManager
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, only the virtual destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
*/
|
||||
virtual ~MemoryManager()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* This method is called to obtain the memory manager that should be
|
||||
* used to allocate memory used in exceptions. If the same memory
|
||||
* manager can be used, simply return 'this' from this function.
|
||||
* Note, however, that if there is a possibility that an exception
|
||||
* thrown can outlive the memory manager (for example, because the
|
||||
* memory manager object is allocated on the stack or is managed by
|
||||
* a stack-bound object), it is recommended that you return
|
||||
* XMLPlatformUtils::fgMemoryManager.
|
||||
*
|
||||
* @return A pointer to the memory manager
|
||||
*/
|
||||
virtual MemoryManager* getExceptionMemoryManager() = 0;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual memory manager interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The pure virtual methods in this interface. */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method allocates requested memory.
|
||||
*
|
||||
* @param size The requested memory size
|
||||
*
|
||||
* @return A pointer to the allocated memory
|
||||
*/
|
||||
virtual void* allocate(XMLSize_t size) = 0;
|
||||
|
||||
/**
|
||||
* This method deallocates memory
|
||||
*
|
||||
* @param p The pointer to the allocated memory to be deleted
|
||||
*/
|
||||
virtual void deallocate(void* p) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Protected default constructor
|
||||
*/
|
||||
MemoryManager()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
MemoryManager(const MemoryManager&);
|
||||
MemoryManager& operator=(const MemoryManager&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: StdInInputSource.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_STDININPUTSOURCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_STDININPUTSOURCE_HPP
|
||||
|
||||
#include <xercesc/sax/InputSource.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class BinInputStream;
|
||||
|
||||
|
||||
/**
|
||||
* This class is a derivative of the standard InputSource class. It provides
|
||||
* for the parser access to data via the standard input. This input source
|
||||
* is not commonly used, but can be useful when implementing such things
|
||||
* as pipe based tools which exchange XML data.
|
||||
*
|
||||
* As with all InputSource derivatives. The primary objective of an input
|
||||
* source is to create an input stream via which the parser can spool in
|
||||
* data from the referenced source.
|
||||
*/
|
||||
class XMLPARSER_EXPORT StdInInputSource : public InputSource
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Since the standard input is a canned source, the constructor is very
|
||||
* simple. It just uses local platform services to open up the standard
|
||||
* input source as file, a new handleof which it gives to each new stream
|
||||
* it creates.
|
||||
*/
|
||||
StdInInputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~StdInInputSource();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual input source interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
||||
/** @name Virtual methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method will return a binary input stream derivative that will
|
||||
* parse from the standard input of the local host.
|
||||
*
|
||||
* @return A dynamically allocated binary input stream derivative that
|
||||
* can parse from the standardinput.
|
||||
*/
|
||||
BinInputStream* makeStream() const;
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
StdInInputSource(const StdInInputSource&);
|
||||
StdInInputSource& operator=(const StdInInputSource&);
|
||||
|
||||
};
|
||||
|
||||
inline StdInInputSource::StdInInputSource(MemoryManager* const manager) :
|
||||
|
||||
InputSource("stdin", manager)
|
||||
{
|
||||
}
|
||||
|
||||
inline StdInInputSource::~StdInInputSource()
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: StdOutFormatTarget.hpp 553937 2007-07-06 16:02:19Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_STDOUTFORMATTARGET_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_STDOUTFORMATTARGET_HPP
|
||||
|
||||
#include <xercesc/framework/XMLFormatter.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLPARSER_EXPORT StdOutFormatTarget : public XMLFormatTarget {
|
||||
public:
|
||||
|
||||
/** @name constructors and destructor */
|
||||
//@{
|
||||
StdOutFormatTarget() ;
|
||||
~StdOutFormatTarget();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Implementations of the format target interface
|
||||
// -----------------------------------------------------------------------
|
||||
virtual void writeChars(const XMLByte* const toWrite
|
||||
, const XMLSize_t count
|
||||
, XMLFormatter* const formatter);
|
||||
|
||||
virtual void flush();
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented methods.
|
||||
// -----------------------------------------------------------------------
|
||||
StdOutFormatTarget(const StdOutFormatTarget&);
|
||||
StdOutFormatTarget& operator=(const StdOutFormatTarget&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
236
project/jni/xerces/include/xercesc/framework/URLInputSource.hpp
Normal file
236
project/jni/xerces/include/xercesc/framework/URLInputSource.hpp
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: URLInputSource.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_URLINPUTSOURCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_URLINPUTSOURCE_HPP
|
||||
|
||||
#include <xercesc/util/XMLURL.hpp>
|
||||
#include <xercesc/sax/InputSource.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class BinInputStream;
|
||||
|
||||
/**
|
||||
* This class is a derivative of the standard InputSource class. It provides
|
||||
* for the parser access to data which is referenced via a URL, as apposed to
|
||||
* a local file name. The URL can be provided via an XMLURL class, as a fully
|
||||
* qualified system id, or a base system id and a system id which may be
|
||||
* fully qualified or may be relative to the base.
|
||||
*
|
||||
* As with all InputSource derivatives. The primary objective of an input
|
||||
* source is to create an input stream via which the parser can spool in
|
||||
* data from the referenced source.
|
||||
*
|
||||
* Note that the parse system does not necessarily support URL based XML
|
||||
* entities out of the box. Support for socket based access is optional and
|
||||
* controlled by the per-platform support.
|
||||
*/
|
||||
class XMLPARSER_EXPORT URLInputSource : public InputSource
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This constructor accepts an already built URL. It is assumed that
|
||||
* it is correct and it will be used as is. In this case, no public id
|
||||
* accepted, but it can still be set via the parent class' setPublicId()
|
||||
* method.
|
||||
*
|
||||
* @param urlId The URL which holds the system id of the entity
|
||||
* to parse.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
URLInputSource
|
||||
(
|
||||
const XMLURL& urlId
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* This constructor takes a base system id URL and a possibly relative
|
||||
* system id. The relative part is parsed and, if it is indeed relative,
|
||||
* it will be made relative to the passed base id. Otherwise, it will be
|
||||
* taken as is.
|
||||
*
|
||||
* @param baseId The base system id URL which provides the base
|
||||
* for any relative id part.
|
||||
*
|
||||
* @param systemId The possibly relative system id URL. If its relative
|
||||
* its based on baseId, else its taken as is.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
URLInputSource
|
||||
(
|
||||
const XMLCh* const baseId
|
||||
, const XMLCh* const systemId
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* This constructor is identical to the previous one, except that it also
|
||||
* allows you to set a public id if you want to.
|
||||
*
|
||||
* @param baseId The base system id URL which provides the base
|
||||
* for any relative id part.
|
||||
*
|
||||
* @param systemId The possibly relative system id URL. If its relative
|
||||
* its based on baseId, else its taken as is.
|
||||
*
|
||||
* @param publicId The optional public id to set. This is just passed
|
||||
* on to the parent class for storage.
|
||||
*
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
URLInputSource
|
||||
(
|
||||
const XMLCh* const baseId
|
||||
, const XMLCh* const systemId
|
||||
, const XMLCh* const publicId
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* This constructor is identical to the second constructor above, except that
|
||||
* it accepts the relative system id part as a local code page string and
|
||||
* just transcodes it internally, as a convenience.
|
||||
*
|
||||
* @param baseId The base system id URL which provides the base
|
||||
* for any relative id part.
|
||||
*
|
||||
* @param systemId The possibly relative system id URL. If its relative
|
||||
* its based on baseId, else its taken as is.
|
||||
*
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
URLInputSource
|
||||
(
|
||||
const XMLCh* const baseId
|
||||
, const char* const systemId
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* This constructor is identical to the third constructor above, except that
|
||||
* it accepts the relative and public ids as local code page strings and just
|
||||
* transcodes them internally, as a convenience.
|
||||
*
|
||||
* @param baseId The base system id URL which provides the base
|
||||
* for any relative id part.
|
||||
*
|
||||
* @param systemId The possibly relative system id URL. If its relative
|
||||
* its based on baseId, else its taken as is.
|
||||
*
|
||||
* @param publicId The optional public id to set. This is just passed
|
||||
* on to the parent class for storage.
|
||||
* on to the parent class for storage.
|
||||
*
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
URLInputSource
|
||||
(
|
||||
const XMLCh* const baseId
|
||||
, const char* const systemId
|
||||
, const char* const publicId
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~URLInputSource();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual input source interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method will return a binary input stream derivative that will
|
||||
* parse from the source referred to by the URL system id.
|
||||
*/
|
||||
BinInputStream* makeStream() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method will return a const reference to the URL member which
|
||||
* contains the system id in pre-parsed URL form. If you just want the
|
||||
* string format, call getSystemId() on the parent class.
|
||||
*
|
||||
* @return A const reference to a URL object that contains the current
|
||||
* system id set for this input source.
|
||||
*/
|
||||
const XMLURL& urlSrc() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
URLInputSource(const URLInputSource&);
|
||||
URLInputSource& operator=(const URLInputSource&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fURL
|
||||
// This is the URL created from the passed ids.
|
||||
// -----------------------------------------------------------------------
|
||||
XMLURL fURL;
|
||||
};
|
||||
|
||||
|
||||
inline const XMLURL& URLInputSource::urlSrc() const
|
||||
{
|
||||
return fURL;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: ValidationContext.hpp 729944 2008-12-29 17:03:32Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_VALIDATION_CONTEXT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_VALIDATION_CONTEXT_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/RefHashTableOf.hpp>
|
||||
#include <xercesc/util/NameIdPool.hpp>
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLRefInfo;
|
||||
class DTDEntityDecl;
|
||||
class DatatypeValidator;
|
||||
class ElemStack;
|
||||
class NamespaceScope;
|
||||
class XMLScanner;
|
||||
|
||||
class XMLPARSER_EXPORT ValidationContext : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual destructor for derived classes */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* virtual destructor
|
||||
*
|
||||
*/
|
||||
virtual ~ValidationContext(){};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The ValidationContext Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* IDRefList
|
||||
*
|
||||
*/
|
||||
virtual RefHashTableOf<XMLRefInfo>* getIdRefList() const = 0;
|
||||
|
||||
virtual void setIdRefList(RefHashTableOf<XMLRefInfo>* const) = 0;
|
||||
|
||||
virtual void clearIdRefList() = 0;
|
||||
|
||||
virtual void addId(const XMLCh * const ) = 0;
|
||||
|
||||
virtual void addIdRef(const XMLCh * const ) = 0;
|
||||
|
||||
virtual void toCheckIdRefList(bool) = 0;
|
||||
|
||||
/**
|
||||
* EntityDeclPool
|
||||
*
|
||||
*/
|
||||
virtual const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const = 0;
|
||||
|
||||
virtual const NameIdPool<DTDEntityDecl>* setEntityDeclPool(const NameIdPool<DTDEntityDecl>* const) = 0;
|
||||
|
||||
virtual void checkEntity(const XMLCh * const ) const = 0 ;
|
||||
|
||||
/**
|
||||
* Union datatype handling
|
||||
*
|
||||
*/
|
||||
|
||||
virtual DatatypeValidator * getValidatingMemberType() const = 0 ;
|
||||
virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) = 0 ;
|
||||
|
||||
/**
|
||||
* QName datatype handling
|
||||
* Create default implementations for source code compatibility
|
||||
*/
|
||||
virtual bool isPrefixUnknown(XMLCh* /* prefix */) { return true; };
|
||||
virtual void setElemStack(ElemStack* /* elemStack */) {};
|
||||
virtual const XMLCh* getURIForPrefix(XMLCh* /*prefix */) { return 0; };
|
||||
virtual void setScanner(XMLScanner* /* scanner */) { };
|
||||
virtual void setNamespaceScope(NamespaceScope* /* nsStack */) { };
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
/** Hidden Constructors */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
ValidationContext(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager)
|
||||
:fMemoryManager(memMgr)
|
||||
{
|
||||
};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Data members
|
||||
//
|
||||
// fMemoryManager
|
||||
// Pluggable memory manager for dynamic allocation/deallocation.
|
||||
// -----------------------------------------------------------------------
|
||||
MemoryManager* fMemoryManager;
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
/** name Unimplemented copy constructor and operator= */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
ValidationContext(const ValidationContext& );
|
||||
ValidationContext& operator=(const ValidationContext& );
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: Wrapper4DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP
|
||||
|
||||
#include <xercesc/sax/InputSource.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class DOMLSInput;
|
||||
class DOMLSResourceResolver;
|
||||
|
||||
/**
|
||||
* Wrap a DOMLSInput object and make it behave like a SAX InputSource.
|
||||
*/
|
||||
class XMLPARSER_EXPORT Wrapper4DOMLSInput: public InputSource
|
||||
{
|
||||
public:
|
||||
/** @name Constructors and Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Wrap a DOMLSInput and make it behave like a SAX InputSource.
|
||||
* By default, the wrapper will adopt the DOMLSInput that is wrapped.
|
||||
*
|
||||
* @param inputSource The DOMLSInput to be wrapped
|
||||
* @param entityResolver The DOMLSResourceResolver to be used when resolving publicID entries
|
||||
* @param adoptFlag Indicates if the wrapper should adopt the wrapped
|
||||
* DOMLSInput. Default is true.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
Wrapper4DOMLSInput
|
||||
(
|
||||
DOMLSInput* const inputSource
|
||||
, DOMLSResourceResolver* entityResolver = 0
|
||||
, const bool adoptFlag = true
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~Wrapper4DOMLSInput();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual input source interface */
|
||||
//@{
|
||||
/**
|
||||
*
|
||||
* Makes the byte stream for this input source.
|
||||
*
|
||||
* <p>The function will call the makeStream of the wrapped input source.
|
||||
* The returned stream becomes the parser's property.</p>
|
||||
*
|
||||
* @see BinInputStream
|
||||
*/
|
||||
BinInputStream* makeStream() const;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @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 will delegate to the wrapped input source to return
|
||||
* 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
|
||||
*/
|
||||
const XMLCh* getEncoding() const;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the public identifier for this input source. Delegated to the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* @return The public identifier, or null if none was supplied.
|
||||
* @see #setPublicId
|
||||
*/
|
||||
const XMLCh* getPublicId() const;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the system identifier for this input source. Delegated to the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* <p>If the system ID is a URL, it will be fully resolved.</p>
|
||||
*
|
||||
* @return The system identifier.
|
||||
* @see #setSystemId
|
||||
*/
|
||||
const XMLCh* getSystemId() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the flag that indicates if the parser should issue fatal error if
|
||||
* this input source is not found. Delegated to the wrapped input source
|
||||
* object.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
bool getIssueFatalErrorIfNotFound() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @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. This will update the wrapped
|
||||
* input source object.
|
||||
*
|
||||
* <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.
|
||||
*/
|
||||
void setEncoding(const XMLCh* const encodingStr);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Set the public identifier for this input source. This will update the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* <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 Locator#getPublicId
|
||||
* @see SAXParseException#getPublicId
|
||||
* @see #getPublicId
|
||||
*/
|
||||
void setPublicId(const XMLCh* const publicId);
|
||||
|
||||
/**
|
||||
*
|
||||
* Set the system identifier for this input source. This will update the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* <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>
|
||||
*
|
||||
* <p>If the system ID is a URL, it must be fully resolved.</p>
|
||||
*
|
||||
* @param systemId The system identifier as a string.
|
||||
* @see #getSystemId
|
||||
* @see Locator#getSystemId
|
||||
* @see SAXParseException#getSystemId
|
||||
*/
|
||||
void setSystemId(const XMLCh* const systemId);
|
||||
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
* This will update the wrapped input source object.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
void setIssueFatalErrorIfNotFound(const bool flag);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
Wrapper4DOMLSInput(const Wrapper4DOMLSInput&);
|
||||
Wrapper4DOMLSInput& operator=(const Wrapper4DOMLSInput&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
// -----------------------------------------------------------------------
|
||||
bool fAdoptInputSource,
|
||||
fForceXMLChEncoding;
|
||||
DOMLSInput* fInputSource;
|
||||
DOMLSResourceResolver* fEntityResolver;
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: Wrapper4InputSource.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_WRAPPER4INPUTSOURCE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_WRAPPER4INPUTSOURCE_HPP
|
||||
|
||||
#include <xercesc/dom/DOMLSInput.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class InputSource;
|
||||
|
||||
|
||||
/**
|
||||
* Wrap a SAX InputSource object and make it behave like DOMLSInput.
|
||||
*/
|
||||
class XMLPARSER_EXPORT Wrapper4InputSource: public DOMLSInput
|
||||
{
|
||||
public:
|
||||
/** @name Constructors and Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Wrap a SAX InputSource and make it behave like a DOMLSInput.
|
||||
* By default, the wrapper will adopt the SAX InputSource that is wrapped.
|
||||
*
|
||||
* @param inputSource The SAX InputSource to be wrapped
|
||||
* @param adoptFlag Indicates if the wrapper should adopt the wrapped
|
||||
* SAX InputSource. Default is true.
|
||||
* @param manager The MemoryManager to use to allocate objects
|
||||
*/
|
||||
Wrapper4InputSource(InputSource* const inputSource
|
||||
, const bool adoptFlag = true
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
*/
|
||||
virtual ~Wrapper4InputSource();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual input source interface */
|
||||
//@{
|
||||
/**
|
||||
* This wrapper doesn't support string data
|
||||
*
|
||||
*/
|
||||
virtual const XMLCh* getStringData() const;
|
||||
|
||||
/**
|
||||
* Makes the byte stream for this input source.
|
||||
*
|
||||
* <p>The function will call the makeStream of the wrapped input source.
|
||||
* The returned stream becomes the parser's property.</p>
|
||||
*
|
||||
* @see InputSource
|
||||
*/
|
||||
virtual InputSource* getByteStream() const;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
/**
|
||||
* An input source can be set to force the parser to assume a particular
|
||||
* encoding for the data that input source represents, via the setEncoding()
|
||||
* method. This method will delegate to the wrapped input source to return
|
||||
* 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;
|
||||
|
||||
|
||||
/**
|
||||
* Get the public identifier for this input source. Delegated to the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* @return The public identifier, or null if none was supplied.
|
||||
* @see #setPublicId
|
||||
*/
|
||||
const XMLCh* getPublicId() const;
|
||||
|
||||
|
||||
/**
|
||||
* Get the system identifier for this input source. Delegated to the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* <p>If the system ID is a URL, it will be fully resolved.</p>
|
||||
*
|
||||
* @return The system identifier.
|
||||
* @see #setSystemId
|
||||
*/
|
||||
const XMLCh* getSystemId() const;
|
||||
|
||||
/**
|
||||
* 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. Delegated to the wrapped intput source
|
||||
* object.
|
||||
*
|
||||
* @return The base URI.
|
||||
* @see #setBaseURI
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
const XMLCh* getBaseURI() const;
|
||||
|
||||
/**
|
||||
* Get the flag that indicates if the parser should issue fatal error if this input source
|
||||
* is not found. Delegated to the wrapped input source object.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
bool getIssueFatalErrorIfNotFound() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
/**
|
||||
* This wrapper only exposes the given InputSource, no setting allowed
|
||||
*
|
||||
*/
|
||||
virtual void setStringData(const XMLCh* data);
|
||||
|
||||
/**
|
||||
* This wrapper only exposes the given InputSource, no setting allowed
|
||||
*
|
||||
*/
|
||||
virtual void setByteStream(InputSource* stream);
|
||||
|
||||
/**
|
||||
* Set the encoding which will be required for use with the XML text read
|
||||
* via a stream opened by this input source. This will update the wrapped
|
||||
* input source object.
|
||||
*
|
||||
* <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.
|
||||
*/
|
||||
void setEncoding(const XMLCh* const encodingStr);
|
||||
|
||||
|
||||
/**
|
||||
* Set the public identifier for this input source. This will update the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* <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 Locator#getPublicId
|
||||
* @see SAXParseException#getPublicId
|
||||
* @see #getPublicId
|
||||
*/
|
||||
void setPublicId(const XMLCh* const publicId);
|
||||
|
||||
/**
|
||||
* Set the system identifier for this input source. This will update the
|
||||
* wrapped input source object.
|
||||
*
|
||||
* <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>
|
||||
*
|
||||
* <p>If the system ID is a URL, it must be fully resolved.</p>
|
||||
*
|
||||
* @param systemId The system identifier as a string.
|
||||
* @see #getSystemId
|
||||
* @see Locator#getSystemId
|
||||
* @see SAXParseException#getSystemId
|
||||
*/
|
||||
void setSystemId(const XMLCh* const systemId);
|
||||
|
||||
/**
|
||||
* 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. This will update the wrapped input source
|
||||
* object.
|
||||
*
|
||||
* @param baseURI The base URI.
|
||||
* @see #getBaseURI
|
||||
* @since DOM Level 3
|
||||
*/
|
||||
void setBaseURI(const XMLCh* const baseURI);
|
||||
|
||||
/**
|
||||
* 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. This will update the wrapped input source object.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
void setIssueFatalErrorIfNotFound(bool flag);
|
||||
|
||||
/**
|
||||
* Called to indicate that this DOMInputSource is no longer in use
|
||||
* and that the implementation may relinquish any resources associated with it.
|
||||
*
|
||||
* Access to a released object will lead to unexpected result.
|
||||
*/
|
||||
void release();
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
Wrapper4InputSource(const Wrapper4InputSource&);
|
||||
Wrapper4InputSource& operator=(const Wrapper4InputSource&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
// -----------------------------------------------------------------------
|
||||
bool fAdoptInputSource;
|
||||
InputSource* fInputSource;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Wrapper4InputSource: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline const XMLCh* Wrapper4InputSource::getBaseURI() const
|
||||
{
|
||||
return 0; // REVISIT - should we return an empty string?
|
||||
}
|
||||
|
||||
inline const XMLCh* Wrapper4InputSource::getStringData() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Wrapper4InputSource: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void Wrapper4InputSource::setBaseURI(const XMLCh* const)
|
||||
{
|
||||
}
|
||||
|
||||
inline void Wrapper4InputSource::setStringData(const XMLCh*)
|
||||
{
|
||||
}
|
||||
|
||||
inline void Wrapper4InputSource::setByteStream(InputSource*)
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
539
project/jni/xerces/include/xercesc/framework/XMLAttDef.hpp
Normal file
539
project/jni/xerces/include/xercesc/framework/XMLAttDef.hpp
Normal file
@@ -0,0 +1,539 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLAttDef.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLATTDEF_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLATTDEF_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLAttr;
|
||||
|
||||
/** Represents the core information of an attribute definition
|
||||
*
|
||||
* This class defines the basic characteristics of an attribute, no matter
|
||||
* what type of validator is used. If a particular schema associates more
|
||||
* information with an attribute it will create a derivative of this class.
|
||||
* So this class provides an abstract way to get basic information on
|
||||
* attributes from any type of validator.
|
||||
*
|
||||
* This class supports keyed collection semantics on the fully qualified
|
||||
* attribute name, by providing a getKey() method to extract the key string.
|
||||
* getKey(), in this case, just calls the virtual method getFullName() to
|
||||
* get the fully qualified name, as defined by the derived class.
|
||||
*
|
||||
* Note that the 'value' of an attribute type definition is the default or
|
||||
* of fixed value given to it in its definition. If the attribute is of the
|
||||
* enumerated or notation type, it will have an 'enumeration value' as well
|
||||
* which is a space separated list of its possible vlaues.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLAttDef : public XSerializable, public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Class specific types
|
||||
//
|
||||
// AttTypes
|
||||
// The list of possible types that an attribute can have, according
|
||||
// to the XML 1.0 spec and schema.
|
||||
//
|
||||
// DefAttTypes
|
||||
// The modifiers that an attribute decl can have, which indicates
|
||||
// whether instances of that attributes are required, implied, etc..
|
||||
//
|
||||
// CreateReasons
|
||||
// This type is used to store how an attribute declaration got into
|
||||
// the elementdecl's attribute pool.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
enum AttTypes
|
||||
{
|
||||
CData = 0
|
||||
, ID = 1
|
||||
, IDRef = 2
|
||||
, IDRefs = 3
|
||||
, Entity = 4
|
||||
, Entities = 5
|
||||
, NmToken = 6
|
||||
, NmTokens = 7
|
||||
, Notation = 8
|
||||
, Enumeration = 9
|
||||
, Simple = 10
|
||||
, Any_Any = 11
|
||||
, Any_Other = 12
|
||||
, Any_List = 13
|
||||
|
||||
, AttTypes_Count
|
||||
, AttTypes_Min = 0
|
||||
, AttTypes_Max = 13
|
||||
, AttTypes_Unknown = -1
|
||||
};
|
||||
|
||||
enum DefAttTypes
|
||||
{
|
||||
Default = 0
|
||||
, Fixed = 1
|
||||
, Required = 2
|
||||
, Required_And_Fixed = 3
|
||||
, Implied = 4
|
||||
, ProcessContents_Skip = 5
|
||||
, ProcessContents_Lax = 6
|
||||
, ProcessContents_Strict = 7
|
||||
, Prohibited = 8
|
||||
|
||||
, DefAttTypes_Count
|
||||
, DefAttTypes_Min = 0
|
||||
, DefAttTypes_Max = 8
|
||||
, DefAttTypes_Unknown = -1
|
||||
};
|
||||
|
||||
enum CreateReasons
|
||||
{
|
||||
NoReason
|
||||
, JustFaultIn
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Public static data members
|
||||
// -----------------------------------------------------------------------
|
||||
static const unsigned int fgInvalidAttrId;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Public, static methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Public, static methods */
|
||||
//@{
|
||||
|
||||
/** Get a string representation of the passed attribute type enum
|
||||
*
|
||||
* This method allows you to get a textual representation of an attribute
|
||||
* type, mostly for debug or display.
|
||||
*
|
||||
* @param attrType The attribute type value to get the string for.
|
||||
* @param manager The MemoryManager to use to allocate objects
|
||||
* @return A const pointer to the static string that holds the text
|
||||
* description of the passed type.
|
||||
*/
|
||||
static const XMLCh* getAttTypeString(const AttTypes attrType
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/** Get a string representation of the passed def attribute type enum
|
||||
*
|
||||
* This method allows you to get a textual representation of an default
|
||||
* attributetype, mostly for debug or display.
|
||||
*
|
||||
* @param attrType The default attribute type value to get the string for.
|
||||
* @param manager The MemoryManager to use to allocate objects
|
||||
* @return A const pointer to the static string that holds the text
|
||||
* description of the passed default type.
|
||||
*/
|
||||
static const XMLCh* getDefAttTypeString(const DefAttTypes attrType
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~XMLAttDef();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual attribute def interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual interface */
|
||||
//@{
|
||||
|
||||
/** Get the full name of this attribute type
|
||||
*
|
||||
* The derived class should return a const pointer to the full name of
|
||||
* this attribute. This will vary depending on the type of validator in
|
||||
* use.
|
||||
*
|
||||
* @return A const pointer to the full name of this attribute type.
|
||||
*/
|
||||
virtual const XMLCh* getFullName() const = 0;
|
||||
|
||||
/**
|
||||
* The derived class should implement any cleaning up required between
|
||||
* each use of an instance of this class for validation
|
||||
*/
|
||||
virtual void reset() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
|
||||
/** Get the default type of this attribute type
|
||||
*
|
||||
* This method returns the 'default type' of the attribute. Default
|
||||
* type in this case refers to the XML concept of a default type for
|
||||
* an attribute, i.e. \#FIXED, \#IMPLIED, etc...
|
||||
*
|
||||
* @return The default type enum for this attribute type.
|
||||
*/
|
||||
DefAttTypes getDefaultType() const;
|
||||
|
||||
/** Get the enumeration value (if any) of this attribute type
|
||||
*
|
||||
* If the attribute is of an enumeration or notation type, then this
|
||||
* method will return a const reference to a string that contains the
|
||||
* space separated values that can the attribute can have.
|
||||
*
|
||||
* @return A const pointer to a string that contains the space separated
|
||||
* legal values for this attribute.
|
||||
*/
|
||||
const XMLCh* getEnumeration() const;
|
||||
|
||||
/** Get the pool id of this attribute type
|
||||
*
|
||||
* This method will return the id of this attribute in the validator's
|
||||
* attribute pool. It was set by the validator when this attribute was
|
||||
* created.
|
||||
*
|
||||
* @return The pool id of this attribute type.
|
||||
*/
|
||||
XMLSize_t getId() const;
|
||||
|
||||
/** Get the type of this attribute
|
||||
*
|
||||
* Gets the type of this attribute. This type is represented by an enum
|
||||
* that converts the types of attributes allowed by XML, e.g. CDATA, NMTOKEN,
|
||||
* NOTATION, etc...
|
||||
*
|
||||
* @return The attribute type enumeration value for this type of
|
||||
* attribute.
|
||||
*/
|
||||
AttTypes getType() const;
|
||||
|
||||
/** Get the default/fixed value of this attribute (if any.)
|
||||
*
|
||||
* If the attribute defined a default/fixed value, then it is stored
|
||||
* and this method will retrieve it. If it has non, then a null pointer
|
||||
* is returned.
|
||||
*
|
||||
* @return A const pointer to the default/fixed value for this attribute
|
||||
* type.
|
||||
*/
|
||||
const XMLCh* getValue() const;
|
||||
|
||||
/** Get the create reason for this attribute
|
||||
*
|
||||
* This method returns an enumeration which indicates why this attribute
|
||||
* declaration exists.
|
||||
*
|
||||
* @return An enumerated value that indicates the reason why this attribute
|
||||
* was added to the attribute table.
|
||||
*/
|
||||
CreateReasons getCreateReason() const;
|
||||
|
||||
/** Indicate whether this attribute has been declared externally
|
||||
*
|
||||
* This method returns a boolean that indicates whether this attribute
|
||||
* has been declared externally.
|
||||
*
|
||||
* @return true if this attribute has been declared externally, else false.
|
||||
*/
|
||||
bool isExternal() const;
|
||||
|
||||
/** Get the plugged-in memory manager
|
||||
*
|
||||
* This method returns the plugged-in memory manager user for dynamic
|
||||
* memory allocation/deallocation.
|
||||
*
|
||||
* @return the plugged-in memory manager
|
||||
*/
|
||||
MemoryManager* getMemoryManager() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
|
||||
/** Set the default attribute type
|
||||
*
|
||||
* This method sets the default attribute type for this attribute.
|
||||
* This setting controls whether the attribute is required, fixed,
|
||||
* implied, etc...
|
||||
*
|
||||
* @param newValue The new default attribute to set
|
||||
*/
|
||||
void setDefaultType(const XMLAttDef::DefAttTypes newValue);
|
||||
|
||||
/** Set the pool id for this attribute type.
|
||||
*
|
||||
* This method sets the pool id of this attribute type. This is usually
|
||||
* called by the validator that creates the actual instance (which is of
|
||||
* a derived type known only by the validator.)
|
||||
*
|
||||
* @param newId The new pool id to set.
|
||||
*/
|
||||
void setId(const XMLSize_t newId);
|
||||
|
||||
/** Set the type of this attribute type.
|
||||
*
|
||||
* This method will set the type of the attribute. The type of an attribute
|
||||
* controls how it is normalized and what kinds of characters it can hold.
|
||||
*
|
||||
* @param newValue The new attribute type to set
|
||||
*/
|
||||
void setType(const XMLAttDef::AttTypes newValue);
|
||||
|
||||
/** Set the default/fixed value of this attribute type.
|
||||
*
|
||||
* This method set the fixed/default value for the attribute. This value
|
||||
* will be used when instances of this attribute type are faulted in. It
|
||||
* <b>must</b> be a valid value for the type set by setType(). If the
|
||||
* type is enumeration or notation, this must be one of the valid values
|
||||
* set in the setEnumeration() call.
|
||||
*
|
||||
* @param newValue The new fixed/default value to set.
|
||||
*/
|
||||
void setValue(const XMLCh* const newValue);
|
||||
|
||||
/** Set the enumerated value of this attribute type.
|
||||
*
|
||||
* This method sets the enumerated/notation value list for this attribute
|
||||
* type. It is a space separated set of possible values. These values must
|
||||
* meet the constrains of the XML spec for such values of this type of
|
||||
* attribute. This should only be set if the setType() method is used to
|
||||
* set the type to the enumeration or notation types.
|
||||
*
|
||||
* @param newValue The new enumerated/notation value list to set.
|
||||
*/
|
||||
void setEnumeration(const XMLCh* const newValue);
|
||||
|
||||
/** Update the create reason for this attribute type.
|
||||
*
|
||||
* This method will update the 'create reason' field for this attribute
|
||||
* decl object.
|
||||
*
|
||||
* @param newReason The new create reason.
|
||||
*/
|
||||
void setCreateReason(const CreateReasons newReason);
|
||||
|
||||
/**
|
||||
* Set the attribute decl to indicate external declaration
|
||||
*
|
||||
* @param aValue The new value to indicate external declaration.
|
||||
*/
|
||||
void setExternalAttDeclaration(const bool aValue);
|
||||
|
||||
//@}
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLAttDef)
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
XMLAttDef
|
||||
(
|
||||
const AttTypes type = CData
|
||||
, const DefAttTypes defType= Implied
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
XMLAttDef
|
||||
(
|
||||
const XMLCh* const attValue
|
||||
, const AttTypes type
|
||||
, const DefAttTypes defType
|
||||
, const XMLCh* const enumValues = 0
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLAttDef(const XMLAttDef&);
|
||||
XMLAttDef& operator=(const XMLAttDef&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
void cleanUp();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fDefaultType
|
||||
// Indicates what, if any, default stuff this attribute has.
|
||||
//
|
||||
// fEnumeration
|
||||
// If its an enumeration, this is the list of values as space
|
||||
// separated values.
|
||||
//
|
||||
// fId
|
||||
// This is the unique id of this attribute, given to it when its put
|
||||
// into the validator's attribute decl pool. It defaults to the
|
||||
// special value XMLAttrDef::fgInvalidAttrId.
|
||||
//
|
||||
// fType
|
||||
// The type of attribute, which is one of the AttTypes values.
|
||||
//
|
||||
// fValue
|
||||
// This is the value of the attribute, which is the default value
|
||||
// given in the attribute declaration.
|
||||
//
|
||||
// fCreateReason
|
||||
// This flag tells us how this attribute got created. Sometimes even
|
||||
// the attribute was not declared for the element, we want to fault
|
||||
// fault it into the pool to avoid lots of redundant errors.
|
||||
//
|
||||
// fExternalAttribute
|
||||
// This flag indicates whether or not the attribute was declared externally.
|
||||
// -----------------------------------------------------------------------
|
||||
DefAttTypes fDefaultType;
|
||||
AttTypes fType;
|
||||
CreateReasons fCreateReason;
|
||||
bool fExternalAttribute;
|
||||
XMLSize_t fId;
|
||||
XMLCh* fValue;
|
||||
XMLCh* fEnumeration;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
|
||||
{
|
||||
return fDefaultType;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLAttDef::getEnumeration() const
|
||||
{
|
||||
return fEnumeration;
|
||||
}
|
||||
|
||||
inline XMLSize_t XMLAttDef::getId() const
|
||||
{
|
||||
return fId;
|
||||
}
|
||||
|
||||
inline XMLAttDef::AttTypes XMLAttDef::getType() const
|
||||
{
|
||||
return fType;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLAttDef::getValue() const
|
||||
{
|
||||
return fValue;
|
||||
}
|
||||
|
||||
inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
|
||||
{
|
||||
return fCreateReason;
|
||||
}
|
||||
|
||||
inline bool XMLAttDef::isExternal() const
|
||||
{
|
||||
return fExternalAttribute;
|
||||
}
|
||||
|
||||
inline MemoryManager* XMLAttDef::getMemoryManager() const
|
||||
{
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttDef: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
|
||||
{
|
||||
fDefaultType = newValue;
|
||||
}
|
||||
|
||||
inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
|
||||
{
|
||||
if (fEnumeration)
|
||||
fMemoryManager->deallocate(fEnumeration);
|
||||
|
||||
fEnumeration = XMLString::replicate(newValue, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLAttDef::setId(const XMLSize_t newId)
|
||||
{
|
||||
fId = newId;
|
||||
}
|
||||
|
||||
inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
|
||||
{
|
||||
fType = newValue;
|
||||
}
|
||||
|
||||
inline void XMLAttDef::setValue(const XMLCh* const newValue)
|
||||
{
|
||||
if (fValue)
|
||||
fMemoryManager->deallocate(fValue);
|
||||
|
||||
fValue = XMLString::replicate(newValue, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void
|
||||
XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
|
||||
{
|
||||
fCreateReason = newReason;
|
||||
}
|
||||
|
||||
inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
|
||||
{
|
||||
fExternalAttribute = aValue;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
171
project/jni/xerces/include/xercesc/framework/XMLAttDefList.hpp
Normal file
171
project/jni/xerces/include/xercesc/framework/XMLAttDefList.hpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLAttDefList.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLATTDEFLIST_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLATTDEFLIST_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLAttDef;
|
||||
|
||||
/**
|
||||
* This class defines an abstract interface that all validators must support.
|
||||
* When the scanner scans the attributes in a start tag, it must have a list
|
||||
* of the defined attributes for that element. This is used to fault in
|
||||
* defaulted and fixed attributes, to know which ones are required, and to
|
||||
* know the their types in order to do the correct normalization.
|
||||
*
|
||||
* Since each validator will have its own derivatives of XMLAttDef and will
|
||||
* have its own specialized storage mechanisms for elements and the att
|
||||
* defs that they own, there must be an abstracted way for the scanner to
|
||||
* deal with this list.
|
||||
*
|
||||
* It does not derive from the generic Enumerator template class, because
|
||||
* there are portability issues with deriving from a template class in a
|
||||
* DLL. It does though provide a similar enumerator interface.
|
||||
*/
|
||||
|
||||
class XMLPARSER_EXPORT XMLAttDefList : public XSerializable, public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~XMLAttDefList();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
virtual bool isEmpty() const = 0;
|
||||
virtual XMLAttDef* findAttDef
|
||||
(
|
||||
const unsigned int uriID
|
||||
, const XMLCh* const attName
|
||||
) = 0;
|
||||
virtual const XMLAttDef* findAttDef
|
||||
(
|
||||
const unsigned int uriID
|
||||
, const XMLCh* const attName
|
||||
) const = 0;
|
||||
virtual XMLAttDef* findAttDef
|
||||
(
|
||||
const XMLCh* const attURI
|
||||
, const XMLCh* const attName
|
||||
) = 0;
|
||||
virtual const XMLAttDef* findAttDef
|
||||
(
|
||||
const XMLCh* const attURI
|
||||
, const XMLCh* const attName
|
||||
) const = 0;
|
||||
|
||||
/**
|
||||
* return total number of attributes in this list
|
||||
*/
|
||||
virtual XMLSize_t getAttDefCount() const = 0;
|
||||
|
||||
/**
|
||||
* return attribute at the index-th position in the list.
|
||||
*/
|
||||
virtual XMLAttDef &getAttDef(XMLSize_t index) = 0;
|
||||
|
||||
/**
|
||||
* return attribute at the index-th position in the list.
|
||||
*/
|
||||
virtual const XMLAttDef &getAttDef(XMLSize_t index) const = 0;
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLAttDefList)
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
|
||||
/** Get the memory manager
|
||||
*
|
||||
* This method returns the configurable memory manager used by the
|
||||
* element declaration for dynamic allocation/deallocation.
|
||||
*
|
||||
* @return the memory manager
|
||||
*/
|
||||
MemoryManager* getMemoryManager() const;
|
||||
|
||||
//@}
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
private:
|
||||
// unimplemented
|
||||
XMLAttDefList(const XMLAttDefList&);
|
||||
XMLAttDefList& operator=(const XMLAttDefList&);
|
||||
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttDefList: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
inline MemoryManager* XMLAttDefList::getMemoryManager() const
|
||||
{
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttDefList: Constructors and Destructor
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLAttDefList::~XMLAttDefList()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttDefList: Protected Constructor
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLAttDefList::XMLAttDefList(MemoryManager* const manager):
|
||||
fMemoryManager(manager)
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
501
project/jni/xerces/include/xercesc/framework/XMLAttr.hpp
Normal file
501
project/jni/xerces/include/xercesc/framework/XMLAttr.hpp
Normal file
@@ -0,0 +1,501 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLAttr.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLATTR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLATTR_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/QName.hpp>
|
||||
#include <xercesc/framework/XMLAttDef.hpp>
|
||||
#include <xercesc/validators/datatype/DatatypeValidator.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class defines the information about an attribute that will come out
|
||||
* of the scanner during parsing. This information does not depend upon the
|
||||
* type of validator because it is not tied to any scheme/DTD type info. Its
|
||||
* just the raw XML 1.0 information that will be reported about an attribute
|
||||
* in the startElement() callback method of the XMLDocumentHandler class.
|
||||
* Hence it is not intended to be extended or derived from. Its designed to
|
||||
* be used as is.
|
||||
*
|
||||
* The 'specified' field of this class indicates whether the attribute was
|
||||
* actually present or whether it was faulted in because it had a fixed or
|
||||
* default value.
|
||||
*
|
||||
* The code receiving this information can ask its validator for more info
|
||||
* about the attribute, i.e. get its declaration from the DTD/Schema info.
|
||||
*
|
||||
* Because of the heavy use (and reuse) of instances of this class, and the
|
||||
* number of string members it has, this class takes pains to not reallocate
|
||||
* string members unless it has to. It keeps up with how long each buffer
|
||||
* is and only reallocates if the new value won't fit.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLAttr : public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor just setsup an empty attribute to be filled
|
||||
* in the later. Though the initial state is a reasonable one, it is
|
||||
* not documented because it should not be depended on.
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XMLAttr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/**
|
||||
* This is the primary constructor which takes all of the information
|
||||
* required to construct a complete attribute object.
|
||||
*
|
||||
* @param uriId The id into the validator's URI pool of the URI
|
||||
* that the prefix mapped to. Only used if namespaces
|
||||
* are enabled/supported.
|
||||
*
|
||||
* @param attrName The base name of the attribute, i.e. the part
|
||||
* after any prefix.
|
||||
*
|
||||
* @param attrPrefix The prefix, if any, of this attribute's name. If
|
||||
* this is empty, then uriID is meaningless as well.
|
||||
*
|
||||
* @param attrValue The value string of the attribute, which should
|
||||
* be fully normalized by XML rules!
|
||||
*
|
||||
* @param type The type of the attribute. This will indicate
|
||||
* the type of normalization done and constrains
|
||||
* the value content. Make sure that the value
|
||||
* set meets the constraints!
|
||||
*
|
||||
* @param specified Indicates whether the attribute was explicitly
|
||||
* specified or not. If not, then it was faulted
|
||||
* in from a FIXED or DEFAULT value.
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
* @param datatypeValidator type used to validate the attribute,
|
||||
* if it was validated by an XML Schema
|
||||
* @param isSchema true if and only if this attribute was validated
|
||||
* by an XML Schema
|
||||
*/
|
||||
XMLAttr
|
||||
(
|
||||
const unsigned int uriId
|
||||
, const XMLCh* const attrName
|
||||
, const XMLCh* const attrPrefix
|
||||
, const XMLCh* const attrValue
|
||||
, const XMLAttDef::AttTypes type = XMLAttDef::CData
|
||||
, const bool specified = true
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
, DatatypeValidator * datatypeValidator = 0
|
||||
, const bool isSchema = false
|
||||
);
|
||||
|
||||
/**
|
||||
* This is the primary constructor which takes all of the information
|
||||
* required to construct a complete attribute object.
|
||||
*
|
||||
* @param uriId The id into the validator's URI pool of the URI
|
||||
* that the prefix mapped to. Only used if namespaces
|
||||
* are enabled/supported.
|
||||
*
|
||||
* @param rawName The raw name of the attribute.
|
||||
*
|
||||
* @param attrValue The value string of the attribute, which should
|
||||
* be fully normalized by XML rules!
|
||||
*
|
||||
* @param type The type of the attribute. This will indicate
|
||||
* the type of normalization done and constrains
|
||||
* the value content. Make sure that the value
|
||||
* set meets the constraints!
|
||||
*
|
||||
* @param specified Indicates whether the attribute was explicitly
|
||||
* specified or not. If not, then it was faulted
|
||||
* in from a FIXED or DEFAULT value.
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
* @param datatypeValidator type used to validate the attribute,
|
||||
* if it was validated by an XML Schema
|
||||
* @param isSchema true if and only if this attribute was validated
|
||||
* by an XML Schema
|
||||
*/
|
||||
XMLAttr
|
||||
(
|
||||
const unsigned int uriId
|
||||
, const XMLCh* const rawName
|
||||
, const XMLCh* const attrValue
|
||||
, const XMLAttDef::AttTypes type = XMLAttDef::CData
|
||||
, const bool specified = true
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
, DatatypeValidator * datatypeValidator = 0
|
||||
, const bool isSchema = false
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XMLAttr();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method returns the attribute name in a QName format.
|
||||
*/
|
||||
QName* getAttName() const;
|
||||
|
||||
/**
|
||||
* This method gets a const pointer to the name of the attribute. The
|
||||
* form of this name is defined by the validator in use.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* This method will get a const pointer to the prefix string of this
|
||||
* attribute. Since prefixes are optional, it may be zero.
|
||||
*/
|
||||
const XMLCh* getPrefix() const;
|
||||
|
||||
/**
|
||||
* This method will get the QName of this attribute, which will be the
|
||||
* prefix if any, then a colon, then the base name. If there was no
|
||||
* prefix, its the same as the getName() method.
|
||||
*/
|
||||
const XMLCh* getQName() const;
|
||||
|
||||
/**
|
||||
* This method will get the specified flag, which indicates whether
|
||||
* the attribute was explicitly specified or just faulted in.
|
||||
*/
|
||||
bool getSpecified() const;
|
||||
|
||||
/**
|
||||
* This method will get the type of the attribute. The available types
|
||||
* are defined by the XML specification.
|
||||
*/
|
||||
XMLAttDef::AttTypes getType() const;
|
||||
|
||||
/**
|
||||
* This method will get the value of the attribute. The value can be
|
||||
* be an empty string, but never null if the object is correctly
|
||||
* set up.
|
||||
*/
|
||||
const XMLCh* getValue() const;
|
||||
|
||||
/**
|
||||
* This method will get the id of the URI that this attribute's prefix
|
||||
* mapped to. If namespaces are not on, then its value is meaningless.
|
||||
*/
|
||||
unsigned int getURIId() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method is called to set up a default constructed object after
|
||||
* the fact, or to reuse a previously used object.
|
||||
*
|
||||
* @param uriId The id into the validator's URI pool of the URI
|
||||
* that the prefix mapped to. Only used if namespaces
|
||||
* are enabled/supported.
|
||||
*
|
||||
* @param attrName The base name of the attribute, i.e. the part
|
||||
* after any prefix.
|
||||
*
|
||||
* @param attrPrefix The prefix, if any, of this attribute's name. If
|
||||
* this is empty, then uriID is meaningless as well.
|
||||
*
|
||||
* @param attrValue The value string of the attribute, which should
|
||||
* be fully normalized by XML rules according to the
|
||||
* attribute type.
|
||||
*
|
||||
* @param type The type of the attribute. This will indicate
|
||||
* the type of normalization done and constrains
|
||||
* the value content. Make sure that the value
|
||||
* set meets the constraints!
|
||||
* @param datatypeValidator type used to validate the attribute,
|
||||
* if it was validated by an XML Schema
|
||||
* @param isSchema true if and only if this attribute was validated
|
||||
* by an XML Schema
|
||||
*
|
||||
*/
|
||||
void set
|
||||
(
|
||||
const unsigned int uriId
|
||||
, const XMLCh* const attrName
|
||||
, const XMLCh* const attrPrefix
|
||||
, const XMLCh* const attrValue
|
||||
, const XMLAttDef::AttTypes type = XMLAttDef::CData
|
||||
, DatatypeValidator * datatypeValidator = 0
|
||||
, const bool isSchema = false
|
||||
);
|
||||
|
||||
/**
|
||||
* This method is called to set up a default constructed object after
|
||||
* the fact, or to reuse a previously used object.
|
||||
*
|
||||
* @param uriId The id into the validator's URI pool of the URI
|
||||
* that the prefix mapped to. Only used if namespaces
|
||||
* are enabled/supported.
|
||||
*
|
||||
* @param attrRawName The raw name of the attribute.
|
||||
*
|
||||
* @param attrValue The value string of the attribute, which should
|
||||
* be fully normalized by XML rules according to the
|
||||
* attribute type.
|
||||
*
|
||||
* @param type The type of the attribute. This will indicate
|
||||
* the type of normalization done and constrains
|
||||
* the value content. Make sure that the value
|
||||
* set meets the constraints!
|
||||
* @param datatypeValidator type used to validate the attribute,
|
||||
* if it was validated by an XML Schema
|
||||
* @param isSchema true if and only if this attribute was validated
|
||||
* by an XML Schema
|
||||
*/
|
||||
void set
|
||||
(
|
||||
const unsigned int uriId
|
||||
, const XMLCh* const attrRawName
|
||||
, const XMLCh* const attrValue
|
||||
, const XMLAttDef::AttTypes type = XMLAttDef::CData
|
||||
, DatatypeValidator * datatypeValidator = 0
|
||||
, const bool isSchema = false
|
||||
);
|
||||
|
||||
/**
|
||||
* This method will update just the name related fields of the
|
||||
* attribute object. The other fields are left as is.
|
||||
*
|
||||
* @param uriId The id into the validator's URI pool of the URI
|
||||
* that the prefix mapped to. Only used if namespaces
|
||||
* are enabled/supported.
|
||||
*
|
||||
* @param attrName The base name of the attribute, i.e. the part
|
||||
* after any prefix.
|
||||
*
|
||||
* @param attrPrefix The prefix, if any, of this attribute's name. If
|
||||
* this is empty, then uriID is meaningless as well.
|
||||
*/
|
||||
void setName
|
||||
(
|
||||
const unsigned int uriId
|
||||
, const XMLCh* const attrName
|
||||
, const XMLCh* const attrPrefix
|
||||
);
|
||||
|
||||
/**
|
||||
* This method will update the specified state of the object.
|
||||
*
|
||||
* @param newValue Indicates whether the attribute was explicitly
|
||||
* specified or not. If not, then it was faulted
|
||||
* in from a FIXED or DEFAULT value.
|
||||
*/
|
||||
void setSpecified(const bool newValue);
|
||||
|
||||
/**
|
||||
* This method will update the attribute type of the object.
|
||||
*
|
||||
* @param newType The type of the attribute. This will indicate
|
||||
* the type of normalization done and constrains
|
||||
* the value content. Make sure that the value
|
||||
* set meets the constraints!
|
||||
*/
|
||||
void setType(const XMLAttDef::AttTypes newType);
|
||||
|
||||
/**
|
||||
* This method will update the value field of the attribute.
|
||||
*
|
||||
* @param newValue The value string of the attribute, which should
|
||||
* be fully normalized by XML rules according to the
|
||||
* attribute type.
|
||||
*/
|
||||
void setValue(const XMLCh* const newValue);
|
||||
|
||||
/**
|
||||
* This method will set the URI id field of this attribute. This is
|
||||
* generally only ever called internally by the parser itself during
|
||||
* the parsing process.
|
||||
*
|
||||
* @param uriId The uriId of the attribute.
|
||||
*/
|
||||
void setURIId(const unsigned int uriId);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLAttr(const XMLAttr&);
|
||||
XMLAttr& operator=(const XMLAttr&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private, helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
void cleanUp();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private instance variables
|
||||
//
|
||||
// fAttName
|
||||
// The Attribute Name;
|
||||
//
|
||||
// fSpecified
|
||||
// True if this attribute appeared in the element; else, false if
|
||||
// it was defaulted from an AttDef.
|
||||
//
|
||||
// fType
|
||||
// The attribute type enum value for this attribute. Indicates what
|
||||
// type of attribute it was.
|
||||
//
|
||||
// fValue
|
||||
// fValueBufSz
|
||||
// The attribute value that was given in the attribute instance, and
|
||||
// its current buffer size (minus one, where the null is.)
|
||||
//
|
||||
// fMemoryManager
|
||||
// The memory manager used for dynamic memory allocation/deallocation
|
||||
// -----------------------------------------------------------------------
|
||||
bool fSpecified;
|
||||
XMLAttDef::AttTypes fType;
|
||||
XMLSize_t fValueBufSz;
|
||||
XMLCh* fValue;
|
||||
QName* fAttName;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttr: Constructors and Destructor
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLAttr::~XMLAttr()
|
||||
{
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttr: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline QName* XMLAttr::getAttName() const
|
||||
{
|
||||
return fAttName;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLAttr::getName() const
|
||||
{
|
||||
return fAttName->getLocalPart();
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLAttr::getPrefix() const
|
||||
{
|
||||
return fAttName->getPrefix();
|
||||
}
|
||||
|
||||
inline bool XMLAttr::getSpecified() const
|
||||
{
|
||||
return fSpecified;
|
||||
}
|
||||
|
||||
inline XMLAttDef::AttTypes XMLAttr::getType() const
|
||||
{
|
||||
return fType;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLAttr::getValue() const
|
||||
{
|
||||
return fValue;
|
||||
}
|
||||
|
||||
inline unsigned int XMLAttr::getURIId() const
|
||||
{
|
||||
return fAttName->getURI();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLAttr: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void XMLAttr::set(const unsigned int uriId
|
||||
, const XMLCh* const attrName
|
||||
, const XMLCh* const attrPrefix
|
||||
, const XMLCh* const attrValue
|
||||
, const XMLAttDef::AttTypes type
|
||||
, DatatypeValidator * /*datatypeValidator */
|
||||
, const bool /*isSchema*/ )
|
||||
{
|
||||
// Set the name info and the value via their respective calls
|
||||
fAttName->setName(attrPrefix, attrName, uriId);
|
||||
setValue(attrValue);
|
||||
|
||||
// And store the type
|
||||
fType = type;
|
||||
}
|
||||
|
||||
inline void XMLAttr::set(const unsigned int uriId
|
||||
, const XMLCh* const attrRawName
|
||||
, const XMLCh* const attrValue
|
||||
, const XMLAttDef::AttTypes type
|
||||
, DatatypeValidator * /*datatypeValidator */
|
||||
, const bool /*isSchema*/ )
|
||||
{
|
||||
// Set the name info and the value via their respective calls
|
||||
fAttName->setName(attrRawName, uriId);
|
||||
setValue(attrValue);
|
||||
|
||||
// And store the type
|
||||
fType = type;
|
||||
}
|
||||
|
||||
inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue)
|
||||
{
|
||||
fType = newValue;
|
||||
}
|
||||
|
||||
inline void XMLAttr::setSpecified(const bool newValue)
|
||||
{
|
||||
fSpecified = newValue;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
281
project/jni/xerces/include/xercesc/framework/XMLBuffer.hpp
Normal file
281
project/jni/xerces/include/xercesc/framework/XMLBuffer.hpp
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLBuffer.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLBUFFER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLBUFFER_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/framework/MemoryManager.hpp>
|
||||
#include <string.h>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLBufferFullHandler;
|
||||
|
||||
/**
|
||||
* XMLBuffer is a lightweight, expandable Unicode text buffer. Since XML is
|
||||
* inherently theoretically unbounded in terms of the sizes of things, we
|
||||
* very often need to have expandable buffers. The primary concern here is
|
||||
* that appends of characters and other buffers or strings be very fast, so
|
||||
* it always maintains the current buffer size.
|
||||
*
|
||||
* The buffer is not null terminated until some asks to see the raw buffer
|
||||
* contents. This also avoids overhead during append operations.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLBuffer : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
XMLBuffer(const XMLSize_t capacity = 1023
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
|
||||
|
||||
fIndex(0)
|
||||
, fCapacity(capacity)
|
||||
, fFullSize(0)
|
||||
, fUsed(false)
|
||||
, fMemoryManager(manager)
|
||||
, fFullHandler(0)
|
||||
, fBuffer(0)
|
||||
{
|
||||
// Buffer is one larger than capacity, to allow for zero term
|
||||
fBuffer = (XMLCh*) manager->allocate((capacity+1) * sizeof(XMLCh)); //new XMLCh[fCapacity+1];
|
||||
|
||||
// Keep it null terminated
|
||||
fBuffer[0] = XMLCh(0);
|
||||
}
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XMLBuffer()
|
||||
{
|
||||
fMemoryManager->deallocate(fBuffer); //delete [] fBuffer;
|
||||
}
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Buffer Full Handler Management
|
||||
// -----------------------------------------------------------------------
|
||||
void setFullHandler(XMLBufferFullHandler* handler, const XMLSize_t fullSize)
|
||||
{
|
||||
if (handler && fullSize) {
|
||||
fFullHandler = handler;
|
||||
fFullSize = fullSize;
|
||||
|
||||
// Need to consider the case that the fullsize is less than the current capacity.
|
||||
// For example, say fullSize = 100 and fCapacity is 1023 (the default).
|
||||
// If the fIndex is less than the fullSize, then no problem. We can just carry
|
||||
// on by resetting fCapacity to fullsize and proceed business as usual.
|
||||
// If the fIndex is already bigger than the fullSize then we call ensureCapacity
|
||||
// to see if it can handle emptying the current buffer (it will throw an
|
||||
// exception if it can't).
|
||||
if (fullSize < fCapacity) {
|
||||
fCapacity = fullSize;
|
||||
if (fIndex >= fullSize) {
|
||||
ensureCapacity(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// reset fFullHandler to zero because setFullHandler had bad input
|
||||
fFullHandler = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Buffer Management
|
||||
// -----------------------------------------------------------------------
|
||||
void append(const XMLCh toAppend)
|
||||
{
|
||||
// Put in char and bump the index
|
||||
if (fIndex == fCapacity)
|
||||
ensureCapacity(1);
|
||||
fBuffer[fIndex++] = toAppend;
|
||||
}
|
||||
|
||||
void append (const XMLCh* const chars, const XMLSize_t count)
|
||||
{
|
||||
if (count) {
|
||||
if (fIndex + count >= fCapacity) {
|
||||
ensureCapacity(count);
|
||||
}
|
||||
memcpy(&fBuffer[fIndex], chars, count * sizeof(XMLCh));
|
||||
fIndex += count;
|
||||
}
|
||||
else {
|
||||
append(chars);
|
||||
}
|
||||
}
|
||||
|
||||
void append (const XMLCh* const chars)
|
||||
{
|
||||
if (chars != 0 && *chars != 0) {
|
||||
// get length of chars
|
||||
XMLSize_t count = 0;
|
||||
for (; *(chars+count); count++ ) /*noop*/;
|
||||
|
||||
if (fIndex + count >= fCapacity) {
|
||||
ensureCapacity(count);
|
||||
}
|
||||
memcpy(&fBuffer[fIndex], chars, count * sizeof(XMLCh));
|
||||
fIndex += count;
|
||||
}
|
||||
}
|
||||
|
||||
void set (const XMLCh* const chars, const XMLSize_t count)
|
||||
{
|
||||
fIndex = 0;
|
||||
append(chars, count);
|
||||
}
|
||||
|
||||
void set (const XMLCh* const chars)
|
||||
{
|
||||
fIndex = 0;
|
||||
if (chars != 0 && *chars != 0)
|
||||
append(chars);
|
||||
}
|
||||
|
||||
const XMLCh* getRawBuffer() const
|
||||
{
|
||||
fBuffer[fIndex] = 0;
|
||||
return fBuffer;
|
||||
}
|
||||
|
||||
XMLCh* getRawBuffer()
|
||||
{
|
||||
fBuffer[fIndex] = 0;
|
||||
return fBuffer;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
fIndex = 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getters
|
||||
// -----------------------------------------------------------------------
|
||||
bool getInUse() const
|
||||
{
|
||||
return fUsed;
|
||||
}
|
||||
|
||||
XMLSize_t getLen() const
|
||||
{
|
||||
return fIndex;
|
||||
}
|
||||
|
||||
bool isEmpty() const
|
||||
{
|
||||
return (fIndex == 0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setters
|
||||
// -----------------------------------------------------------------------
|
||||
void setInUse(const bool newValue)
|
||||
{
|
||||
fUsed = newValue;
|
||||
}
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBuffer(const XMLBuffer&);
|
||||
XMLBuffer& operator=(const XMLBuffer&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Declare our friends
|
||||
// -----------------------------------------------------------------------
|
||||
friend class XMLBufBid;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private helpers
|
||||
// -----------------------------------------------------------------------
|
||||
void ensureCapacity(const XMLSize_t extraNeeded);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fBuffer
|
||||
// The pointer to the buffer data. Its grown as needed. Its always
|
||||
// one larger than fCapacity, to leave room for the null terminator.
|
||||
//
|
||||
// fIndex
|
||||
// The current index into the buffer, as characters are appended
|
||||
// to it. If its zero, then the buffer is empty.
|
||||
//
|
||||
// fCapacity
|
||||
// The current capacity of the buffer. Its actually always one
|
||||
// larger, to leave room for the null terminator.
|
||||
//
|
||||
// fUsed
|
||||
// Indicates whether this buffer is in use or not.
|
||||
//
|
||||
// fFullHandler, fFullSize
|
||||
// If fFullHandler is non-null, the buffer has a maximum size
|
||||
// indicated by fFullSize. If writing to the buffer would exceed the
|
||||
// buffer's maximum size, fFullHandler's bufferFull callback is
|
||||
// invoked, to empty the buffer.
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t fIndex;
|
||||
XMLSize_t fCapacity;
|
||||
XMLSize_t fFullSize;
|
||||
bool fUsed;
|
||||
MemoryManager* const fMemoryManager;
|
||||
XMLBufferFullHandler* fFullHandler;
|
||||
XMLCh* fBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* XMLBufferFullHandler is a callback interface for clients of
|
||||
* XMLBuffers that impose a size restriction (e.g. XMLScanner).
|
||||
* Note that this is intended solely as a mix-in for internal
|
||||
* use, and therefore does not derive from XMemory (to avoid
|
||||
* the ambiguous base class problem).
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLBufferFullHandler
|
||||
{
|
||||
public :
|
||||
|
||||
virtual ~XMLBufferFullHandler() {}
|
||||
|
||||
/**
|
||||
* Callback method, intended to allow clients of an XMLBuffer which has
|
||||
* become full to empty it appropriately.
|
||||
* @return true if the handler was able to empty the buffer (either
|
||||
* partially or completely), otherwise false to indicate an error.
|
||||
*/
|
||||
virtual bool bufferFull(XMLBuffer&) = 0;
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
212
project/jni/xerces/include/xercesc/framework/XMLBufferMgr.hpp
Normal file
212
project/jni/xerces/include/xercesc/framework/XMLBufferMgr.hpp
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLBufferMgr.hpp 673679 2008-07-03 13:50:10Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLBUFFERMGR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLBUFFERMGR_HPP
|
||||
|
||||
#include <xercesc/framework/XMLBuffer.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLBufBid;
|
||||
|
||||
/**
|
||||
* There are many places where XMLBuffer objects are needed. In order to
|
||||
* avoid either constantly creating and destroying them or maintaining a
|
||||
* fixed set and worrying about accidental reuse, a buffer manager can
|
||||
* provide a pool of buffers which can be temporarily used and then put
|
||||
* back into the pool. This provides a good compromise between performance
|
||||
* and easier maintenance.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLBufferMgr : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
XMLBufferMgr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XMLBufferMgr();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Buffer management
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBuffer& bidOnBuffer();
|
||||
void releaseBuffer(XMLBuffer& toRelease);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t getBufferCount() const;
|
||||
XMLSize_t getAvailableBufferCount() const;
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBufferMgr(const XMLBufferMgr&);
|
||||
XMLBufferMgr& operator=(const XMLBufferMgr&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fBufCount
|
||||
// The count of buffers that have been allocated so far.
|
||||
//
|
||||
// fBufList;
|
||||
// The list of pointers to buffers that are loaned out. There will
|
||||
// never be a lot of them, so a flat list is good enough.
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t fBufCount;
|
||||
MemoryManager* fMemoryManager;
|
||||
XMLBuffer** fBufList;
|
||||
};
|
||||
|
||||
inline XMLSize_t XMLBufferMgr::getBufferCount() const
|
||||
{
|
||||
return fBufCount;
|
||||
}
|
||||
|
||||
inline XMLSize_t XMLBufferMgr::getAvailableBufferCount() const
|
||||
{
|
||||
XMLSize_t available = fBufCount;
|
||||
for (XMLSize_t index = 0; index < fBufCount && fBufList[index]; index++)
|
||||
{
|
||||
if (fBufList[index]->getInUse())
|
||||
--available;
|
||||
}
|
||||
return available;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* XMLBufBid is a scoped based janitor that allows the scanner code to ask
|
||||
* for a buffer on a scoped basis and then insure that it gets freed back
|
||||
* into the pool no matter how the scope is exited (exception or normal exit.)
|
||||
*/
|
||||
class XMLBufBid : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBufBid(XMLBufferMgr* const srcMgr) :
|
||||
|
||||
fBuffer(srcMgr->bidOnBuffer())
|
||||
, fMgr(srcMgr)
|
||||
{
|
||||
}
|
||||
|
||||
~XMLBufBid()
|
||||
{
|
||||
fMgr->releaseBuffer(fBuffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Buffer access
|
||||
// -----------------------------------------------------------------------
|
||||
void append(const XMLCh toAppend)
|
||||
{
|
||||
fBuffer.append(toAppend);
|
||||
}
|
||||
|
||||
void append(const XMLCh* const toAppend, const XMLSize_t count = 0)
|
||||
{
|
||||
fBuffer.append(toAppend, count);
|
||||
}
|
||||
|
||||
const XMLBuffer& getBuffer() const
|
||||
{
|
||||
return fBuffer;
|
||||
}
|
||||
|
||||
XMLBuffer& getBuffer()
|
||||
{
|
||||
return fBuffer;
|
||||
}
|
||||
|
||||
const XMLCh* getRawBuffer() const
|
||||
{
|
||||
fBuffer.fBuffer[fBuffer.fIndex] = 0;
|
||||
return fBuffer.fBuffer;
|
||||
}
|
||||
|
||||
XMLCh* getRawBuffer()
|
||||
{
|
||||
fBuffer.fBuffer[fBuffer.fIndex] = 0;
|
||||
return fBuffer.fBuffer;
|
||||
}
|
||||
|
||||
XMLSize_t getLen() const
|
||||
{
|
||||
return fBuffer.fIndex;
|
||||
}
|
||||
|
||||
bool isEmpty() const
|
||||
{
|
||||
return (fBuffer.fIndex == 0);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
fBuffer.reset();
|
||||
}
|
||||
|
||||
void set(const XMLCh* const chars, const XMLSize_t count = 0)
|
||||
{
|
||||
fBuffer.set(chars, count);
|
||||
}
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBufBid(const XMLBufBid&);
|
||||
XMLBufBid& operator=(const XMLBufBid&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fBuffer
|
||||
// This is the buffer we got, and which we will release.
|
||||
//
|
||||
// fMgr
|
||||
// This is the buffer manager we got the buffer from. This is needed
|
||||
// to release the buffer later.
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBuffer& fBuffer;
|
||||
XMLBufferMgr* const fMgr;
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
145
project/jni/xerces/include/xercesc/framework/XMLContentModel.hpp
Normal file
145
project/jni/xerces/include/xercesc/framework/XMLContentModel.hpp
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLContentModel.hpp 677705 2008-07-17 20:15:32Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLCONTENTMODEL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLCONTENTMODEL_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/util/QName.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class ContentLeafNameTypeVector;
|
||||
class GrammarResolver;
|
||||
class XMLStringPool;
|
||||
class XMLValidator;
|
||||
class SchemaGrammar;
|
||||
class SubstitutionGroupComparator;
|
||||
|
||||
/**
|
||||
* This class defines the abstract interface for all content models. All
|
||||
* elements have a content model against which (if validating) its content
|
||||
* is checked. Each type of validator (DTD, Schema, etc...) can have
|
||||
* different types of content models, and even with each type of validator
|
||||
* there can be specialized content models. So this simple class provides
|
||||
* the abstract API via which all the types of contents models are dealt
|
||||
* with generically. Its pretty simple.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLContentModel : public XMemory
|
||||
{
|
||||
public:
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public static data
|
||||
//
|
||||
// gInvalidTrans
|
||||
// This value represents an invalid transition in each line of the
|
||||
// transition table.
|
||||
//
|
||||
// gEOCFakeId
|
||||
// gEpsilonFakeId
|
||||
// We have to put in a couple of special CMLeaf nodes to represent
|
||||
// special values, using fake element ids that we know won't conflict
|
||||
// with real element ids.
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
static const unsigned int gInvalidTrans;
|
||||
static const unsigned int gEOCFakeId;
|
||||
static const unsigned int gEpsilonFakeId;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, only the virtual Destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~XMLContentModel()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual content model interface provided by derived classes
|
||||
// -----------------------------------------------------------------------
|
||||
virtual bool validateContent
|
||||
(
|
||||
QName** const children
|
||||
, XMLSize_t childCount
|
||||
, unsigned int emptyNamespaceId
|
||||
, XMLSize_t* indexFailingChild
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
) const = 0;
|
||||
|
||||
virtual bool validateContentSpecial
|
||||
(
|
||||
QName** const children
|
||||
, XMLSize_t childCount
|
||||
, unsigned int emptyNamespaceId
|
||||
, GrammarResolver* const pGrammarResolver
|
||||
, XMLStringPool* const pStringPool
|
||||
, XMLSize_t* indexFailingChild
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
) const =0;
|
||||
|
||||
virtual void checkUniqueParticleAttribution
|
||||
(
|
||||
SchemaGrammar* const pGrammar
|
||||
, GrammarResolver* const pGrammarResolver
|
||||
, XMLStringPool* const pStringPool
|
||||
, XMLValidator* const pValidator
|
||||
, unsigned int* const pContentSpecOrgURI
|
||||
, const XMLCh* pComplexTypeName = 0
|
||||
) =0;
|
||||
|
||||
virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector()
|
||||
const = 0;
|
||||
|
||||
virtual unsigned int getNextState(unsigned int currentState,
|
||||
XMLSize_t elementIndex) const = 0;
|
||||
|
||||
virtual bool handleRepetitions( const QName* const curElem,
|
||||
unsigned int curState,
|
||||
unsigned int currentLoop,
|
||||
unsigned int& nextState,
|
||||
unsigned int& nextLoop,
|
||||
XMLSize_t elementIndex,
|
||||
SubstitutionGroupComparator * comparator) const = 0;
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
XMLContentModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLContentModel(const XMLContentModel&);
|
||||
XMLContentModel& operator=(const XMLContentModel&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLDTDDescription.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLDTDDESCRIPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLDTDDESCRIPTION_HPP
|
||||
|
||||
#include <xercesc/framework/XMLGrammarDescription.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLPARSER_EXPORT XMLDTDDescription : public XMLGrammarDescription
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual destructor for derived classes */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* virtual destructor
|
||||
*
|
||||
*/
|
||||
virtual ~XMLDTDDescription();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Implementation of Grammar Description Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* getGrammarType
|
||||
*
|
||||
*/
|
||||
virtual Grammar::GrammarType getGrammarType() const
|
||||
{
|
||||
return Grammar::DTDGrammarType;
|
||||
}
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The DTDDescription Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* Getter
|
||||
*
|
||||
*/
|
||||
virtual const XMLCh* getRootName() const = 0;
|
||||
virtual const XMLCh* getSystemId() const {return 0;};
|
||||
|
||||
/**
|
||||
* Setter
|
||||
*
|
||||
*/
|
||||
virtual void setRootName(const XMLCh* const) = 0;
|
||||
virtual void setSystemId(const XMLCh* const) {};
|
||||
//@}
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLDTDDescription)
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
/** Hidden Constructors */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLDTDDescription(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager);
|
||||
//@}
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
/** name Unimplemented copy constructor and operator= */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLDTDDescription(const XMLDTDDescription& );
|
||||
XMLDTDDescription& operator=(const XMLDTDDescription& );
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLDocumentHandler.hpp 673679 2008-07-03 13:50:10Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLDOCUMENTHANDLER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLDOCUMENTHANDLER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/util/RefVectorOf.hpp>
|
||||
#include <xercesc/framework/XMLAttr.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLElementDecl;
|
||||
class XMLEntityDecl;
|
||||
|
||||
/**
|
||||
* This abstract class provides the interface for the scanner to return
|
||||
* XML document information up to the parser as it scans through the
|
||||
* document.
|
||||
*
|
||||
* The interface is very similar to org.sax.DocumentHandler, but
|
||||
* has some extra methods required to get all the data out.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLDocumentHandler
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, just the virtual destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~XMLDocumentHandler()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
/** @name The document handler interface */
|
||||
//@{
|
||||
/** Receive notification of character data.
|
||||
*
|
||||
* <p>The scanner will call this method to report each chunk of
|
||||
* character data. The scanner may return all contiguous character
|
||||
* data in a single chunk, or they may split it into several
|
||||
* chunks; however, all of the characters in any single event
|
||||
* will come from the same external entity, so that the Locator
|
||||
* provides useful information.</p>
|
||||
*
|
||||
* <p>The parser must not attempt to read from the array
|
||||
* outside of the specified range.</p>
|
||||
*
|
||||
* @param chars The content (characters) between markup from the XML
|
||||
* document.
|
||||
* @param length The number of characters to read from the array.
|
||||
* @param cdataSection Indicates that this data is inside a CDATA
|
||||
* section.
|
||||
* @see #ignorableWhitespace
|
||||
* @see Locator
|
||||
*/
|
||||
virtual void docCharacters
|
||||
(
|
||||
const XMLCh* const chars
|
||||
, const XMLSize_t length
|
||||
, const bool cdataSection
|
||||
) = 0;
|
||||
|
||||
/** Receive notification of comments in the XML content being parsed.
|
||||
*
|
||||
* This scanner will call this method for any comments found in the
|
||||
* content of the document.
|
||||
*
|
||||
* @param comment The text of the comment.
|
||||
*/
|
||||
virtual void docComment
|
||||
(
|
||||
const XMLCh* const comment
|
||||
) = 0;
|
||||
|
||||
/** Receive notification of PI's parsed in the XML content.
|
||||
*
|
||||
* The scanner will call this method for any PIs it finds within the
|
||||
* content of the document.
|
||||
*
|
||||
* @param target The name of the PI.
|
||||
* @param data The body of the PI. This may be an empty string since
|
||||
* the body is optional.
|
||||
*/
|
||||
virtual void docPI
|
||||
(
|
||||
const XMLCh* const target
|
||||
, const XMLCh* const data
|
||||
) = 0;
|
||||
|
||||
/** Receive notification after the scanner has parsed the end of the
|
||||
* document.
|
||||
*
|
||||
* The scanner will call this method when the current document has been
|
||||
* fully parsed. The handler may use this opportunity to do something with
|
||||
* the data, clean up temporary data, etc...
|
||||
*/
|
||||
virtual void endDocument() = 0;
|
||||
|
||||
/** Receive notification of the end of an element.
|
||||
*
|
||||
* This method is called when scanner encounters the end of element tag.
|
||||
* There will be a corresponding startElement() event for every
|
||||
* endElement() event, but not necessarily the other way around. For
|
||||
* empty tags, there is only a startElement() call.
|
||||
*
|
||||
* @param elemDecl The name of the element whose end tag was just
|
||||
* parsed.
|
||||
* @param uriId The ID of the URI in the URI pool (only valid if
|
||||
* name spaces is enabled)
|
||||
* @param isRoot Indicates if this is the root element.
|
||||
* @param prefixName The string representing the prefix name
|
||||
*/
|
||||
virtual void endElement
|
||||
(
|
||||
const XMLElementDecl& elemDecl
|
||||
, const unsigned int uriId
|
||||
, const bool isRoot
|
||||
, const XMLCh* const prefixName = 0
|
||||
) = 0;
|
||||
|
||||
/** Receive notification when a referenced entity's content ends
|
||||
*
|
||||
* This method is called when scanner encounters the end of an entity
|
||||
* reference.
|
||||
*
|
||||
* @param entDecl The name of the entity reference just scanned.
|
||||
*/
|
||||
virtual void endEntityReference
|
||||
(
|
||||
const XMLEntityDecl& entDecl
|
||||
) = 0;
|
||||
|
||||
/** Receive notification of ignorable whitespace in element content.
|
||||
*
|
||||
* <p>Validating Parsers must use this method to report each chunk
|
||||
* of ignorable whitespace (see the W3C XML 1.0 recommendation,
|
||||
* section 2.10): non-validating parsers may also use this method
|
||||
* if they are capable of parsing and using content models.</p>
|
||||
*
|
||||
* <p>The scanner may return all contiguous whitespace in a single
|
||||
* chunk, or it may split it into several chunks; however, all of
|
||||
* the characters in any single event will come from the same
|
||||
* external entity, so that the Locator provides useful
|
||||
* information.</p>
|
||||
*
|
||||
* <p>The parser must not attempt to read from the array
|
||||
* outside of the specified range.</p>
|
||||
*
|
||||
* @param chars The whitespace characters from the XML document.
|
||||
* @param length The number of characters to read from the array.
|
||||
* @param cdataSection Indicates that this data is inside a CDATA
|
||||
* section.
|
||||
* @see #docCharacters
|
||||
*/
|
||||
virtual void ignorableWhitespace
|
||||
(
|
||||
const XMLCh* const chars
|
||||
, const XMLSize_t length
|
||||
, const bool cdataSection
|
||||
) = 0;
|
||||
|
||||
/** Reset the document handler's state, if required
|
||||
*
|
||||
* This method is used to give the registered document handler a
|
||||
* chance to reset itself. Its called by the scanner at the start of
|
||||
* every parse.
|
||||
*/
|
||||
virtual void resetDocument() = 0;
|
||||
|
||||
/** Receive notification of the start of a new document
|
||||
*
|
||||
* This method is the first callback called the scanner at the
|
||||
* start of every parse. This is before any content is parsed.
|
||||
*/
|
||||
virtual void startDocument() = 0;
|
||||
|
||||
/** Receive notification of a new start tag
|
||||
*
|
||||
* This method is called when scanner encounters the start of an element tag.
|
||||
* All elements must always have a startElement() tag. Empty tags will
|
||||
* only have the startElement() tag and no endElement() tag.
|
||||
*
|
||||
* @param elemDecl The name of the element whose start tag was just
|
||||
* parsed.
|
||||
* @param uriId The ID of the URI in the URI pool (only valid if
|
||||
* name spaces is enabled)
|
||||
* @param prefixName The string representing the prefix name
|
||||
* @param attrList List of attributes in the element
|
||||
* @param attrCount Count of the attributes in the element
|
||||
* @param isEmpty Indicates if the element is empty, in which case
|
||||
* you should not expect an endElement() event.
|
||||
* @param isRoot Indicates if this is the root element.
|
||||
*/
|
||||
virtual void startElement
|
||||
(
|
||||
const XMLElementDecl& elemDecl
|
||||
, const unsigned int uriId
|
||||
, const XMLCh* const prefixName
|
||||
, const RefVectorOf<XMLAttr>& attrList
|
||||
, const XMLSize_t attrCount
|
||||
, const bool isEmpty
|
||||
, const bool isRoot
|
||||
) = 0;
|
||||
|
||||
/** Receive notification when the scanner hits an entity reference.
|
||||
*
|
||||
* This is currently useful only to DOM parser configurations as SAX
|
||||
* does not provide any api to return this information.
|
||||
*
|
||||
* @param entDecl The name of the entity that was referenced.
|
||||
*/
|
||||
virtual void startEntityReference(const XMLEntityDecl& entDecl) = 0;
|
||||
|
||||
/** Receive notification of an XML declaration
|
||||
*
|
||||
* Currently neither DOM nor SAX provide API's to return back this
|
||||
* information.
|
||||
*
|
||||
* @param versionStr The value of the <code>version</code> pseudoattribute
|
||||
* of the XML decl.
|
||||
* @param encodingStr The value of the <code>encoding</code> pseudoattribute
|
||||
* of the XML decl.
|
||||
* @param standaloneStr The value of the <code>standalone</code>
|
||||
* pseudoattribute of the XML decl.
|
||||
* @param autoEncodingStr The encoding string auto-detected by the
|
||||
* scanner. In absence of any 'encoding' attribute in the
|
||||
* XML decl, the XML standard specifies how a parser can
|
||||
* auto-detect. If there is no <code>encodingStr</code>
|
||||
* this is what will be used to try to decode the file.
|
||||
*/
|
||||
virtual void XMLDecl
|
||||
(
|
||||
const XMLCh* const versionStr
|
||||
, const XMLCh* const encodingStr
|
||||
, const XMLCh* const standaloneStr
|
||||
, const XMLCh* const autoEncodingStr
|
||||
) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
XMLDocumentHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLDocumentHandler(const XMLDocumentHandler&);
|
||||
XMLDocumentHandler& operator=(const XMLDocumentHandler&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
552
project/jni/xerces/include/xercesc/framework/XMLElementDecl.hpp
Normal file
552
project/jni/xerces/include/xercesc/framework/XMLElementDecl.hpp
Normal file
@@ -0,0 +1,552 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLElementDecl.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLELEMENTDECL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLELEMENTDECL_HPP
|
||||
|
||||
#include <xercesc/framework/XMLAttr.hpp>
|
||||
#include <xercesc/framework/XMLAttDefList.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class ContentSpecNode;
|
||||
class XMLContentModel;
|
||||
|
||||
/**
|
||||
* This class defines the core information of an element declaration. Each
|
||||
* validator (DTD, Schema, etc...) will have its own information that it
|
||||
* associations with the declaration of an element, but they must all share
|
||||
* at least this core information, i.e. they must all derive from this
|
||||
* class. The set of info enforced at this level is driven by the needs of
|
||||
* XML 1.0 spec validation and well formedness checks.
|
||||
*
|
||||
* This class defines some special element id values for invalid elements
|
||||
* and PCDATA elements, as well as a string for the special PCDATA element
|
||||
* name. All validators must honor these special values in order to allow
|
||||
* content models to work generically (i.e. to let code know when its dealing
|
||||
* with invalid or PCDATA element ids without having to know what type of
|
||||
* validator its messing with.)
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLElementDecl : public XSerializable, public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Class specific types
|
||||
//
|
||||
// CreateReasons
|
||||
// This type is used to store how an element declaration got into
|
||||
// the grammar's element pool. They are faulted in for various
|
||||
// reasons.
|
||||
//
|
||||
// LookupOpts
|
||||
// These are the values used by the attribute lookup methods.
|
||||
//
|
||||
// CharDataOpts
|
||||
// This is used to indicate how this type of element reacts to
|
||||
// character data as content.
|
||||
// -----------------------------------------------------------------------
|
||||
enum CreateReasons
|
||||
{
|
||||
NoReason
|
||||
, Declared
|
||||
, AttList
|
||||
, InContentModel
|
||||
, AsRootElem
|
||||
, JustFaultIn
|
||||
};
|
||||
|
||||
enum CharDataOpts
|
||||
{
|
||||
NoCharData
|
||||
, SpacesOk
|
||||
, AllCharData
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Public static data
|
||||
//
|
||||
// fgInvalidElemId
|
||||
// A value to represent an invalid element node id.
|
||||
//
|
||||
// fgPCDataElemId
|
||||
// This is the value to use to represent a PCDATA node when an
|
||||
// element id is required.
|
||||
//
|
||||
// fgPCDataElemName
|
||||
// This is the value to use to represent a PCDATA node when an
|
||||
// element name is required.
|
||||
// -----------------------------------------------------------------------
|
||||
static const unsigned int fgInvalidElemId;
|
||||
static const unsigned int fgPCDataElemId;
|
||||
static const XMLCh fgPCDataElemName[];
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~XMLElementDecl();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual element decl interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virual ElementDecl interface */
|
||||
//@{
|
||||
|
||||
/** Get a list of attributes defined for this element.
|
||||
*
|
||||
* The derived class should return a reference to some member object which
|
||||
* implements the XMLAttDefList interface. This object gives the scanner the
|
||||
* ability to look through the attributes defined for this element.
|
||||
*
|
||||
* It is done this way for efficiency, though of course this is not thread
|
||||
* safe. The scanner guarantees that it won't ever call this method in any
|
||||
* nested way, but the outside world must be careful about when it calls
|
||||
* this method, and optimally never would.
|
||||
*/
|
||||
virtual XMLAttDefList& getAttDefList() const = 0;
|
||||
|
||||
/** The character data options for this element type
|
||||
*
|
||||
* The derived class should return an appropriate character data opts value
|
||||
* which correctly represents its tolerance towards whitespace or character
|
||||
* data inside of its instances. This allows the scanner to do all of the
|
||||
* validation of character data.
|
||||
*/
|
||||
virtual CharDataOpts getCharDataOpts() const = 0;
|
||||
|
||||
/** Indicate whether this element type defined any attributes
|
||||
*
|
||||
* The derived class should return a boolean that indicates whether this
|
||||
* element has any attributes defined for it or not. This is an optimization
|
||||
* that allows the scanner to skip some work if no attributes exist.
|
||||
*/
|
||||
virtual bool hasAttDefs() const = 0;
|
||||
|
||||
/** Get a pointer to the content spec node
|
||||
*
|
||||
* This method will return a const pointer to the content spec node object
|
||||
* of this element.
|
||||
*
|
||||
* @return A const pointer to the element's content spec node
|
||||
*/
|
||||
virtual const ContentSpecNode* getContentSpec() const = 0;
|
||||
|
||||
/** Get a pointer to the content spec node
|
||||
*
|
||||
* This method is identical to the previous one, except that it is non
|
||||
* const.
|
||||
*/
|
||||
virtual ContentSpecNode* getContentSpec() = 0;
|
||||
|
||||
/** Set the content spec node object for this element type
|
||||
*
|
||||
* This method will adopt the based content spec node object. This is called
|
||||
* by the actual validator which is parsing its DTD or Schema or whatever
|
||||
* and store it on the element decl object via this method.
|
||||
*
|
||||
* @param toAdopt This method will adopt the passed content node spec
|
||||
* object. Any previous object is destroyed.
|
||||
*/
|
||||
virtual void setContentSpec(ContentSpecNode* toAdopt) = 0;
|
||||
|
||||
/** Get a pointer to the abstract content model
|
||||
*
|
||||
* This method will return a const pointer to the content model object
|
||||
* of this element. This class is a simple abstraction that allows an
|
||||
* element to define and use multiple, specialized content model types
|
||||
* internally but still allow the outside world to do simple stuff with
|
||||
* them.
|
||||
*
|
||||
* @return A pointer to the element's content model, via the basic
|
||||
* abstract content model type.
|
||||
*/
|
||||
virtual XMLContentModel* getContentModel() = 0;
|
||||
|
||||
/** Set the content model object for this element type
|
||||
*
|
||||
* This method will adopt the based content model object. This is called
|
||||
* by the actual validator which is parsing its DTD or Schema or whatever
|
||||
* a creating an element decl. It will build what it feels is the correct
|
||||
* content model type object and store it on the element decl object via
|
||||
* this method.
|
||||
*
|
||||
* @param newModelToAdopt This method will adopt the passed content model
|
||||
* object. Any previous object is destroyed.
|
||||
*/
|
||||
virtual void setContentModel(XMLContentModel* const newModelToAdopt) = 0;
|
||||
|
||||
/** Geta formatted string of the content model
|
||||
*
|
||||
* This method is a convenience method which will create a formatted
|
||||
* representation of the content model of the element. It will not always
|
||||
* exactly recreate the original model, since some normalization or
|
||||
* or reformatting may occur. But, it will be a technically accurate
|
||||
* representation of the original content model.
|
||||
*
|
||||
* @return A pointer to an internal buffer which contains the formatted
|
||||
* content model. The caller does not own this buffer and should
|
||||
* copy it if it needs to be kept around.
|
||||
*/
|
||||
virtual const XMLCh* getFormattedContentModel () const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
|
||||
/** Get the base name of this element type.
|
||||
*
|
||||
* Return the base name part of the element's name. This is the
|
||||
* same regardless of whether namespaces are enabled or not.
|
||||
*
|
||||
* @return A const pointer to the base name of the element decl.
|
||||
*/
|
||||
const XMLCh* getBaseName() const;
|
||||
XMLCh* getBaseName();
|
||||
|
||||
/** Get the URI id of this element type.
|
||||
*
|
||||
* Return the URI Id of this element.
|
||||
*
|
||||
* @return The URI Id of the element decl, or the emptyNamespaceId if not applicable.
|
||||
*/
|
||||
unsigned int getURI() const;
|
||||
|
||||
/** Get the QName of this element type.
|
||||
*
|
||||
* Return the QName part of the element's name. This is the
|
||||
* same regardless of whether namespaces are enabled or not.
|
||||
*
|
||||
* @return A const pointer to the QName of the element decl.
|
||||
*/
|
||||
const QName* getElementName() const;
|
||||
QName* getElementName();
|
||||
|
||||
/** Get the full name of this element type.
|
||||
*
|
||||
* Return the full name of the element. If namespaces
|
||||
* are not enabled, then this is the qName. Else it is the {uri}baseName
|
||||
* form. For those validators that always require namespace processing, it
|
||||
* will always be in the latter form because namespace processing will always
|
||||
* be on.
|
||||
*/
|
||||
const XMLCh* getFullName() const;
|
||||
|
||||
/** Get the create reason for this element type
|
||||
*
|
||||
* This method returns an enumeration which indicates why this element
|
||||
* declaration exists. Elements can be used before they are actually
|
||||
* declared, so they will often be faulted into the pool and marked as
|
||||
* to why they are there.
|
||||
*
|
||||
* @return An enumerated value that indicates the reason why this element
|
||||
* was added to the element decl pool.
|
||||
*/
|
||||
|
||||
CreateReasons getCreateReason() const;
|
||||
|
||||
/** Get the element decl pool id for this element type
|
||||
*
|
||||
* This method will return the element decl pool id of this element
|
||||
* declaration. This uniquely identifies this element type within the
|
||||
* parse event that it is declared within. This value is assigned by the
|
||||
* grammar whose decl pool this object belongs to.
|
||||
*
|
||||
* @return The element decl id of this element declaration.
|
||||
*/
|
||||
XMLSize_t getId() const;
|
||||
|
||||
/** Indicate whether this element type has been declared yet
|
||||
*
|
||||
* This method returns a boolean that indicates whether this element
|
||||
* has been declared yet. There are a number of reasons why an element
|
||||
* declaration can be faulted in, but eventually it must be declared or
|
||||
* its an error. See the CreateReasons enumeration.
|
||||
*
|
||||
* @return true if this element has been declared, else false.
|
||||
*/
|
||||
bool isDeclared() const;
|
||||
|
||||
/** Indicate whether this element type has been declared externally
|
||||
*
|
||||
* This method returns a boolean that indicates whether this element
|
||||
* has been declared externally.
|
||||
*
|
||||
* @return true if this element has been declared externally, else false.
|
||||
*/
|
||||
|
||||
bool isExternal() const;
|
||||
|
||||
/** Get the memory manager
|
||||
*
|
||||
* This method returns the configurable memory manager used by the
|
||||
* element declaration for dynamic allocation/deallocation.
|
||||
*
|
||||
* @return the memory manager
|
||||
*/
|
||||
MemoryManager* getMemoryManager() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
|
||||
/** Set the element name object for this element type
|
||||
*
|
||||
* This method will adopt the based content spec node object. This is called
|
||||
* by the actual validator which is parsing its DTD or Schema or whatever
|
||||
* and store it on the element decl object via this method.
|
||||
*
|
||||
* @param prefix Prefix of the element
|
||||
* @param localPart Base Name of the element
|
||||
* @param uriId The uriId of the element
|
||||
*/
|
||||
void setElementName(const XMLCh* const prefix
|
||||
, const XMLCh* const localPart
|
||||
, const int uriId );
|
||||
|
||||
/** Set the element name object for this element type
|
||||
*
|
||||
* This method will adopt the based content spec node object. This is called
|
||||
* by the actual validator which is parsing its DTD or Schema or whatever
|
||||
* and store it on the element decl object via this method.
|
||||
*
|
||||
* @param rawName Full Name of the element
|
||||
* @param uriId The uriId of the element
|
||||
*/
|
||||
void setElementName(const XMLCh* const rawName
|
||||
, const int uriId );
|
||||
|
||||
/** Set the element name object for this element type
|
||||
*
|
||||
* This method will adopt the based content spec node object. This is called
|
||||
* by the actual validator which is parsing its DTD or Schema or whatever
|
||||
* and store it on the element decl object via this method.
|
||||
*
|
||||
* @param elementName QName of the element
|
||||
*/
|
||||
void setElementName(const QName* const elementName);
|
||||
|
||||
/** Update the create reason for this element type.
|
||||
*
|
||||
* This method will update the 'create reason' field for this element
|
||||
* decl object. As the validator parses its DTD, Schema, etc... it will
|
||||
* encounter various references to an element declaration, which will
|
||||
* cause the element declaration to either be declared or to be faulted
|
||||
* into the pool in preparation for some future declaration. As it does
|
||||
* so,it will update this field to indicate the current status of the
|
||||
* decl object.
|
||||
*/
|
||||
void setCreateReason(const CreateReasons newReason);
|
||||
|
||||
/** Set the element decl pool id for this element type
|
||||
*
|
||||
* This method will set the pool id of this element decl. This is called
|
||||
* by the grammar which created this object, and will provide this
|
||||
* decl object with a unique id within the parse event that created it.
|
||||
*/
|
||||
void setId(const XMLSize_t newId);
|
||||
|
||||
|
||||
/** Set the element decl to indicate external declaration
|
||||
*
|
||||
*/
|
||||
void setExternalElemDeclaration(const bool aValue);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Miscellaneous methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Miscellaneous methods */
|
||||
//@{
|
||||
|
||||
//@}
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLElementDecl)
|
||||
|
||||
enum objectType
|
||||
{
|
||||
Schema
|
||||
, DTD
|
||||
, UnKnown
|
||||
};
|
||||
|
||||
virtual XMLElementDecl::objectType getObjectType() const = 0;
|
||||
|
||||
static void storeElementDecl(XSerializeEngine& serEng
|
||||
, XMLElementDecl* const element);
|
||||
|
||||
static XMLElementDecl* loadElementDecl(XSerializeEngine& serEng);
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
XMLElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLElementDecl(const XMLElementDecl&);
|
||||
XMLElementDecl& operator=(const XMLElementDecl&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Data members
|
||||
//
|
||||
// fElementName
|
||||
// This is the name of the element decl.
|
||||
//
|
||||
// fCreateReason
|
||||
// We sometimes have to put an element decl object into the elem
|
||||
// decl pool before the element's declaration is seen, such as when
|
||||
// its used in another element's content model or an att list is
|
||||
// seen for it. This flag tells us whether its been declared, and
|
||||
// if not why it had to be created.
|
||||
//
|
||||
// fId
|
||||
// The unique id of this element. This is created by the derived
|
||||
// class, or more accurately the grammar that owns the objects
|
||||
// of the derived types. But, since they all have to have them, we
|
||||
// let them all store the id here. It is defaulted to have the
|
||||
// value fgInvalidElem until explicitly set.
|
||||
//
|
||||
// fExternalElement
|
||||
// This flag indicates whether or the element was declared externally.
|
||||
// -----------------------------------------------------------------------
|
||||
MemoryManager* fMemoryManager;
|
||||
QName* fElementName;
|
||||
CreateReasons fCreateReason;
|
||||
XMLSize_t fId;
|
||||
bool fExternalElement;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLElementDecl: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline const XMLCh* XMLElementDecl::getBaseName() const
|
||||
{
|
||||
return fElementName->getLocalPart();
|
||||
}
|
||||
|
||||
inline XMLCh* XMLElementDecl::getBaseName()
|
||||
{
|
||||
return fElementName->getLocalPart();
|
||||
}
|
||||
|
||||
inline unsigned int XMLElementDecl::getURI() const
|
||||
{
|
||||
return fElementName->getURI();
|
||||
}
|
||||
|
||||
inline const QName* XMLElementDecl::getElementName() const
|
||||
{
|
||||
return fElementName;
|
||||
}
|
||||
|
||||
inline QName* XMLElementDecl::getElementName()
|
||||
{
|
||||
return fElementName;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLElementDecl::getFullName() const
|
||||
{
|
||||
return fElementName->getRawName();
|
||||
}
|
||||
|
||||
inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const
|
||||
{
|
||||
return fCreateReason;
|
||||
}
|
||||
|
||||
inline XMLSize_t XMLElementDecl::getId() const
|
||||
{
|
||||
return fId;
|
||||
}
|
||||
|
||||
inline bool XMLElementDecl::isDeclared() const
|
||||
{
|
||||
return (fCreateReason == Declared);
|
||||
}
|
||||
|
||||
|
||||
inline bool XMLElementDecl::isExternal() const
|
||||
{
|
||||
return fExternalElement;
|
||||
}
|
||||
|
||||
inline MemoryManager* XMLElementDecl::getMemoryManager() const
|
||||
{
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLElementDecl: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void
|
||||
XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason)
|
||||
{
|
||||
fCreateReason = newReason;
|
||||
}
|
||||
|
||||
inline void XMLElementDecl::setId(const XMLSize_t newId)
|
||||
{
|
||||
fId = newId;
|
||||
}
|
||||
|
||||
|
||||
inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue)
|
||||
{
|
||||
fExternalElement = aValue;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
512
project/jni/xerces/include/xercesc/framework/XMLEntityDecl.hpp
Normal file
512
project/jni/xerces/include/xercesc/framework/XMLEntityDecl.hpp
Normal file
@@ -0,0 +1,512 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLEntityDecl.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLENTITYDECL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLENTITYDECL_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class defines that core information that defines an XML entity, no
|
||||
* matter what validator is used. Each validator will create a derivative
|
||||
* of this class which adds any extra information it requires.
|
||||
*
|
||||
* This class supports keyed collection semantics via the getKey() method
|
||||
* which extracts the key field, the entity name in this case. The name will
|
||||
* have whatever form is deemed appropriate for the type of validator in
|
||||
* use.
|
||||
*
|
||||
* When setting the fields of this class, you must make sure that you do
|
||||
* not set conflicting values. For instance, an internal entity cannot have
|
||||
* a notation name. And an external entity cannot have a value string.
|
||||
* These rules are defined by the XML specification. In most cases, these
|
||||
* objects are created by validator objects as they parse a DTD or Schema
|
||||
* or whatever, at which time they confirm the correctness of the data before
|
||||
* creating the entity decl object.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLEntityDecl : public XSerializable, public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
XMLEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/** Constructor with a const entity name
|
||||
*
|
||||
* @param entName The new name to give to this entity.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
XMLEntityDecl
|
||||
(
|
||||
const XMLCh* const entName
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor with a const entity name and value
|
||||
*
|
||||
* @param entName The new name to give to this entity.
|
||||
* @param value The new value to give to this entity name.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
XMLEntityDecl
|
||||
(
|
||||
const XMLCh* const entName
|
||||
, const XMLCh* const value
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor with a const entity name and single XMLCh value
|
||||
*
|
||||
* @param entName The new name to give to this entity.
|
||||
* @param value The new value to give to this entity name.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
XMLEntityDecl
|
||||
(
|
||||
const XMLCh* const entName
|
||||
, const XMLCh value
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
*/
|
||||
virtual ~XMLEntityDecl();
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual entity decl interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name The pure virtual methods in this interface. */
|
||||
//@{
|
||||
|
||||
/** Get the 'declared in internal subset' flag
|
||||
*
|
||||
* Gets the state of the flag which indicates whether the entity was
|
||||
* declared in the internal or external subset. Some structural
|
||||
* description languages might not have an internal subset concept, in
|
||||
* which case this will always return false.
|
||||
*/
|
||||
virtual bool getDeclaredInIntSubset() const = 0;
|
||||
|
||||
/** Get the 'is parameter entity' flag
|
||||
*
|
||||
* Gets the state of the flag which indicates whether this entity is
|
||||
* a parameter entity. If not, then its a general entity.
|
||||
*/
|
||||
virtual bool getIsParameter() const = 0;
|
||||
|
||||
/** Get the 'is special char entity' flag
|
||||
*
|
||||
* Gets the state of the flag that indicates whether this entity is
|
||||
* one of the special, intrinsically supported character entities.
|
||||
*/
|
||||
virtual bool getIsSpecialChar() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Gets the pool id of this entity. Validators maintain all decls in
|
||||
* pools, from which they can be quickly extracted via id.
|
||||
*/
|
||||
XMLSize_t getId() const;
|
||||
|
||||
/**
|
||||
* Returns a const pointer to the name of this entity decl. This name
|
||||
* will be in whatever format is appropriate for the type of validator
|
||||
* in use.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* Gets the notation name, if any, declared for this entity. If this
|
||||
* entity is not a notation type entity, it will be a null pointer.
|
||||
*/
|
||||
const XMLCh* getNotationName() const;
|
||||
|
||||
/**
|
||||
* Gets the public id declared for this entity. Public ids are optional
|
||||
* so it can be a null pointer.
|
||||
*/
|
||||
const XMLCh* getPublicId() const;
|
||||
|
||||
/**
|
||||
* Gets the system id declared for this entity. The system id is required
|
||||
* so this method should never return a null pointers.
|
||||
*/
|
||||
const XMLCh* getSystemId() const;
|
||||
|
||||
/**
|
||||
* Gets the base URI for this entity.
|
||||
*/
|
||||
const XMLCh* getBaseURI() const;
|
||||
|
||||
/**
|
||||
* This method returns the value of an internal entity. If this is not
|
||||
* an internal entity (i.e. its external), then this will be a null
|
||||
* pointer.
|
||||
*/
|
||||
const XMLCh* getValue() const;
|
||||
|
||||
/**
|
||||
* This method returns the number of characters in the value returned
|
||||
* by getValue(). If this entity is external, this will be zero since
|
||||
* an external entity has no internal value.
|
||||
*/
|
||||
XMLSize_t getValueLen() const;
|
||||
|
||||
/**
|
||||
* Indicates that this entity is an external entity. If not, then it is
|
||||
* assumed to be an internal entity, surprise.
|
||||
*/
|
||||
bool isExternal() const;
|
||||
|
||||
/**
|
||||
* Indicates whether this entity is unparsed. This is meaningless for
|
||||
* internal entities. Some external entities are unparsed in that they
|
||||
* refer to something other than XML source.
|
||||
*/
|
||||
bool isUnparsed() const;
|
||||
|
||||
/** Get the plugged-in memory manager
|
||||
*
|
||||
* This method returns the plugged-in memory manager user for dynamic
|
||||
* memory allocation/deallocation.
|
||||
*
|
||||
* @return the plugged-in memory manager
|
||||
*/
|
||||
MemoryManager* getMemoryManager() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method will set the entity name. The format of this name is
|
||||
* defined by the particular validator in use, since it will be the
|
||||
* one who creates entity definitions as it parses the DTD, Schema,
|
||||
* ect...
|
||||
*
|
||||
* @param entName The new name to give to this entity.
|
||||
*/
|
||||
void setName
|
||||
(
|
||||
const XMLCh* const entName
|
||||
);
|
||||
|
||||
/**
|
||||
* This method will mark whether the entity is external.
|
||||
*
|
||||
* @param value The new value for the 'is external' flag.
|
||||
*/
|
||||
void setIsExternal(bool value);
|
||||
|
||||
/**
|
||||
* This method will set the notation name for this entity. By setting
|
||||
* this, you are indicating that this is an unparsed external entity.
|
||||
*
|
||||
* @param newName The new notation name to give to this entity.
|
||||
*/
|
||||
void setNotationName(const XMLCh* const newName);
|
||||
|
||||
/**
|
||||
* This method will set a new public id on this entity. The public id
|
||||
* has no particular form and is purely for client consumption.
|
||||
*
|
||||
* @param newId The new public id to give to this entity.
|
||||
*/
|
||||
void setPublicId(const XMLCh* const newId);
|
||||
|
||||
/**
|
||||
* This method will set a new sysetm id on this entity. This will
|
||||
* then control where the source for this entity lives. If it is
|
||||
* an internal entity, then the system id is only for bookkeeping
|
||||
* purposes, and to allow any external entities referenced from
|
||||
* within the entity to be correctly resolved.
|
||||
*
|
||||
* @param newId The new system id to give to the entity.
|
||||
*/
|
||||
void setSystemId(const XMLCh* const newId);
|
||||
|
||||
/**
|
||||
* This method will set a new baseURI on this entity. This will
|
||||
* then control the URI used to resolve the relative system Id.
|
||||
*
|
||||
* @param newId The new base URI to give to the entity.
|
||||
*/
|
||||
void setBaseURI(const XMLCh* const newId);
|
||||
|
||||
/**
|
||||
* This method will set a new value for this entity. This is only
|
||||
* valid if the entity is to be an internal entity. By setting this
|
||||
* field, you are indicating that the entity is internal.
|
||||
*
|
||||
* @param newValue The new value to give to this entity.
|
||||
*/
|
||||
void setValue(const XMLCh* const newValue);
|
||||
|
||||
//@}
|
||||
|
||||
/* For internal use only */
|
||||
void setId(const XMLSize_t newId);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Support named pool syntax
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method allows objects of this class to be used within a standard
|
||||
* keyed collection used commonly within the parser system. The collection
|
||||
* calls this method to get the key (usually to hash it) by which the
|
||||
* object is to be stored.
|
||||
*/
|
||||
const XMLCh* getKey() const;
|
||||
|
||||
//@}
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLEntityDecl)
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLEntityDecl(const XMLEntityDecl&);
|
||||
XMLEntityDecl& operator=(XMLEntityDecl&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// XMLEntityDecl: Private helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
void cleanUp();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fId
|
||||
// This is the unique id given to this entity decl.
|
||||
//
|
||||
// fName
|
||||
// The name of the entity. Entity names are never namespace based.
|
||||
//
|
||||
// fNotationName
|
||||
// The optional notation of the entity. If there was none, then its
|
||||
// empty.
|
||||
//
|
||||
// fPublicId
|
||||
// The public id of the entity, which can be empty.
|
||||
//
|
||||
// fSystemId
|
||||
// The system id of the entity.
|
||||
//
|
||||
// fValue
|
||||
// fValueLen
|
||||
// The entity's value and length, which is only valid if its an
|
||||
// internal style entity.
|
||||
//
|
||||
// fBaseURI
|
||||
// The base URI of the entity. According to XML InfoSet, such value
|
||||
// is the URI where it is declared (NOT referenced).
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t fId;
|
||||
XMLSize_t fValueLen;
|
||||
XMLCh* fValue;
|
||||
XMLCh* fName;
|
||||
XMLCh* fNotationName;
|
||||
XMLCh* fPublicId;
|
||||
XMLCh* fSystemId;
|
||||
XMLCh* fBaseURI;
|
||||
bool fIsExternal;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLEntityDecl: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLSize_t XMLEntityDecl::getId() const
|
||||
{
|
||||
return fId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLEntityDecl::getName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLEntityDecl::getNotationName() const
|
||||
{
|
||||
return fNotationName;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLEntityDecl::getPublicId() const
|
||||
{
|
||||
return fPublicId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLEntityDecl::getSystemId() const
|
||||
{
|
||||
return fSystemId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLEntityDecl::getBaseURI() const
|
||||
{
|
||||
return fBaseURI;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLEntityDecl::getValue() const
|
||||
{
|
||||
return fValue;
|
||||
}
|
||||
|
||||
inline XMLSize_t XMLEntityDecl::getValueLen() const
|
||||
{
|
||||
return fValueLen;
|
||||
}
|
||||
|
||||
inline bool XMLEntityDecl::isExternal() const
|
||||
{
|
||||
return fIsExternal;
|
||||
}
|
||||
|
||||
inline bool XMLEntityDecl::isUnparsed() const
|
||||
{
|
||||
// If it has a notation, its unparsed
|
||||
return (fNotationName != 0);
|
||||
}
|
||||
|
||||
inline MemoryManager* XMLEntityDecl::getMemoryManager() const
|
||||
{
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLEntityDecl: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void XMLEntityDecl::setId(const XMLSize_t newId)
|
||||
{
|
||||
fId = newId;
|
||||
}
|
||||
|
||||
inline void XMLEntityDecl::setIsExternal(bool value)
|
||||
{
|
||||
fIsExternal = value;
|
||||
}
|
||||
|
||||
inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
|
||||
{
|
||||
if (fNotationName)
|
||||
fMemoryManager->deallocate(fNotationName);
|
||||
|
||||
fNotationName = XMLString::replicate(newName, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
|
||||
{
|
||||
if (fPublicId)
|
||||
fMemoryManager->deallocate(fPublicId);
|
||||
|
||||
fPublicId = XMLString::replicate(newId, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
|
||||
{
|
||||
if (fSystemId)
|
||||
fMemoryManager->deallocate(fSystemId);
|
||||
|
||||
fSystemId = XMLString::replicate(newId, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
|
||||
{
|
||||
if (fBaseURI)
|
||||
fMemoryManager->deallocate(fBaseURI);
|
||||
|
||||
fBaseURI = XMLString::replicate(newId, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
|
||||
{
|
||||
if (fValue)
|
||||
fMemoryManager->deallocate(fValue);
|
||||
|
||||
fValue = XMLString::replicate(newValue, fMemoryManager);
|
||||
fValueLen = XMLString::stringLen(newValue);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLEntityDecl: Support named pool syntax
|
||||
// ---------------------------------------------------------------------------
|
||||
inline const XMLCh* XMLEntityDecl::getKey() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLEntityHandler.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class InputSource;
|
||||
class XMLBuffer;
|
||||
class XMLResourceIdentifier;
|
||||
|
||||
/**
|
||||
* This abstract class is a callback mechanism for the scanner. By creating
|
||||
* a derivative of this class and plugging into the scanner, the scanner
|
||||
* will call back on the object's methods to entity events.
|
||||
*
|
||||
* This class is primarily for use by those writing their own parser classes.
|
||||
* If you use the standard parser classes, DOMParser and SAXParser, you won't
|
||||
* use this API. You will instead use a similar mechanism defined by the SAX
|
||||
* API, called EntityResolver.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLEntityHandler
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, only the virtual destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
*/
|
||||
virtual ~XMLEntityHandler()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual entity handler interface
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The pure virtual methods in this interface. */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method get called after the scanner has finished reading from
|
||||
* the given input source while processing external entity references.
|
||||
*
|
||||
* @param inputSource The input source for the entity
|
||||
*/
|
||||
virtual void endInputSource(const InputSource& inputSource) = 0;
|
||||
|
||||
/**
|
||||
* This method allows the passes the scanned systemId to the entity
|
||||
* handler, thereby giving it a chance to provide any customized
|
||||
* handling like resolving relative path names. The scanner first
|
||||
* calls this method before calling <code>resolveEntity</code>.
|
||||
*
|
||||
* @param systemId The system id extracted by the scanner from the
|
||||
* input source.
|
||||
* @param toFill The buffer in which the fully expanded system id needs
|
||||
* to be stored.
|
||||
*/
|
||||
virtual bool expandSystemId
|
||||
(
|
||||
const XMLCh* const systemId
|
||||
, XMLBuffer& toFill
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* This method allows the entity handler to reset itself, so that
|
||||
* it can be used again. It is called prior to a new document parse
|
||||
* operation.
|
||||
*/
|
||||
virtual void resetEntities() = 0;
|
||||
|
||||
/**
|
||||
* This method allows the entity handler to provide customized
|
||||
* application specific entity resolution.
|
||||
*
|
||||
* <i>Only one resolveEntity method will be used. If both setEntityResolver and
|
||||
* setXMLEntityResolver are called, then the last one is used.</i>
|
||||
*
|
||||
* @param resourceIdentifier An object containing the type of
|
||||
* resource to be resolved and the associated data members
|
||||
* corresponding to this type.
|
||||
* @return The value returned by the resolveEntity method or
|
||||
* NULL otherwise to indicate no processing was done.
|
||||
* The returned InputSource is owned by the parser which is
|
||||
* responsible to clean up the memory.
|
||||
*/
|
||||
virtual InputSource* resolveEntity
|
||||
(
|
||||
XMLResourceIdentifier* resourceIdentifier
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* This method will be called before the scanner starts reading
|
||||
* from an input source while processing external entity references.
|
||||
*
|
||||
* @param inputSource The external input source.
|
||||
*/
|
||||
virtual void startInputSource(const InputSource& inputSource) = 0;
|
||||
//@}
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Protected default constructor
|
||||
*/
|
||||
XMLEntityHandler()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and destructor
|
||||
// -----------------------------------------------------------------------
|
||||
XMLEntityHandler(const XMLEntityHandler&);
|
||||
XMLEntityHandler& operator=(const XMLEntityHandler&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
351
project/jni/xerces/include/xercesc/framework/XMLErrorCodes.hpp
Normal file
351
project/jni/xerces/include/xercesc/framework/XMLErrorCodes.hpp
Normal file
@@ -0,0 +1,351 @@
|
||||
// This file is generated, don't edit it!!
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLErrs)
|
||||
#define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLErrs
|
||||
|
||||
#include <xercesc/framework/XMLErrorReporter.hpp>
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMError.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLErrs
|
||||
{
|
||||
public :
|
||||
enum Codes
|
||||
{
|
||||
NoError = 0
|
||||
, W_LowBounds = 1
|
||||
, NotationAlreadyExists = 2
|
||||
, AttListAlreadyExists = 3
|
||||
, ContradictoryEncoding = 4
|
||||
, UndeclaredElemInCM = 5
|
||||
, UndeclaredElemInAttList = 6
|
||||
, XMLException_Warning = 7
|
||||
, XIncludeResourceErrorWarning = 8
|
||||
, XIncludeCannotOpenFile = 9
|
||||
, XIncludeIncludeFailedResourceError = 10
|
||||
, W_HighBounds = 11
|
||||
, E_LowBounds = 12
|
||||
, FeatureUnsupported = 13
|
||||
, TopLevelNoNameComplexType = 14
|
||||
, TopLevelNoNameAttribute = 15
|
||||
, NoNameRefAttribute = 16
|
||||
, NoNameRefElement = 17
|
||||
, NoNameRefGroup = 18
|
||||
, NoNameRefAttGroup = 19
|
||||
, AnonComplexTypeWithName = 20
|
||||
, AnonSimpleTypeWithName = 21
|
||||
, InvalidElementContent = 22
|
||||
, SimpleTypeContentError = 23
|
||||
, ExpectedSimpleTypeInList = 24
|
||||
, ListUnionRestrictionError = 25
|
||||
, SimpleTypeDerivationByListError = 26
|
||||
, ExpectedSimpleTypeInRestriction = 27
|
||||
, DuplicateFacet = 28
|
||||
, ExpectedSimpleTypeInUnion = 29
|
||||
, EmptySimpleTypeContent = 30
|
||||
, InvalidSimpleContent = 31
|
||||
, UnspecifiedBase = 32
|
||||
, InvalidComplexContent = 33
|
||||
, SchemaElementContentError = 34
|
||||
, ContentError = 35
|
||||
, UnknownSimpleType = 36
|
||||
, UnknownComplexType = 37
|
||||
, UnresolvedPrefix = 38
|
||||
, RefElementNotFound = 39
|
||||
, TypeNotFound = 40
|
||||
, TopLevelAttributeNotFound = 41
|
||||
, InvalidChildInComplexType = 42
|
||||
, BaseTypeNotFound = 43
|
||||
, DatatypeValidatorCreationError = 44
|
||||
, InvalidChildFollowingSimpleContent = 45
|
||||
, InvalidChildFollowingConplexContent = 46
|
||||
, AttributeDefaultFixedValue = 47
|
||||
, NotOptionalDefaultAttValue = 48
|
||||
, DuplicateAttribute = 49
|
||||
, AttributeWithTypeAndSimpleType = 50
|
||||
, AttributeSimpleTypeNotFound = 51
|
||||
, ElementWithFixedAndDefault = 52
|
||||
, InvalidDeclarationName = 53
|
||||
, ElementWithTypeAndAnonType = 54
|
||||
, NotSimpleOrMixedElement = 55
|
||||
, DisallowedSimpleTypeExtension = 56
|
||||
, InvalidSimpleContentBase = 57
|
||||
, InvalidComplexTypeBase = 58
|
||||
, InvalidChildInSimpleContent = 59
|
||||
, InvalidChildInComplexContent = 60
|
||||
, AnnotationError = 61
|
||||
, DisallowedBaseDerivation = 62
|
||||
, InvalidBlockValue = 63
|
||||
, InvalidFinalValue = 64
|
||||
, InvalidSubstitutionGroupElement = 65
|
||||
, SubstitutionGroupTypeMismatch = 66
|
||||
, DuplicateElementDeclaration = 67
|
||||
, InvalidAttValue = 68
|
||||
, AttributeRefContentError = 69
|
||||
, DuplicateRefAttribute = 70
|
||||
, ForbiddenDerivationByRestriction = 71
|
||||
, ForbiddenDerivationByExtension = 72
|
||||
, BaseNotComplexType = 73
|
||||
, ImportNamespaceDifference = 74
|
||||
, DeclarationNoSchemaLocation = 75
|
||||
, IncludeNamespaceDifference = 76
|
||||
, OnlyAnnotationExpected = 77
|
||||
, InvalidAttributeContent = 78
|
||||
, AttributeRequiredGlobal = 79
|
||||
, AttributeRequiredLocal = 80
|
||||
, AttributeDisallowedGlobal = 81
|
||||
, AttributeDisallowedLocal = 82
|
||||
, InvalidMin2MaxOccurs = 83
|
||||
, AnyAttributeContentError = 84
|
||||
, NoNameGlobalElement = 85
|
||||
, NoCircularDefinition = 86
|
||||
, DuplicateGlobalType = 87
|
||||
, DuplicateGlobalDeclaration = 88
|
||||
, WS_CollapseExpected = 89
|
||||
, Import_1_1 = 90
|
||||
, Import_1_2 = 91
|
||||
, ElemIDValueConstraint = 92
|
||||
, NoNotationType = 93
|
||||
, EmptiableMixedContent = 94
|
||||
, EmptyComplexRestrictionDerivation = 95
|
||||
, MixedOrElementOnly = 96
|
||||
, InvalidContentRestriction = 97
|
||||
, ForbiddenDerivation = 98
|
||||
, AtomicItemType = 99
|
||||
, GroupContentError = 100
|
||||
, AttGroupContentError = 101
|
||||
, MinMaxOnGroupChild = 102
|
||||
, DeclarationNotFound = 103
|
||||
, AllContentLimited = 104
|
||||
, BadMinMaxAllCT = 105
|
||||
, BadMinMaxAllElem = 106
|
||||
, DuplicateAttInDerivation = 107
|
||||
, NotExpressibleWildCardIntersection = 108
|
||||
, BadAttDerivation_1 = 109
|
||||
, BadAttDerivation_2 = 110
|
||||
, BadAttDerivation_3 = 111
|
||||
, BadAttDerivation_4 = 112
|
||||
, BadAttDerivation_5 = 113
|
||||
, BadAttDerivation_6 = 114
|
||||
, BadAttDerivation_7 = 115
|
||||
, BadAttDerivation_8 = 116
|
||||
, BadAttDerivation_9 = 117
|
||||
, AllContentError = 118
|
||||
, RedefineNamespaceDifference = 119
|
||||
, Redefine_InvalidSimpleType = 120
|
||||
, Redefine_InvalidSimpleTypeBase = 121
|
||||
, Redefine_InvalidComplexType = 122
|
||||
, Redefine_InvalidComplexTypeBase = 123
|
||||
, Redefine_InvalidGroupMinMax = 124
|
||||
, Redefine_DeclarationNotFound = 125
|
||||
, Redefine_GroupRefCount = 126
|
||||
, Redefine_AttGroupRefCount = 127
|
||||
, Redefine_InvalidChild = 128
|
||||
, Notation_DeclNotFound = 129
|
||||
, IC_DuplicateDecl = 130
|
||||
, IC_BadContent = 131
|
||||
, IC_KeyRefReferNotFound = 132
|
||||
, IC_KeyRefCardinality = 133
|
||||
, IC_XPathExprMissing = 134
|
||||
, AttUseCorrect = 135
|
||||
, AttDeclPropCorrect3 = 136
|
||||
, AttDeclPropCorrect5 = 137
|
||||
, AttGrpPropCorrect3 = 138
|
||||
, InvalidTargetNSValue = 139
|
||||
, XMLException_Error = 140
|
||||
, InvalidRedefine = 141
|
||||
, InvalidNSReference = 142
|
||||
, NotAllContent = 143
|
||||
, InvalidAnnotationContent = 144
|
||||
, InvalidFacetName = 145
|
||||
, InvalidXMLSchemaRoot = 146
|
||||
, CircularSubsGroup = 147
|
||||
, ELTSchemaNS = 148
|
||||
, InvalidAttTNS = 149
|
||||
, NSDeclInvalid = 150
|
||||
, DOMLevel1Node = 151
|
||||
, DuplicateAnyAttribute = 152
|
||||
, AnyAttributeBeforeAttribute = 153
|
||||
, E_HighBounds = 154
|
||||
, F_LowBounds = 155
|
||||
, EntityExpansionLimitExceeded = 156
|
||||
, ExpectedCommentOrCDATA = 157
|
||||
, ExpectedAttrName = 158
|
||||
, ExpectedNotationName = 159
|
||||
, NoRepInMixed = 160
|
||||
, ExpectedDefAttrDecl = 161
|
||||
, ExpectedEqSign = 162
|
||||
, ExpectedElementName = 163
|
||||
, CommentsMustStartWith = 164
|
||||
, InvalidDocumentStructure = 165
|
||||
, ExpectedDeclString = 166
|
||||
, BadXMLVersion = 167
|
||||
, UnsupportedXMLVersion = 168
|
||||
, UnterminatedXMLDecl = 169
|
||||
, BadXMLEncoding = 170
|
||||
, BadStandalone = 171
|
||||
, UnterminatedComment = 172
|
||||
, PINameExpected = 173
|
||||
, UnterminatedPI = 174
|
||||
, InvalidCharacter = 175
|
||||
, UnterminatedStartTag = 176
|
||||
, ExpectedAttrValue = 177
|
||||
, UnterminatedEndTag = 178
|
||||
, ExpectedAttributeType = 179
|
||||
, ExpectedEndOfTagX = 180
|
||||
, ExpectedMarkup = 181
|
||||
, NotValidAfterContent = 182
|
||||
, ExpectedComment = 183
|
||||
, ExpectedCommentOrPI = 184
|
||||
, ExpectedWhitespace = 185
|
||||
, NoRootElemInDOCTYPE = 186
|
||||
, ExpectedQuotedString = 187
|
||||
, ExpectedPublicId = 188
|
||||
, InvalidPublicIdChar = 189
|
||||
, UnterminatedDOCTYPE = 190
|
||||
, InvalidCharacterInIntSubset = 191
|
||||
, UnexpectedWhitespace = 192
|
||||
, InvalidCharacterInAttrValue = 193
|
||||
, ExpectedMarkupDecl = 194
|
||||
, TextDeclNotLegalHere = 195
|
||||
, ConditionalSectInIntSubset = 196
|
||||
, ExpectedPEName = 197
|
||||
, UnterminatedEntityDecl = 198
|
||||
, InvalidCharacterRef = 199
|
||||
, UnterminatedCharRef = 200
|
||||
, ExpectedEntityRefName = 201
|
||||
, EntityNotFound = 202
|
||||
, NoUnparsedEntityRefs = 203
|
||||
, UnterminatedEntityRef = 204
|
||||
, RecursiveEntity = 205
|
||||
, PartialMarkupInEntity = 206
|
||||
, UnterminatedElementDecl = 207
|
||||
, ExpectedContentSpecExpr = 208
|
||||
, ExpectedAsterisk = 209
|
||||
, UnterminatedContentModel = 210
|
||||
, ExpectedSystemOrPublicId = 211
|
||||
, UnterminatedNotationDecl = 212
|
||||
, ExpectedSeqChoiceLeaf = 213
|
||||
, ExpectedChoiceOrCloseParen = 214
|
||||
, ExpectedSeqOrCloseParen = 215
|
||||
, ExpectedEnumValue = 216
|
||||
, ExpectedEnumSepOrParen = 217
|
||||
, UnterminatedEntityLiteral = 218
|
||||
, MoreEndThanStartTags = 219
|
||||
, ExpectedOpenParen = 220
|
||||
, AttrAlreadyUsedInSTag = 221
|
||||
, BracketInAttrValue = 222
|
||||
, Expected2ndSurrogateChar = 223
|
||||
, ExpectedEndOfConditional = 224
|
||||
, ExpectedIncOrIgn = 225
|
||||
, ExpectedINCLUDEBracket = 226
|
||||
, UnexpectedEOE = 227
|
||||
, PEPropogated = 228
|
||||
, ExtraCloseSquare = 229
|
||||
, PERefInMarkupInIntSubset = 230
|
||||
, EntityPropogated = 231
|
||||
, ExpectedNumericalCharRef = 232
|
||||
, ExpectedOpenSquareBracket = 233
|
||||
, BadSequenceInCharData = 234
|
||||
, IllegalSequenceInComment = 235
|
||||
, UnterminatedCDATASection = 236
|
||||
, ExpectedNDATA = 237
|
||||
, NDATANotValidForPE = 238
|
||||
, HexRadixMustBeLowerCase = 239
|
||||
, DeclStringRep = 240
|
||||
, DeclStringsInWrongOrder = 241
|
||||
, NoExtRefsInAttValue = 242
|
||||
, XMLDeclMustBeLowerCase = 243
|
||||
, ExpectedEntityValue = 244
|
||||
, BadDigitForRadix = 245
|
||||
, EndedWithTagsOnStack = 246
|
||||
, NestedCDATA = 247
|
||||
, UnknownPrefix = 248
|
||||
, PartialTagMarkupError = 249
|
||||
, EmptyMainEntity = 250
|
||||
, CDATAOutsideOfContent = 251
|
||||
, Unexpected2ndSurrogateChar = 252
|
||||
, NoPIStartsWithXML = 253
|
||||
, XMLDeclMustBeFirst = 254
|
||||
, XMLVersionRequired = 255
|
||||
, StandaloneNotLegal = 256
|
||||
, EncodingRequired = 257
|
||||
, ColonNotLegalWithNS = 258
|
||||
, XMLException_Fatal = 259
|
||||
, BadSchemaLocation = 260
|
||||
, SchemaScanFatalError = 261
|
||||
, IllegalRefInStandalone = 262
|
||||
, PEBetweenDecl = 263
|
||||
, NoEmptyStrNamespace = 264
|
||||
, NoUseOfxmlnsAsPrefix = 265
|
||||
, NoUseOfxmlnsURI = 266
|
||||
, PrefixXMLNotMatchXMLURI = 267
|
||||
, XMLURINotMatchXMLPrefix = 268
|
||||
, NoXMLNSAsElementPrefix = 269
|
||||
, CT_SimpleTypeChildRequired = 270
|
||||
, InvalidRootElemInDOCTYPE = 271
|
||||
, InvalidElementName = 272
|
||||
, InvalidAttrName = 273
|
||||
, InvalidEntityRefName = 274
|
||||
, DuplicateDocTypeDecl = 275
|
||||
, XIncludeOrphanFallback = 276
|
||||
, XIncludeNoHref = 277
|
||||
, XIncludeXPointerNotSupported = 278
|
||||
, XIncludeInvalidParseVal = 279
|
||||
, XIncludeMultipleFallbackElems = 280
|
||||
, XIncludeIncludeFailedNoFallback = 281
|
||||
, XIncludeCircularInclusionLoop = 282
|
||||
, XIncludeCircularInclusionDocIncludesSelf = 283
|
||||
, XIncludeDisallowedChild = 284
|
||||
, XIncludeConflictingNotation = 285
|
||||
, XIncludeConflictingEntity = 286
|
||||
, F_HighBounds = 287
|
||||
};
|
||||
|
||||
static bool isFatal(const XMLErrs::Codes toCheck)
|
||||
{
|
||||
return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
|
||||
}
|
||||
|
||||
static bool isWarning(const XMLErrs::Codes toCheck)
|
||||
{
|
||||
return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
|
||||
}
|
||||
|
||||
static bool isError(const XMLErrs::Codes toCheck)
|
||||
{
|
||||
return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
|
||||
}
|
||||
|
||||
static XMLErrorReporter::ErrTypes errorType(const XMLErrs::Codes toCheck)
|
||||
{
|
||||
if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
|
||||
return XMLErrorReporter::ErrType_Warning;
|
||||
else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
|
||||
return XMLErrorReporter::ErrType_Fatal;
|
||||
else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
|
||||
return XMLErrorReporter::ErrType_Error;
|
||||
return XMLErrorReporter::ErrTypes_Unknown;
|
||||
}
|
||||
static DOMError::ErrorSeverity DOMErrorType(const XMLErrs::Codes toCheck)
|
||||
{
|
||||
if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
|
||||
return DOMError::DOM_SEVERITY_WARNING;
|
||||
else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
|
||||
return DOMError::DOM_SEVERITY_FATAL_ERROR;
|
||||
else return DOMError::DOM_SEVERITY_ERROR;
|
||||
}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLErrs();
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLErrorReporter.hpp 672273 2008-06-27 13:57:00Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLERRORREPORTER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLERRORREPORTER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* This abstract class defines a callback mechanism for the scanner. By
|
||||
* creating a class that implements this interface and plugging an instance
|
||||
* of that class into the scanner, the scanner will call back on the object's
|
||||
* virtual methods to report error events. This class is also used with the
|
||||
* validator, to allow it to report errors.
|
||||
*
|
||||
* This class is primarily for use by those writing their own parser classes.
|
||||
* If you use the standard parser classes, DOMParser and SAXParser, you won't
|
||||
* use this API. You will instead use a similar mechanism defined by the SAX
|
||||
* API, called ErrorHandler.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLErrorReporter
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// The types of errors we can issue
|
||||
// -----------------------------------------------------------------------
|
||||
enum ErrTypes
|
||||
{
|
||||
ErrType_Warning
|
||||
, ErrType_Error
|
||||
, ErrType_Fatal
|
||||
|
||||
, ErrTypes_Unknown
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, only the virtual destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
*/
|
||||
virtual ~XMLErrorReporter()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The error handler interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Error Handler interface */
|
||||
//@{
|
||||
|
||||
/** Called to report errors from the scanner or validator
|
||||
*
|
||||
* This method is called back on by the scanner or validator (or any other
|
||||
* internal parser component which might need to report an error in the
|
||||
* future.) It contains all the information that the client code might
|
||||
* need to report or log the error.
|
||||
*
|
||||
* @param errCode The error code of the error being reported. What
|
||||
* this means is dependent on the domain it is from.
|
||||
*
|
||||
* @param errDomain The domain from which the error occured. The domain
|
||||
* is a means of providing a hierarchical layering to
|
||||
* the error system, so that a single set of error id
|
||||
* numbers don't have to be split up.
|
||||
*
|
||||
* @param type The error type, which is defined mostly by XML which
|
||||
* categorizes errors into warning, errors and validity
|
||||
* constraints.
|
||||
*
|
||||
* @param errorText The actual text of the error. This is translatable,
|
||||
* so can possibly be in the local language if a
|
||||
* translation has been provided.
|
||||
*
|
||||
* @param systemId The system id of the entity where the error occured,
|
||||
* fully qualified.
|
||||
*
|
||||
* @param publicId The optional public id of the entity were the error
|
||||
* occured. It can be an empty string if non was provided.
|
||||
*
|
||||
* @param lineNum The line number within the source XML of the error.
|
||||
*
|
||||
* @param colNum The column number within the source XML of the error.
|
||||
* Because of the parsing style, this is usually just
|
||||
* after the actual offending text.
|
||||
*/
|
||||
virtual void error
|
||||
(
|
||||
const unsigned int errCode
|
||||
, const XMLCh* const errDomain
|
||||
, const ErrTypes type
|
||||
, const XMLCh* const errorText
|
||||
, const XMLCh* const systemId
|
||||
, const XMLCh* const publicId
|
||||
, const XMLFileLoc lineNum
|
||||
, const XMLFileLoc colNum
|
||||
) = 0;
|
||||
|
||||
/** Called before a new parse event to allow the handler to reset
|
||||
*
|
||||
* This method is called by the scanner before a new parse event is
|
||||
* about to start. It gives the error handler a chance to reset its
|
||||
* internal state.
|
||||
*/
|
||||
virtual void resetErrors() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
XMLErrorReporter()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and destructor
|
||||
// -----------------------------------------------------------------------
|
||||
XMLErrorReporter(const XMLErrorReporter&);
|
||||
XMLErrorReporter& operator=(const XMLErrorReporter&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
538
project/jni/xerces/include/xercesc/framework/XMLFormatter.hpp
Normal file
538
project/jni/xerces/include/xercesc/framework/XMLFormatter.hpp
Normal file
@@ -0,0 +1,538 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLFormatter.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLFORMATTER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLFORMATTER_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLFormatTarget;
|
||||
class XMLTranscoder;
|
||||
|
||||
/**
|
||||
* This class provides the basic formatting capabilities that are required
|
||||
* to turn the Unicode based XML data from the parsers into a form that can
|
||||
* be used on non-Unicode based systems, that is, into local or generic text
|
||||
* encodings.
|
||||
*
|
||||
* A number of flags are provided to control whether various optional
|
||||
* formatting operations are performed.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLFormatter : public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Class types
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Public Constants */
|
||||
//@{
|
||||
/**
|
||||
* EscapeFlags - Different styles of escape flags to control various formatting.
|
||||
*
|
||||
* <p><code>NoEscapes:</code>
|
||||
* No character needs to be escaped. Just write them out as is.</p>
|
||||
* <p><code>StdEscapes:</code>
|
||||
* The following characters need to be escaped:</p>
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td>character</td>
|
||||
* <td>should be escaped and written as</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&amp;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&gt;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&quot;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'><</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&lt;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>'</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&apos;</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* <p><code>AttrEscapes:</code>
|
||||
* The following characters need to be escaped:</p>
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td>character</td>
|
||||
* <td>should be escaped and written as</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&amp;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&gt;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>"</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&quot;</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* <p><code>CharEscapes:</code>
|
||||
* The following characters need to be escaped:</p>
|
||||
* <table border='1'>
|
||||
* <tr>
|
||||
* <td>character</td>
|
||||
* <td>should be escaped and written as</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&</td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&amp;</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td valign='top' rowspan='1' colspan='1'>></td>
|
||||
* <td valign='top' rowspan='1' colspan='1'>&gt;</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* <p><code>EscapeFlags_Count:</code>
|
||||
* Special value, do not use directly.</p>
|
||||
* <p><code>DefaultEscape:</code>
|
||||
* Special value, do not use directly.</p>
|
||||
*
|
||||
*/
|
||||
enum EscapeFlags
|
||||
{
|
||||
NoEscapes
|
||||
, StdEscapes
|
||||
, AttrEscapes
|
||||
, CharEscapes
|
||||
|
||||
// Special values, don't use directly
|
||||
, EscapeFlags_Count
|
||||
, DefaultEscape = 999
|
||||
};
|
||||
|
||||
/**
|
||||
* UnRepFlags
|
||||
*
|
||||
* The unrepresentable flags that indicate how to react when a
|
||||
* character cannot be represented in the target encoding.
|
||||
*
|
||||
* <p><code>UnRep_Fail:</code>
|
||||
* Fail the operation.</p>
|
||||
* <p><code>UnRep_CharRef:</code>
|
||||
* Display the unrepresented character as reference.</p>
|
||||
* <p><code>UnRep_Replace:</code>
|
||||
* Replace the unrepresented character with the replacement character.</p>
|
||||
* <p><code>DefaultUnRep:</code>
|
||||
* Special value, do not use directly.</p>
|
||||
*
|
||||
*/
|
||||
enum UnRepFlags
|
||||
{
|
||||
UnRep_Fail
|
||||
, UnRep_CharRef
|
||||
, UnRep_Replace
|
||||
|
||||
, DefaultUnRep = 999
|
||||
};
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructor and Destructor */
|
||||
//@{
|
||||
/**
|
||||
* @param outEncoding the encoding for the formatted content.
|
||||
* @param docVersion the document version.
|
||||
* @param target the formatTarget where the formatted content is written to.
|
||||
* @param escapeFlags the escape style for certain character.
|
||||
* @param unrepFlags the reaction to unrepresentable character.
|
||||
* @param manager Pointer to the memory manager to be used to
|
||||
* allocate objects.
|
||||
*/
|
||||
XMLFormatter
|
||||
(
|
||||
const XMLCh* const outEncoding
|
||||
, const XMLCh* const docVersion
|
||||
, XMLFormatTarget* const target
|
||||
, const EscapeFlags escapeFlags = NoEscapes
|
||||
, const UnRepFlags unrepFlags = UnRep_Fail
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
XMLFormatter
|
||||
(
|
||||
const char* const outEncoding
|
||||
, const char* const docVersion
|
||||
, XMLFormatTarget* const target
|
||||
, const EscapeFlags escapeFlags = NoEscapes
|
||||
, const UnRepFlags unrepFlags = UnRep_Fail
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
XMLFormatter
|
||||
(
|
||||
const XMLCh* const outEncoding
|
||||
, XMLFormatTarget* const target
|
||||
, const EscapeFlags escapeFlags = NoEscapes
|
||||
, const UnRepFlags unrepFlags = UnRep_Fail
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
XMLFormatter
|
||||
(
|
||||
const char* const outEncoding
|
||||
, XMLFormatTarget* const target
|
||||
, const EscapeFlags escapeFlags = NoEscapes
|
||||
, const UnRepFlags unrepFlags = UnRep_Fail
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
~XMLFormatter();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Formatting methods
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Formatting methods */
|
||||
//@{
|
||||
/**
|
||||
* @param toFormat the string to be formatted
|
||||
* @param count length of the string
|
||||
* @param escapeFlags the escape style for formatting toFormat
|
||||
* @param unrepFlags the reaction for any unrepresentable character in toFormat
|
||||
*
|
||||
*/
|
||||
void formatBuf
|
||||
(
|
||||
const XMLCh* const toFormat
|
||||
, const XMLSize_t count
|
||||
, const EscapeFlags escapeFlags = DefaultEscape
|
||||
, const UnRepFlags unrepFlags = DefaultUnRep
|
||||
);
|
||||
|
||||
/**
|
||||
* @see formatBuf
|
||||
*/
|
||||
XMLFormatter& operator<<
|
||||
(
|
||||
const XMLCh* const toFormat
|
||||
);
|
||||
|
||||
XMLFormatter& operator<<
|
||||
(
|
||||
const XMLCh toFormat
|
||||
);
|
||||
|
||||
void writeBOM(const XMLByte* const toFormat
|
||||
, const XMLSize_t count);
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Getter methods */
|
||||
//@{
|
||||
/**
|
||||
* @return return the encoding set for the formatted content
|
||||
*/
|
||||
|
||||
const XMLCh* getEncodingName() const;
|
||||
|
||||
/**
|
||||
* @return return constant transcoder used internally for transcoding the formatter conent
|
||||
*/
|
||||
inline const XMLTranscoder* getTranscoder() const;
|
||||
|
||||
/**
|
||||
* @return return the transcoder used internally for transcoding the formatter content
|
||||
*/
|
||||
inline XMLTranscoder* getTranscoder();
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
/**
|
||||
* @param newFlags set the escape style for the follow-on formatted content
|
||||
*/
|
||||
void setEscapeFlags
|
||||
(
|
||||
const EscapeFlags newFlags
|
||||
);
|
||||
|
||||
/**
|
||||
* @param newFlags set the reaction for unrepresentable character
|
||||
*/
|
||||
void setUnRepFlags
|
||||
(
|
||||
const UnRepFlags newFlags
|
||||
);
|
||||
|
||||
/**
|
||||
* @param newFlags set the escape style for the follow-on formatted content
|
||||
* @see setEscapeFlags
|
||||
*/
|
||||
XMLFormatter& operator<<
|
||||
(
|
||||
const EscapeFlags newFlags
|
||||
);
|
||||
|
||||
/**
|
||||
* @param newFlags set the reaction for unrepresentable character
|
||||
* @see setUnRepFlags
|
||||
*/
|
||||
XMLFormatter& operator<<
|
||||
(
|
||||
const UnRepFlags newFlags
|
||||
);
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
/**
|
||||
* @return return the escape style for the formatted content
|
||||
*/
|
||||
EscapeFlags getEscapeFlags() const;
|
||||
|
||||
/**
|
||||
* @return return the reaction for unrepresentable character
|
||||
*/
|
||||
UnRepFlags getUnRepFlags() const;
|
||||
//@}
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLFormatter();
|
||||
XMLFormatter(const XMLFormatter&);
|
||||
XMLFormatter& operator=(const XMLFormatter&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private class constants
|
||||
// -----------------------------------------------------------------------
|
||||
enum Constants
|
||||
{
|
||||
kTmpBufSize = 16 * 1024
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
const XMLByte* getCharRef(XMLSize_t &count,
|
||||
XMLByte* &ref,
|
||||
const XMLCh * stdRef);
|
||||
|
||||
void writeCharRef(const XMLCh &toWrite);
|
||||
void writeCharRef(XMLSize_t toWrite);
|
||||
|
||||
bool inEscapeList(const XMLFormatter::EscapeFlags escStyle
|
||||
, const XMLCh toCheck);
|
||||
|
||||
|
||||
XMLSize_t handleUnEscapedChars(const XMLCh * srcPtr,
|
||||
const XMLSize_t count,
|
||||
const UnRepFlags unrepFlags);
|
||||
|
||||
void specialFormat
|
||||
(
|
||||
const XMLCh* const toFormat
|
||||
, const XMLSize_t count
|
||||
, const EscapeFlags escapeFlags
|
||||
);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private, non-virtual methods
|
||||
//
|
||||
// fEscapeFlags
|
||||
// The escape flags we were told to use in formatting. These are
|
||||
// defaults set in the ctor, which can be overridden on a particular
|
||||
// call.
|
||||
//
|
||||
// fOutEncoding
|
||||
// This the name of the output encoding. Saved mainly for meaningful
|
||||
// error messages.
|
||||
//
|
||||
// fTarget
|
||||
// This is the target object for the formatting operation.
|
||||
//
|
||||
// fUnRepFlags
|
||||
// The unrepresentable flags that indicate how to react when a
|
||||
// character cannot be represented in the target encoding.
|
||||
//
|
||||
// fXCoder
|
||||
// This the transcoder that we will use. It is created using the
|
||||
// encoding name we were told to use.
|
||||
//
|
||||
// fTmpBuf
|
||||
// An output buffer that we use to transcode chars into before we
|
||||
// send them off to be output.
|
||||
//
|
||||
// fAposRef
|
||||
// fAmpRef
|
||||
// fGTRef
|
||||
// fLTRef
|
||||
// fQuoteRef
|
||||
// These are character refs for the standard char refs, in the
|
||||
// output encoding. They are faulted in as required, by transcoding
|
||||
// them from fixed Unicode versions.
|
||||
//
|
||||
// fIsXML11
|
||||
// for performance reason, we do not store the actual version string
|
||||
// and do the string comparison again and again.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
EscapeFlags fEscapeFlags;
|
||||
XMLCh* fOutEncoding;
|
||||
XMLFormatTarget* fTarget;
|
||||
UnRepFlags fUnRepFlags;
|
||||
XMLTranscoder* fXCoder;
|
||||
XMLByte fTmpBuf[kTmpBufSize + 4];
|
||||
XMLByte* fAposRef;
|
||||
XMLSize_t fAposLen;
|
||||
XMLByte* fAmpRef;
|
||||
XMLSize_t fAmpLen;
|
||||
XMLByte* fGTRef;
|
||||
XMLSize_t fGTLen;
|
||||
XMLByte* fLTRef;
|
||||
XMLSize_t fLTLen;
|
||||
XMLByte* fQuoteRef;
|
||||
XMLSize_t fQuoteLen;
|
||||
bool fIsXML11;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
class XMLPARSER_EXPORT XMLFormatTarget : public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
virtual ~XMLFormatTarget() {}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual interface
|
||||
// -----------------------------------------------------------------------
|
||||
virtual void writeChars
|
||||
(
|
||||
const XMLByte* const toWrite
|
||||
, const XMLSize_t count
|
||||
, XMLFormatter* const formatter
|
||||
) = 0;
|
||||
|
||||
virtual void flush() {};
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLFormatTarget() {};
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLFormatTarget(const XMLFormatTarget&);
|
||||
XMLFormatTarget& operator=(const XMLFormatTarget&);
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLFormatter: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline const XMLCh* XMLFormatter::getEncodingName() const
|
||||
{
|
||||
return fOutEncoding;
|
||||
}
|
||||
|
||||
inline const XMLTranscoder* XMLFormatter::getTranscoder() const
|
||||
{
|
||||
return fXCoder;
|
||||
}
|
||||
|
||||
inline XMLTranscoder* XMLFormatter::getTranscoder()
|
||||
{
|
||||
return fXCoder;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLFormatter: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void XMLFormatter::setEscapeFlags(const EscapeFlags newFlags)
|
||||
{
|
||||
fEscapeFlags = newFlags;
|
||||
}
|
||||
|
||||
inline void XMLFormatter::setUnRepFlags(const UnRepFlags newFlags)
|
||||
{
|
||||
fUnRepFlags = newFlags;
|
||||
}
|
||||
|
||||
|
||||
inline XMLFormatter& XMLFormatter::operator<<(const EscapeFlags newFlags)
|
||||
{
|
||||
fEscapeFlags = newFlags;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline XMLFormatter& XMLFormatter::operator<<(const UnRepFlags newFlags)
|
||||
{
|
||||
fUnRepFlags = newFlags;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLFormatter: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLFormatter::EscapeFlags XMLFormatter::getEscapeFlags() const
|
||||
{
|
||||
return fEscapeFlags;
|
||||
}
|
||||
|
||||
inline XMLFormatter::UnRepFlags XMLFormatter::getUnRepFlags() const
|
||||
{
|
||||
return fUnRepFlags;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLGrammarDescription.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLGRAMMARDESCRIPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLGRAMMARDESCRIPTION_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/validators/common/Grammar.hpp>
|
||||
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLPARSER_EXPORT XMLGrammarDescription : public XSerializable, public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual destructor for derived classes */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* virtual destructor
|
||||
*
|
||||
*/
|
||||
virtual ~XMLGrammarDescription();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The Grammar Description Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* getGrammarType
|
||||
*
|
||||
*/
|
||||
virtual Grammar::GrammarType getGrammarType() const = 0;
|
||||
|
||||
/**
|
||||
* getGrammarKey
|
||||
*
|
||||
*/
|
||||
virtual const XMLCh* getGrammarKey() const = 0;
|
||||
//@}
|
||||
|
||||
inline MemoryManager* getMemoryManager() const;
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLGrammarDescription)
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
/** Hidden Constructors */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLGrammarDescription(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager);
|
||||
//@}
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
/** name Unimplemented copy constructor and operator= */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLGrammarDescription(const XMLGrammarDescription& );
|
||||
XMLGrammarDescription& operator=(const XMLGrammarDescription& );
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
// fMemMgr: plugged-in (or defaulted-in) memory manager,
|
||||
// not owned
|
||||
// no reset after initialization
|
||||
// allow derivatives to access directly
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
MemoryManager* const fMemMgr;
|
||||
};
|
||||
|
||||
inline MemoryManager* XMLGrammarDescription::getMemoryManager() const
|
||||
{
|
||||
return fMemMgr;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
322
project/jni/xerces/include/xercesc/framework/XMLGrammarPool.hpp
Normal file
322
project/jni/xerces/include/xercesc/framework/XMLGrammarPool.hpp
Normal file
@@ -0,0 +1,322 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLGrammarPool.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOL_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/RefHashTableOf.hpp>
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/framework/psvi/XSModel.hpp>
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class Grammar;
|
||||
class XMLGrammarDescription;
|
||||
class DTDGrammar;
|
||||
class SchemaGrammar;
|
||||
class XMLDTDDescription;
|
||||
class XMLSchemaDescription;
|
||||
class XMLStringPool;
|
||||
class BinInputStream;
|
||||
class BinOutputStream;
|
||||
|
||||
class XMLPARSER_EXPORT XMLGrammarPool : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual destructor for derived classes */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* virtual destructor
|
||||
*
|
||||
*/
|
||||
virtual ~XMLGrammarPool(){};
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The Grammar Pool Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* cacheGrammar
|
||||
*
|
||||
* Provide the grammar pool with an opportunity
|
||||
* to cache the given grammar. If the pool does not choose to do so,
|
||||
* it should return false; otherwise, it should return true, so that
|
||||
* the caller knows whether the grammar has been adopted.
|
||||
*
|
||||
* @param gramToCache the Grammar to be cached in the grammar pool
|
||||
* @return true if the grammar pool has elected to cache the grammar (in which case
|
||||
* it is assumed to have adopted it); false if it does not cache it
|
||||
*
|
||||
*/
|
||||
virtual bool cacheGrammar(Grammar* const gramToCache) = 0;
|
||||
|
||||
/**
|
||||
* retrieveGrammar
|
||||
*
|
||||
* @param gramDesc the Grammar Description used to search for grammar
|
||||
* cached in the grammar pool
|
||||
*
|
||||
*/
|
||||
virtual Grammar* retrieveGrammar(XMLGrammarDescription* const gramDesc) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* orphanGrammar
|
||||
*
|
||||
* grammar removed from the grammar pool and owned by the caller
|
||||
*
|
||||
* @param nameSpaceKey Key used to search for grammar in the grammar pool
|
||||
* @return the grammar that was removed from the pool (0 if none)
|
||||
*/
|
||||
virtual Grammar* orphanGrammar(const XMLCh* const nameSpaceKey) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get an enumeration of the cached Grammars in the Grammar pool
|
||||
*
|
||||
* @return enumeration of the cached Grammars in Grammar pool
|
||||
*/
|
||||
virtual RefHashTableOfEnumerator<Grammar> getGrammarEnumerator() const = 0;
|
||||
|
||||
/**
|
||||
* clear
|
||||
*
|
||||
* all grammars are removed from the grammar pool and deleted.
|
||||
* @return true if the grammar pool was cleared. false if it did not.
|
||||
*/
|
||||
virtual bool clear() = 0;
|
||||
|
||||
/**
|
||||
* lockPool
|
||||
*
|
||||
* When this method is called by the application, the
|
||||
* grammar pool should stop adding new grammars to the cache.
|
||||
* This should result in the grammar pool being sharable
|
||||
* among parsers operating in different threads.
|
||||
*
|
||||
*/
|
||||
virtual void lockPool() = 0;
|
||||
|
||||
/**
|
||||
* unlockPool
|
||||
*
|
||||
* After this method has been called, the grammar pool implementation
|
||||
* should return to its default behaviour when cacheGrammars(...) is called.
|
||||
* One effect, depending on the underlying implementation, is that the grammar pool
|
||||
* may no longer be thread-safe (even on read operations).
|
||||
*
|
||||
* For PSVI support any previous XSModel that was produced will be deleted.
|
||||
*/
|
||||
virtual void unlockPool() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Factory interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* createDTDGrammar
|
||||
*
|
||||
*/
|
||||
virtual DTDGrammar* createDTDGrammar() = 0;
|
||||
|
||||
/**
|
||||
* createSchemaGrammar
|
||||
*
|
||||
*/
|
||||
virtual SchemaGrammar* createSchemaGrammar() = 0;
|
||||
|
||||
/**
|
||||
* createDTDDescription
|
||||
*
|
||||
*/
|
||||
virtual XMLDTDDescription* createDTDDescription(const XMLCh* const systemId) = 0;
|
||||
/**
|
||||
* createSchemaDescription
|
||||
*
|
||||
*/
|
||||
virtual XMLSchemaDescription* createSchemaDescription(const XMLCh* const targetNamespace) = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name schema component model support */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/***
|
||||
* Return an XSModel derived from the components of all SchemaGrammars
|
||||
* in the grammar pool. If the pool is locked, this should
|
||||
* be a thread-safe operation.
|
||||
*
|
||||
* NOTE: The function should NEVER return NULL. If there are no grammars in
|
||||
* the pool it should return an XSModel containing the Schema for Schema.
|
||||
*
|
||||
* Calling getXSModel() on an unlocked grammar pool may result in the
|
||||
* creation of a new XSModel with the old XSModel being deleted.
|
||||
* The bool parameter will indicate if the XSModel was changed.
|
||||
*
|
||||
*/
|
||||
virtual XSModel *getXSModel(bool& XSModelWasChanged) = 0;
|
||||
|
||||
// @}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Getter */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* getMemoryManager
|
||||
*
|
||||
*/
|
||||
inline MemoryManager* getMemoryManager()
|
||||
{
|
||||
return fMemMgr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an XMLStringPool for use by validation routines.
|
||||
* Implementations should not create a string pool on each call to this
|
||||
* method, but should maintain one string pool for all grammars
|
||||
* for which this pool is responsible.
|
||||
*/
|
||||
virtual XMLStringPool *getURIStringPool() = 0;
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** serialization and deserialization support */
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/***
|
||||
*
|
||||
* 1. Context: Serialize/Deserialize All Grammars In One Session
|
||||
*
|
||||
* Since it is common that a declaration in one grammar may reference
|
||||
* to definitions in other grammars, it is required to serialize those
|
||||
* related (or interdependent) grammars in to one persistent data store
|
||||
* in one serialization session (storing), and deserialize them from the
|
||||
* persistent data store in one deserialization session (loading) back
|
||||
* to the grammar pool.
|
||||
*
|
||||
* 2. Multiple serializations
|
||||
*
|
||||
* It is acceptable that client application requests more than one
|
||||
* grammar serialization on a particular grammar pool, to track the
|
||||
* different grammars cached, or for whatever reasons that client
|
||||
* application is interested in.
|
||||
*
|
||||
* 3. Multiple deserializations
|
||||
*
|
||||
* Request for grammar deserialization either after the grammar pool has
|
||||
* its own cached grammars, or request for more than one grammar
|
||||
* deserialization, may cause undesired and unpredictable consequence
|
||||
* and therefore client application shall be aware that individual
|
||||
* implementationis may NOT support this.
|
||||
*
|
||||
* However it is strongly recommended that the client application requests
|
||||
* no more than one grammar deserialization even a particular implementation
|
||||
* may allow multiple deserializations.
|
||||
*
|
||||
* 4. Locking
|
||||
*
|
||||
* Both serialization and deserialization requires to lock the grammar pool
|
||||
* before operation and unlock after operation. In the case the grammar pool
|
||||
* is locked by a third party, the request for serialization/deserialization
|
||||
* will NOT be entertained.
|
||||
*
|
||||
* 5. Versioning
|
||||
*
|
||||
* The Persistent data store has a version tag to be verified during
|
||||
* deserialization, thus a grammar pool may decide if it supports
|
||||
* a binary data created by a different release of Xerces.
|
||||
*
|
||||
* 6. Clean up
|
||||
*
|
||||
* The client application shall be aware that in the event of an exception
|
||||
* thrown due to a corrupted data store during deserialization, implementation
|
||||
* may not be able to clean up all resources allocated, and therefore it is
|
||||
* client application's responsibility to clean up those unreleased resources.
|
||||
*
|
||||
*
|
||||
*/
|
||||
virtual void serializeGrammars(BinOutputStream* const) = 0;
|
||||
virtual void deserializeGrammars(BinInputStream* const) = 0;
|
||||
|
||||
/*
|
||||
* Set/get a flag to not create XSAnnotations when deserializing the grammar.
|
||||
* Defaults to false (create XSAnnotations when deserializing the grammar).
|
||||
*/
|
||||
inline void setIgnoreSerializedAnnotations(const bool flag)
|
||||
{
|
||||
fIgnoreSerializedAnnotations = flag;
|
||||
};
|
||||
inline bool getIgnoreSerializedAnnotations() const
|
||||
{
|
||||
return fIgnoreSerializedAnnotations;
|
||||
};
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
/** Hidden Constructors */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLGrammarPool(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager)
|
||||
:fMemMgr(memMgr)
|
||||
,fIgnoreSerializedAnnotations(false)
|
||||
{
|
||||
};
|
||||
//@}
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
/** name Unimplemented copy constructor and operator= */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLGrammarPool(const XMLGrammarPool& );
|
||||
XMLGrammarPool& operator=(const XMLGrammarPool& );
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
// fMemMgr: plugged-in (or defaulted-in) memory manager
|
||||
// not owned
|
||||
// no reset after initialization
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
MemoryManager* const fMemMgr;
|
||||
bool fIgnoreSerializedAnnotations;
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLGrammarPoolImpl.hpp 671531 2008-06-25 12:38:28Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOLIMPL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOLIMPL_HPP
|
||||
|
||||
#include <xercesc/framework/XMLGrammarPool.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLSynchronizedStringPool;
|
||||
|
||||
class XMLUTIL_EXPORT XMLGrammarPoolImpl : public XMLGrammarPool
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name constructor and destructor */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
XMLGrammarPoolImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
~XMLGrammarPoolImpl();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Implementation of Grammar Pool Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* cacheGrammar
|
||||
*
|
||||
* Provide the grammar pool with an opportunity
|
||||
* to cache the given grammar. If the pool does not choose to do so,
|
||||
* it should return false; otherwise, it should return true, so that
|
||||
* the caller knows whether the grammar has been adopted.
|
||||
*
|
||||
* @param gramToCache: the Grammar to be cached in the grammar pool
|
||||
* @return true if the grammar pool has elected to cache the grammar (in which case
|
||||
* it is assumed to have adopted it); false if it does not cache it
|
||||
*
|
||||
*/
|
||||
virtual bool cacheGrammar(Grammar* const gramToCache);
|
||||
|
||||
|
||||
/**
|
||||
* retrieveGrammar
|
||||
*
|
||||
* @param gramDesc: the Grammar Description used to search for grammar
|
||||
* cached in the grammar pool
|
||||
*
|
||||
*/
|
||||
virtual Grammar* retrieveGrammar(XMLGrammarDescription* const gramDesc);
|
||||
|
||||
|
||||
/**
|
||||
* orphanGrammar
|
||||
*
|
||||
* grammar removed from the grammar pool and owned by the caller
|
||||
*
|
||||
* @param nameSpaceKey: Key used to search for grammar in the grammar pool
|
||||
*
|
||||
*/
|
||||
virtual Grammar* orphanGrammar(const XMLCh* const nameSpaceKey);
|
||||
|
||||
|
||||
/**
|
||||
* Get an enumeration of the cached Grammars in the Grammar pool
|
||||
*
|
||||
* @return enumeration of the cached Grammars in Grammar pool
|
||||
*/
|
||||
virtual RefHashTableOfEnumerator<Grammar> getGrammarEnumerator() const;
|
||||
|
||||
/**
|
||||
* clear
|
||||
*
|
||||
* all grammars are removed from the grammar pool and deleted.
|
||||
* @return true if the grammar pool was cleared. false if it did not.
|
||||
*/
|
||||
virtual bool clear();
|
||||
|
||||
/**
|
||||
* lockPool
|
||||
*
|
||||
* When this method is called by the application, the
|
||||
* grammar pool should stop adding new grammars to the cache.
|
||||
*/
|
||||
virtual void lockPool();
|
||||
|
||||
/**
|
||||
* unlockPool
|
||||
*
|
||||
* After this method has been called, the grammar pool implementation
|
||||
* should return to its default behaviour when cacheGrammars(...) is called.
|
||||
*
|
||||
* For PSVI support any previous XSModel that was produced will be deleted.
|
||||
*/
|
||||
virtual void unlockPool();
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Implementation of Factory interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* createDTDGrammar
|
||||
*
|
||||
*/
|
||||
virtual DTDGrammar* createDTDGrammar();
|
||||
|
||||
/**
|
||||
* createSchemaGrammar
|
||||
*
|
||||
*/
|
||||
virtual SchemaGrammar* createSchemaGrammar();
|
||||
|
||||
/**
|
||||
* createDTDDescription
|
||||
*
|
||||
*/
|
||||
virtual XMLDTDDescription* createDTDDescription(const XMLCh* const systemId);
|
||||
/**
|
||||
* createSchemaDescription
|
||||
*
|
||||
*/
|
||||
virtual XMLSchemaDescription* createSchemaDescription(const XMLCh* const targetNamespace);
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name schema component model support */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/***
|
||||
* Return an XSModel derived from the components of all SchemaGrammars
|
||||
* in the grammar pool. If the pool is locked, this should
|
||||
* be a thread-safe operation.
|
||||
*
|
||||
* NOTE: The function should NEVER return NULL. If there are no grammars in
|
||||
* the pool it should return an XSModel containing the Schema for Schema.
|
||||
*
|
||||
* Calling getXSModel() on an unlocked grammar pool may result in the
|
||||
* creation of a new XSModel with the old XSModel being deleted.
|
||||
* The bool parameter will indicate if the XSModel was changed.
|
||||
*
|
||||
* In this implementation, when the pool is not locked a new XSModel will be
|
||||
* computed each this time the pool is called if the pool has changed (and the
|
||||
* previous one will be destroyed at that time). When the lockPool()
|
||||
* method is called, an XSModel will be generated and returned whenever this method is called
|
||||
* while the pool is in the locked state. This will be destroyed if the unlockPool()
|
||||
* operation is called. The XSModel will not be serialized,
|
||||
* but will be recreated if a deserialized pool is in the
|
||||
* locked state.
|
||||
*
|
||||
*/
|
||||
virtual XSModel *getXSModel(bool& XSModelWasChanged);
|
||||
|
||||
// @}
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Getter */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Return an XMLStringPool for use by validation routines.
|
||||
* Implementations should not create a string pool on each call to this
|
||||
* method, but should maintain one string pool for all grammars
|
||||
* for which this pool is responsible.
|
||||
*/
|
||||
virtual XMLStringPool *getURIStringPool();
|
||||
|
||||
// @}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// serialization and deserialization support
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/***
|
||||
*
|
||||
* Multiple serializations
|
||||
*
|
||||
* For multiple serializations, if the same file name is given, then the
|
||||
* last result will be in the file (overwriting mode), if different file
|
||||
* names are given, then there are multiple data stores for each serialization.
|
||||
*
|
||||
* Multiple deserializations
|
||||
*
|
||||
* Not supported
|
||||
*
|
||||
* Versioning
|
||||
*
|
||||
* Only binary data serialized with the current XercesC Version and
|
||||
* SerializationLevel is supported.
|
||||
*
|
||||
* Clean up
|
||||
*
|
||||
* In the event of an exception thrown due to a corrupted data store during
|
||||
* deserialization, this implementation may not be able to clean up all resources
|
||||
* allocated, and therefore it is the client application's responsibility to
|
||||
* clean up those unreleased resources.
|
||||
*
|
||||
* Coupling of Grammars and StringPool
|
||||
*
|
||||
* This implementation assumes that StringPool shall always be
|
||||
* serialized/deserialized together with the grammars. In the case that such a
|
||||
* coupling is not desired, client application can modify this behaviour by
|
||||
* either derivate from this imlementation and overwrite the serializeGrammars()
|
||||
* and/or deserializeGrammars() to decouple grammars and string pool, or
|
||||
* Once deserializeGrammars() is done, insert another StringPool through
|
||||
* setStringPool().
|
||||
*
|
||||
* Client application shall be aware of the unpredicatable/undefined consequence
|
||||
* of this decoupling.
|
||||
*/
|
||||
|
||||
virtual void serializeGrammars(BinOutputStream* const);
|
||||
virtual void deserializeGrammars(BinInputStream* const);
|
||||
|
||||
private:
|
||||
|
||||
virtual void createXSModel();
|
||||
|
||||
void
|
||||
cleanUp();
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** name Unimplemented copy constructor and operator= */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLGrammarPoolImpl(const XMLGrammarPoolImpl& );
|
||||
XMLGrammarPoolImpl& operator=(const XMLGrammarPoolImpl& );
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
// fGrammarRegistry:
|
||||
//
|
||||
// container
|
||||
// fStringPool
|
||||
// grammars need a string pool for URI -> int mappings
|
||||
// fSynchronizedStringPool
|
||||
// When the grammar pool is locked, provide a string pool
|
||||
// that can be updated in a thread-safe manner.
|
||||
// fLocked
|
||||
// whether the pool has been locked
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
RefHashTableOf<Grammar>* fGrammarRegistry;
|
||||
XMLStringPool* fStringPool;
|
||||
XMLSynchronizedStringPool* fSynchronizedStringPool;
|
||||
XSModel* fXSModel;
|
||||
bool fLocked;
|
||||
bool fXSModelIsValid;
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
231
project/jni/xerces/include/xercesc/framework/XMLNotationDecl.hpp
Normal file
231
project/jni/xerces/include/xercesc/framework/XMLNotationDecl.hpp
Normal file
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLNotationDecl.hpp 676911 2008-07-15 13:27:32Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class represents the core information about a notation declaration
|
||||
* that all validators must at least support. Each validator will create a
|
||||
* derivative of this class which adds any information it requires for its
|
||||
* own extra needs.
|
||||
*
|
||||
* At this common level, the information supported is the notation name
|
||||
* and the public and sysetm ids indicated in the notation declaration.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
XMLNotationDecl
|
||||
(
|
||||
const XMLCh* const notName
|
||||
, const XMLCh* const pubId
|
||||
, const XMLCh* const sysId
|
||||
, const XMLCh* const baseURI = 0
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XMLNotationDecl();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t getId() const;
|
||||
const XMLCh* getName() const;
|
||||
const XMLCh* getPublicId() const;
|
||||
const XMLCh* getSystemId() const;
|
||||
const XMLCh* getBaseURI() const;
|
||||
unsigned int getNameSpaceId() const;
|
||||
MemoryManager* getMemoryManager() const;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
void setId(const XMLSize_t newId);
|
||||
void setName
|
||||
(
|
||||
const XMLCh* const notName
|
||||
);
|
||||
void setPublicId(const XMLCh* const newId);
|
||||
void setSystemId(const XMLCh* const newId);
|
||||
void setBaseURI(const XMLCh* const newId);
|
||||
void setNameSpaceId(const unsigned int newId);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Support named collection element semantics
|
||||
// -----------------------------------------------------------------------
|
||||
const XMLCh* getKey() const;
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLNotationDecl)
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLNotationDecl(const XMLNotationDecl&);
|
||||
XMLNotationDecl& operator=(const XMLNotationDecl&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// XMLNotationDecl: Private helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
void cleanUp();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fId
|
||||
// This is the unique id given to this notation decl.
|
||||
//
|
||||
// fName
|
||||
// The notation's name, which identifies the type of notation it
|
||||
// applies to.
|
||||
//
|
||||
// fPublicId
|
||||
// The text of the notation's public id, if any.
|
||||
//
|
||||
// fSystemId
|
||||
// The text of the notation's system id, if any.
|
||||
//
|
||||
// fBaseURI
|
||||
// The text of the notation's base URI
|
||||
// -----------------------------------------------------------------------
|
||||
XMLSize_t fId;
|
||||
unsigned int fNameSpaceId;
|
||||
XMLCh* fName;
|
||||
XMLCh* fPublicId;
|
||||
XMLCh* fSystemId;
|
||||
XMLCh* fBaseURI;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
inline XMLSize_t XMLNotationDecl::getId() const
|
||||
{
|
||||
return fId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLNotationDecl::getName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
inline unsigned int XMLNotationDecl::getNameSpaceId() const
|
||||
{
|
||||
return fNameSpaceId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLNotationDecl::getPublicId() const
|
||||
{
|
||||
return fPublicId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLNotationDecl::getSystemId() const
|
||||
{
|
||||
return fSystemId;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLNotationDecl::getBaseURI() const
|
||||
{
|
||||
return fBaseURI;
|
||||
}
|
||||
|
||||
inline MemoryManager* XMLNotationDecl::getMemoryManager() const
|
||||
{
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
inline void XMLNotationDecl::setId(const XMLSize_t newId)
|
||||
{
|
||||
fId = newId;
|
||||
}
|
||||
|
||||
inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
|
||||
{
|
||||
fNameSpaceId = newId;
|
||||
}
|
||||
|
||||
inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
|
||||
{
|
||||
if (fPublicId)
|
||||
fMemoryManager->deallocate(fPublicId);
|
||||
|
||||
fPublicId = XMLString::replicate(newId, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
|
||||
{
|
||||
if (fSystemId)
|
||||
fMemoryManager->deallocate(fSystemId);
|
||||
|
||||
fSystemId = XMLString::replicate(newId, fMemoryManager);
|
||||
}
|
||||
|
||||
inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
|
||||
{
|
||||
if (fBaseURI)
|
||||
fMemoryManager->deallocate(fBaseURI);
|
||||
|
||||
fBaseURI = XMLString::replicate(newId, fMemoryManager);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLNotationDecl: Support named pool element semantics
|
||||
// ---------------------------------------------------------------------------
|
||||
inline const XMLCh* XMLNotationDecl::getKey() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
151
project/jni/xerces/include/xercesc/framework/XMLPScanToken.hpp
Normal file
151
project/jni/xerces/include/xercesc/framework/XMLPScanToken.hpp
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLPScanToken.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLScanner;
|
||||
|
||||
/**
|
||||
* This simple class is used as a sanity check when the scanner is used to
|
||||
* do progressive parsing. It insures that things are not done out of
|
||||
* sequence and that sequences of scan calls are made correctly to the
|
||||
* right scanner instances.
|
||||
*
|
||||
* To client code, it is just a magic cookie which is obtained when a
|
||||
* progressive parse is begun, and which is passed back in on each subsequent
|
||||
* call of the progressive parse.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLPScanToken : public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
XMLPScanToken();
|
||||
XMLPScanToken(const XMLPScanToken& toCopy);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XMLPScanToken();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Public operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLPScanToken& operator=(const XMLPScanToken& toCopy);
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// XMLScanner is our friend, can you say friend? Sure...
|
||||
// -----------------------------------------------------------------------
|
||||
friend class XMLScanner;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden methods for use by XMLScanner
|
||||
// -----------------------------------------------------------------------
|
||||
void set
|
||||
(
|
||||
const XMLUInt32 scannerId
|
||||
, const XMLUInt32 sequenceId
|
||||
);
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fScannerId
|
||||
// This field is set to the id of the scanner, to catch problems
|
||||
// where a token is gotten from one scanner and passed to another.
|
||||
// Each scanner is assigned an incrementing id.
|
||||
//
|
||||
// fSequenceId
|
||||
// In order to avoid problems such as calling scanNext() without
|
||||
// a call to scanFirst() and such, this value is set when scanFirst()
|
||||
// is called and matches this token to the current sequence id of
|
||||
// the scanner.
|
||||
// -----------------------------------------------------------------------
|
||||
XMLUInt32 fScannerId;
|
||||
XMLUInt32 fSequenceId;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLPScanToken: Constructors and Operators
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLPScanToken::XMLPScanToken() :
|
||||
|
||||
fScannerId(0)
|
||||
, fSequenceId(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline XMLPScanToken::XMLPScanToken(const XMLPScanToken& toCopy) :
|
||||
XMemory(toCopy)
|
||||
, fScannerId(toCopy.fScannerId)
|
||||
, fSequenceId(toCopy.fSequenceId)
|
||||
{
|
||||
}
|
||||
|
||||
inline XMLPScanToken::~XMLPScanToken()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLPScanToken: Public operators
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLPScanToken& XMLPScanToken::operator=(const XMLPScanToken& toCopy)
|
||||
{
|
||||
if (this == &toCopy)
|
||||
return *this;
|
||||
|
||||
fScannerId = toCopy.fScannerId;
|
||||
fSequenceId = toCopy.fSequenceId;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLPScanToken: Hidden methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void XMLPScanToken::set( const XMLUInt32 scannerId
|
||||
, const XMLUInt32 sequenceId)
|
||||
{
|
||||
fScannerId = scannerId;
|
||||
fSequenceId = sequenceId;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
138
project/jni/xerces/include/xercesc/framework/XMLRecognizer.hpp
Normal file
138
project/jni/xerces/include/xercesc/framework/XMLRecognizer.hpp
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLRecognizer.hpp 555320 2007-07-11 16:05:13Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLRECOGNIZER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLRECOGNIZER_HPP
|
||||
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides some simple code to recognize the encodings of
|
||||
* XML files. This recognition only does very basic sensing of the encoding
|
||||
* in a broad sense. Basically its just enough to let us get started and
|
||||
* read the XMLDecl line. The scanner, once it reads the XMLDecl, will
|
||||
* tell the reader any actual encoding string it found and the reader can
|
||||
* update itself to be more specific at that point.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLRecognizer
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Class types
|
||||
//
|
||||
// This enum represents the various encoding families that we have to
|
||||
// deal with individually at the scanner level. This does not indicate
|
||||
// the exact encoding, just the rough family that would let us scan
|
||||
// the XML/TextDecl to find the encoding string.
|
||||
//
|
||||
// The 'L's and 'B's stand for little or big endian.
|
||||
//
|
||||
// OtherEncoding means that its some transcoder based encoding, i.e. not
|
||||
// one of the ones that we do internally. Its a special case and should
|
||||
// never be used directly outside of the reader.
|
||||
//
|
||||
// NOTE: Keep this in sync with the name map array in the Cpp file!!
|
||||
// -----------------------------------------------------------------------
|
||||
enum Encodings
|
||||
{
|
||||
EBCDIC = 0
|
||||
, UCS_4B = 1
|
||||
, UCS_4L = 2
|
||||
, US_ASCII = 3
|
||||
, UTF_8 = 4
|
||||
, UTF_16B = 5
|
||||
, UTF_16L = 6
|
||||
, XERCES_XMLCH = 7
|
||||
|
||||
, Encodings_Count
|
||||
, Encodings_Min = EBCDIC
|
||||
, Encodings_Max = XERCES_XMLCH
|
||||
|
||||
, OtherEncoding = 999
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Public, const static data
|
||||
//
|
||||
// These are the byte sequences for each of the encodings that we can
|
||||
// auto sense, and their lengths.
|
||||
// -----------------------------------------------------------------------
|
||||
static const char fgASCIIPre[];
|
||||
static const XMLSize_t fgASCIIPreLen;
|
||||
static const XMLByte fgEBCDICPre[];
|
||||
static const XMLSize_t fgEBCDICPreLen;
|
||||
static const XMLByte fgUTF16BPre[];
|
||||
static const XMLByte fgUTF16LPre[];
|
||||
static const XMLSize_t fgUTF16PreLen;
|
||||
static const XMLByte fgUCS4BPre[];
|
||||
static const XMLByte fgUCS4LPre[];
|
||||
static const XMLSize_t fgUCS4PreLen;
|
||||
static const char fgUTF8BOM[];
|
||||
static const XMLSize_t fgUTF8BOMLen;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Encoding recognition methods
|
||||
// -----------------------------------------------------------------------
|
||||
static Encodings basicEncodingProbe
|
||||
(
|
||||
const XMLByte* const rawBuffer
|
||||
, const XMLSize_t rawByteCount
|
||||
);
|
||||
|
||||
static Encodings encodingForName
|
||||
(
|
||||
const XMLCh* const theEncName
|
||||
);
|
||||
|
||||
static const XMLCh* nameForEncoding(const Encodings theEncoding
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors, operators, and destructor
|
||||
//
|
||||
// This class is effectively being used as a namespace for some static
|
||||
// methods.
|
||||
//
|
||||
// (these functions are protected rather than private only to get rid of
|
||||
// some annoying compiler warnings.)
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
XMLRecognizer();
|
||||
~XMLRecognizer();
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLRecognizer(const XMLRecognizer&);
|
||||
XMLRecognizer& operator=(const XMLRecognizer&);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
181
project/jni/xerces/include/xercesc/framework/XMLRefInfo.hpp
Normal file
181
project/jni/xerces/include/xercesc/framework/XMLRefInfo.hpp
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLRefInfo.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLREFINFO_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLREFINFO_HPP
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a simple means to track ID Ref usage. Since id/idref
|
||||
* semantics are part of XML 1.0, any validator will likely to be able to
|
||||
* track them. Instances of this class represent a reference and two markers,
|
||||
* one for its being declared and another for its being used. When the
|
||||
* document is done, one can look at each instance and, if used but not
|
||||
* declared, its an error.
|
||||
*
|
||||
* The getKey() method allows it to support keyed collection semantics. It
|
||||
* returns the referenced name, so these objects will be stored via the hash
|
||||
* of the name. This name will either be a standard QName if namespaces are
|
||||
* not enabled/supported by the validator, or it will be in the form
|
||||
* {url}name if namespace processing is enabled.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLRefInfo : public XSerializable, public XMemory
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Constructor */
|
||||
//@{
|
||||
XMLRefInfo
|
||||
(
|
||||
const XMLCh* const refName
|
||||
, const bool fDeclared = false
|
||||
, const bool fUsed = false
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XMLRefInfo();
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Getter methods
|
||||
// -----------------------------------------------------------------------
|
||||
bool getDeclared() const;
|
||||
const XMLCh* getRefName() const;
|
||||
bool getUsed() const;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
void setDeclared(const bool newValue);
|
||||
void setUsed(const bool newValue);
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLRefInfo)
|
||||
|
||||
XMLRefInfo
|
||||
(
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLRefInfo(const XMLRefInfo&);
|
||||
XMLRefInfo& operator=(XMLRefInfo&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fDeclared
|
||||
// The name was declared somewhere as an ID attribute.
|
||||
//
|
||||
// fRefName
|
||||
// The name of the ref that this object represents. This is not a
|
||||
// name of the attribute, but of the value of an ID or IDREF attr
|
||||
// in content.
|
||||
//
|
||||
// fUsed
|
||||
// The name was used somewhere in an IDREF/IDREFS attribute. If this
|
||||
// is true, but fDeclared is false, then the ref does not refer to
|
||||
// a declared ID.
|
||||
// -----------------------------------------------------------------------
|
||||
bool fDeclared;
|
||||
bool fUsed;
|
||||
XMLCh* fRefName;
|
||||
MemoryManager* fMemoryManager;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLRefInfo: Constructors and Destructor
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XMLRefInfo::XMLRefInfo( const XMLCh* const refName
|
||||
, const bool declared
|
||||
, const bool used
|
||||
, MemoryManager* const manager) :
|
||||
fDeclared(declared)
|
||||
, fUsed(used)
|
||||
, fRefName(0)
|
||||
, fMemoryManager(manager)
|
||||
{
|
||||
fRefName = XMLString::replicate(refName, fMemoryManager);
|
||||
}
|
||||
|
||||
inline XMLRefInfo::~XMLRefInfo()
|
||||
{
|
||||
fMemoryManager->deallocate(fRefName);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLRefInfo: Getter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline bool XMLRefInfo::getDeclared() const
|
||||
{
|
||||
return fDeclared;
|
||||
}
|
||||
|
||||
inline const XMLCh* XMLRefInfo::getRefName() const
|
||||
{
|
||||
return fRefName;
|
||||
}
|
||||
|
||||
inline bool XMLRefInfo::getUsed() const
|
||||
{
|
||||
return fUsed;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLRefInfo: Setter methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline void XMLRefInfo::setDeclared(const bool newValue)
|
||||
{
|
||||
fDeclared = newValue;
|
||||
}
|
||||
|
||||
inline void XMLRefInfo::setUsed(const bool newValue)
|
||||
{
|
||||
fUsed = newValue;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLSchemaDescription.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLSCHEMADESCRIPTION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLSCHEMADESCRIPTION_HPP
|
||||
|
||||
#include <xercesc/framework/XMLGrammarDescription.hpp>
|
||||
#include <xercesc/util/RefArrayVectorOf.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
typedef const XMLCh* const LocationHint;
|
||||
|
||||
class XMLPARSER_EXPORT XMLSchemaDescription : public XMLGrammarDescription
|
||||
{
|
||||
public :
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Virtual destructor for derived classes */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* virtual destructor
|
||||
*
|
||||
*/
|
||||
virtual ~XMLSchemaDescription();
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Implementation of Grammar Description Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
/**
|
||||
* getGrammarType
|
||||
*
|
||||
*/
|
||||
virtual Grammar::GrammarType getGrammarType() const
|
||||
{
|
||||
return Grammar::SchemaGrammarType;
|
||||
}
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name The SchemaDescription Interface */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
enum ContextType
|
||||
{
|
||||
CONTEXT_INCLUDE,
|
||||
CONTEXT_REDEFINE,
|
||||
CONTEXT_IMPORT,
|
||||
CONTEXT_PREPARSE,
|
||||
CONTEXT_INSTANCE,
|
||||
CONTEXT_ELEMENT,
|
||||
CONTEXT_ATTRIBUTE,
|
||||
CONTEXT_XSITYPE,
|
||||
CONTEXT_UNKNOWN
|
||||
};
|
||||
|
||||
/**
|
||||
* getContextType
|
||||
*
|
||||
*/
|
||||
virtual ContextType getContextType() const = 0;
|
||||
|
||||
/**
|
||||
* getTargetNamespace
|
||||
*
|
||||
*/
|
||||
virtual const XMLCh* getTargetNamespace() const = 0;
|
||||
|
||||
/**
|
||||
* getLocationHints
|
||||
*
|
||||
*/
|
||||
virtual const RefArrayVectorOf<XMLCh>* getLocationHints() const = 0;
|
||||
|
||||
/**
|
||||
* getTriggeringComponent
|
||||
*
|
||||
*/
|
||||
virtual const QName* getTriggeringComponent() const = 0;
|
||||
|
||||
/**
|
||||
* getenclosingElementName
|
||||
*
|
||||
*/
|
||||
virtual const QName* getEnclosingElementName() const = 0;
|
||||
|
||||
/**
|
||||
* getAttributes
|
||||
*
|
||||
*/
|
||||
virtual const XMLAttDef* getAttributes() const = 0;
|
||||
|
||||
/**
|
||||
* setContextType
|
||||
*
|
||||
*/
|
||||
virtual void setContextType(ContextType) = 0;
|
||||
|
||||
/**
|
||||
* setTargetNamespace
|
||||
*
|
||||
*/
|
||||
virtual void setTargetNamespace(const XMLCh* const) = 0;
|
||||
|
||||
/**
|
||||
* setLocationHints
|
||||
*
|
||||
*/
|
||||
virtual void setLocationHints(const XMLCh* const) = 0;
|
||||
|
||||
/**
|
||||
* setTriggeringComponent
|
||||
*
|
||||
*/
|
||||
virtual void setTriggeringComponent(QName* const) = 0;
|
||||
|
||||
/**
|
||||
* getenclosingElementName
|
||||
*
|
||||
*/
|
||||
virtual void setEnclosingElementName(QName* const) = 0;
|
||||
|
||||
/**
|
||||
* setAttributes
|
||||
*
|
||||
*/
|
||||
virtual void setAttributes(XMLAttDef* const) = 0;
|
||||
//@}
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XMLSchemaDescription)
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
/** Hidden Constructors */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLSchemaDescription(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager);
|
||||
//@}
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
/** name Unimplemented copy constructor and operator= */
|
||||
// -----------------------------------------------------------------------
|
||||
//@{
|
||||
XMLSchemaDescription(const XMLSchemaDescription& );
|
||||
XMLSchemaDescription& operator=(const XMLSchemaDescription& );
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
426
project/jni/xerces/include/xercesc/framework/XMLValidator.hpp
Normal file
426
project/jni/xerces/include/xercesc/framework/XMLValidator.hpp
Normal file
@@ -0,0 +1,426 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XMLValidator.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XMLVALIDATOR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XMLVALIDATOR_HPP
|
||||
|
||||
#include <xercesc/framework/XMLAttr.hpp>
|
||||
#include <xercesc/framework/XMLValidityCodes.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class ReaderMgr;
|
||||
class XMLBufferMgr;
|
||||
class XMLElementDecl;
|
||||
class XMLScanner;
|
||||
class Grammar;
|
||||
|
||||
|
||||
/**
|
||||
* This abstract class provides the interface for all validators. This is
|
||||
* the simple amount of API that all validators must honor, in order for
|
||||
* the scanner to use them to do validation. All validators will actually
|
||||
* contain much more functionality than is accessible via this common API,
|
||||
* but that functionality requires that you know what type of validator you
|
||||
* are dealing with.
|
||||
*
|
||||
* Basically, at this level, the primary concern is to be able to query
|
||||
* core information about elements and attributes. Adding decls to the
|
||||
* validator requires that you go through the derived interface because they
|
||||
* all have their own decl types. At this level, we can return information
|
||||
* via the base decl classes, from which each validator derives its own
|
||||
* decl classes.
|
||||
*/
|
||||
class XMLPARSER_EXPORT XMLValidator : public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, just the virtual destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The derived class should clean up its allocated data, then this class
|
||||
* will do the same for data allocated at this level.
|
||||
*/
|
||||
virtual ~XMLValidator()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// The virtual validator interface
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual validator interface */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The derived class should look up its declaration of the passed element
|
||||
* from its element pool. It should then use the content model description
|
||||
* contained in that element declaration to validate that the passed list
|
||||
* of child elements are valid for that content model. The count can be
|
||||
* zero, indicating no child elements.
|
||||
*
|
||||
* Note that whitespace and text content are not validated here. Those are
|
||||
* handled by the scanner. So only element ids are provided here.
|
||||
*
|
||||
* @param elemDecl The element whose content is to be checked.
|
||||
*
|
||||
* @param children An array of element QName which represent the elements
|
||||
* found within the parent element, i.e. the content
|
||||
* to be validated.
|
||||
*
|
||||
* @param childCount The number of elements in the childIds array. It can
|
||||
* be zero if the element had none.
|
||||
*
|
||||
* @param indexFailingChild On return, it will contain the index of the
|
||||
* children failing validation, if the retun value
|
||||
* is false
|
||||
*
|
||||
*/
|
||||
virtual bool checkContent
|
||||
(
|
||||
XMLElementDecl* const elemDecl
|
||||
, QName** const children
|
||||
, XMLSize_t childCount
|
||||
, XMLSize_t* indexFailingChild
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* The derived class should fault in the passed XMLAttr value. It should
|
||||
* use the passeed attribute definition (which is passed via the base
|
||||
* type so it must often be downcast to the appropriate type for the
|
||||
* derived validator class), to fill in the passed attribute. This is done
|
||||
* as a performance enhancement since the derived class has more direct
|
||||
* access to the information.
|
||||
*/
|
||||
virtual void faultInAttr
|
||||
(
|
||||
XMLAttr& toFill
|
||||
, const XMLAttDef& attDef
|
||||
) const = 0;
|
||||
|
||||
/**
|
||||
* This method is called by the scanner after a Grammar is scanned.
|
||||
*/
|
||||
virtual void preContentValidation(bool reuseGrammar,
|
||||
bool validateDefAttr = false) = 0;
|
||||
|
||||
/**
|
||||
* This method is called by the scanner after the parse has completed. It
|
||||
* gives the validator a chance to check certain things that can only be
|
||||
* checked after the whole document has been parsed, such as referential
|
||||
* integrity of ID/IDREF pairs and so forth. The validator should just
|
||||
* issue errors for any problems it finds.
|
||||
*/
|
||||
virtual void postParseValidation() = 0;
|
||||
|
||||
/**
|
||||
* This method is called by the scanner before a new document is about
|
||||
* to start. It gives the validator a change to reset itself in preparation
|
||||
* for another validation pass.
|
||||
*/
|
||||
virtual void reset() = 0;
|
||||
|
||||
/**
|
||||
* The derived class should return a boolean that indicates whether it
|
||||
* requires namespace processing or not. Some do and some allow it to be
|
||||
* optional. This flag is used to control whether the client code's
|
||||
* requests to disable namespace processing can be honored or not.
|
||||
*/
|
||||
virtual bool requiresNamespaces() const = 0;
|
||||
|
||||
/**
|
||||
* The derived class should apply any rules to the passed attribute value
|
||||
* that are above and beyond those defined by XML 1.0. The scanner itself
|
||||
* will impose XML 1.0 rules, based on the type of the attribute. This
|
||||
* will generally be used to check things such as range checks and other
|
||||
* datatype related validation.
|
||||
*
|
||||
* If the value breaks any rules as defined by the derived class, it
|
||||
* should just issue errors as usual.
|
||||
*/
|
||||
virtual void validateAttrValue
|
||||
(
|
||||
const XMLAttDef* attDef
|
||||
, const XMLCh* const attrValue
|
||||
, bool preValidation = false
|
||||
, const XMLElementDecl* elemDecl = 0
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* The derived class should apply any rules to the passed element decl
|
||||
* that are above and beyond those defined by XML 1.0.
|
||||
*
|
||||
* If the value breaks any rules as defined by the derived class, it
|
||||
* should just issue errors as usual.
|
||||
*/
|
||||
virtual void validateElement
|
||||
(
|
||||
const XMLElementDecl* elemDef
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Retrieve the Grammar used
|
||||
*/
|
||||
virtual Grammar* getGrammar() const =0;
|
||||
|
||||
/**
|
||||
* Set the Grammar
|
||||
*/
|
||||
virtual void setGrammar(Grammar* aGrammar) =0;
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual DTD handler interface.
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual DTD handler interface */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method allows the scanner to ask the validator if it handles
|
||||
* DTDs or not.
|
||||
*/
|
||||
virtual bool handlesDTD() const = 0;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Virtual Schema handler interface.
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Virtual Schema handler interface */
|
||||
|
||||
/**
|
||||
* This method allows the scanner to ask the validator if it handles
|
||||
* Schema or not.
|
||||
*/
|
||||
virtual bool handlesSchema() const = 0;
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
//
|
||||
// setScannerInfo() is called by the scanner to tell the validator
|
||||
// about the stuff it needs to have access to.
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Setter methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* @param owningScanner This is a pointer to the scanner to which the
|
||||
* validator belongs. The validator will often
|
||||
* need to query state data from the scanner.
|
||||
*
|
||||
* @param readerMgr This is a pointer to the reader manager that is
|
||||
* being used by the scanner.
|
||||
*
|
||||
* @param bufMgr This is the buffer manager of the scanner. This
|
||||
* is provided as a convenience so that the validator
|
||||
* doesn't have to create its own buffer manager
|
||||
* during the parse process.
|
||||
*/
|
||||
void setScannerInfo
|
||||
(
|
||||
XMLScanner* const owningScanner
|
||||
, ReaderMgr* const readerMgr
|
||||
, XMLBufferMgr* const bufMgr
|
||||
);
|
||||
|
||||
/**
|
||||
* This method is called to set an error reporter on the validator via
|
||||
* which it will report any errors it sees during parsing or validation.
|
||||
* This is generally called by the owning scanner.
|
||||
*
|
||||
* @param errorReporter A pointer to the error reporter to use. This
|
||||
* is not adopted, just referenced so the caller
|
||||
* remains responsible for its cleanup, if any.
|
||||
*/
|
||||
void setErrorReporter
|
||||
(
|
||||
XMLErrorReporter* const errorReporter
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Error emitter methods
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @name Error emittor methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This call is a convenience by which validators can emit errors. Most
|
||||
* of the grunt work of loading the text, getting the current source
|
||||
* location, ect... is handled here.
|
||||
*
|
||||
* If the loaded text has replacement parameters, then text strings can be
|
||||
* passed. These will be used to replace the tokens {0}, {1}, {2}, and {3}
|
||||
* in the order passed. So text1 will replace {0}, text2 will replace {1},
|
||||
* and so forth.
|
||||
*
|
||||
* textX Up to four replacement parameters. They can be provided
|
||||
* as either XMLCh strings, or local code page strings which
|
||||
* will be transcoded internally.
|
||||
*
|
||||
* @param toEmit The error code to emit. it must be one of the defined
|
||||
* validator error codes.
|
||||
*
|
||||
*/
|
||||
void emitError(const XMLValid::Codes toEmit);
|
||||
void emitError
|
||||
(
|
||||
const XMLValid::Codes toEmit
|
||||
, const XMLCh* const text1
|
||||
, const XMLCh* const text2 = 0
|
||||
, const XMLCh* const text3 = 0
|
||||
, const XMLCh* const text4 = 0
|
||||
);
|
||||
void emitError
|
||||
(
|
||||
const XMLValid::Codes toEmit
|
||||
, const char* const text1
|
||||
, const char* const text2 = 0
|
||||
, const char* const text3 = 0
|
||||
, const char* const text4 = 0
|
||||
);
|
||||
void emitError
|
||||
(
|
||||
const XMLValid::Codes toEmit
|
||||
, const XMLExcepts::Codes originalErrorCode
|
||||
, const XMLCh* const text1 = 0
|
||||
, const XMLCh* const text2 = 0
|
||||
, const XMLCh* const text3 = 0
|
||||
, const XMLCh* const text4 = 0
|
||||
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden constructors
|
||||
// -----------------------------------------------------------------------
|
||||
XMLValidator
|
||||
(
|
||||
XMLErrorReporter* const errReporter = 0
|
||||
);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Protected getters
|
||||
// -----------------------------------------------------------------------
|
||||
const XMLBufferMgr* getBufMgr() const;
|
||||
XMLBufferMgr* getBufMgr();
|
||||
const ReaderMgr* getReaderMgr() const;
|
||||
ReaderMgr* getReaderMgr();
|
||||
const XMLScanner* getScanner() const;
|
||||
XMLScanner* getScanner();
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented Constructors and Operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLValidator(const XMLValidator&);
|
||||
XMLValidator& operator=(const XMLValidator&);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Private data members
|
||||
//
|
||||
// fErrorReporter
|
||||
// The error reporter we are to use, if any.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
XMLBufferMgr* fBufMgr;
|
||||
XMLErrorReporter* fErrorReporter;
|
||||
ReaderMgr* fReaderMgr;
|
||||
XMLScanner* fScanner;
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Setter methods
|
||||
// -----------------------------------------------------------------------
|
||||
inline void
|
||||
XMLValidator::setScannerInfo(XMLScanner* const owningScanner
|
||||
, ReaderMgr* const readerMgr
|
||||
, XMLBufferMgr* const bufMgr)
|
||||
{
|
||||
// We don't own any of these, we just reference them
|
||||
fScanner = owningScanner;
|
||||
fReaderMgr = readerMgr;
|
||||
fBufMgr = bufMgr;
|
||||
}
|
||||
|
||||
inline void
|
||||
XMLValidator::setErrorReporter(XMLErrorReporter* const errorReporter)
|
||||
{
|
||||
fErrorReporter = errorReporter;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XMLValidator: Protected getter
|
||||
// ---------------------------------------------------------------------------
|
||||
inline const XMLBufferMgr* XMLValidator::getBufMgr() const
|
||||
{
|
||||
return fBufMgr;
|
||||
}
|
||||
|
||||
inline XMLBufferMgr* XMLValidator::getBufMgr()
|
||||
{
|
||||
return fBufMgr;
|
||||
}
|
||||
|
||||
inline const ReaderMgr* XMLValidator::getReaderMgr() const
|
||||
{
|
||||
return fReaderMgr;
|
||||
}
|
||||
|
||||
inline ReaderMgr* XMLValidator::getReaderMgr()
|
||||
{
|
||||
return fReaderMgr;
|
||||
}
|
||||
|
||||
inline const XMLScanner* XMLValidator::getScanner() const
|
||||
{
|
||||
return fScanner;
|
||||
}
|
||||
|
||||
inline XMLScanner* XMLValidator::getScanner()
|
||||
{
|
||||
return fScanner;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,147 @@
|
||||
// This file is generated, don't edit it!!
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLValid)
|
||||
#define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLValid
|
||||
|
||||
#include <xercesc/framework/XMLErrorReporter.hpp>
|
||||
#include <xercesc/util/XercesDefs.hpp>
|
||||
#include <xercesc/dom/DOMError.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLValid
|
||||
{
|
||||
public :
|
||||
enum Codes
|
||||
{
|
||||
NoError = 0
|
||||
, E_LowBounds = 1
|
||||
, ElementNotDefined = 2
|
||||
, AttNotDefined = 3
|
||||
, NotationNotDeclared = 4
|
||||
, RootElemNotLikeDocType = 5
|
||||
, RequiredAttrNotProvided = 6
|
||||
, ElementNotValidForContent = 7
|
||||
, BadIDAttrDefType = 8
|
||||
, InvalidEmptyAttValue = 9
|
||||
, ElementAlreadyExists = 10
|
||||
, MultipleIdAttrs = 11
|
||||
, ReusedIDValue = 12
|
||||
, IDNotDeclared = 13
|
||||
, UnknownNotRefAttr = 14
|
||||
, UndeclaredElemInDocType = 15
|
||||
, EmptyNotValidForContent = 16
|
||||
, AttNotDefinedForElement = 17
|
||||
, BadEntityRefAttr = 18
|
||||
, UnknownEntityRefAttr = 19
|
||||
, ColonNotValidWithNS = 20
|
||||
, NotEnoughElemsForCM = 21
|
||||
, NoCharDataInCM = 22
|
||||
, DoesNotMatchEnumList = 23
|
||||
, AttrValNotName = 24
|
||||
, NoMultipleValues = 25
|
||||
, NotSameAsFixedValue = 26
|
||||
, RepElemInMixed = 27
|
||||
, FeatureUnsupported = 28
|
||||
, GroupContentRestricted = 29
|
||||
, UnknownBaseDatatype = 30
|
||||
, NoContentForRef = 31
|
||||
, DatatypeError = 32
|
||||
, ProhibitedAttributePresent = 33
|
||||
, IllegalXMLSpace = 34
|
||||
, WrongTargetNamespace = 35
|
||||
, SimpleTypeHasChild = 36
|
||||
, NoDatatypeValidatorForSimpleType = 37
|
||||
, GrammarNotFound = 38
|
||||
, DisplayErrorMessage = 39
|
||||
, NillNotAllowed = 40
|
||||
, NilAttrNotEmpty = 41
|
||||
, FixedDifferentFromActual = 42
|
||||
, NoDatatypeValidatorForAttribute = 43
|
||||
, GenericError = 44
|
||||
, ElementNotQualified = 45
|
||||
, ElementNotUnQualified = 46
|
||||
, VC_IllegalRefInStandalone = 47
|
||||
, NoDefAttForStandalone = 48
|
||||
, NoAttNormForStandalone = 49
|
||||
, NoWSForStandalone = 50
|
||||
, VC_EntityNotFound = 51
|
||||
, PartialMarkupInPE = 52
|
||||
, DatatypeValidationFailure = 53
|
||||
, UniqueParticleAttributionFail = 54
|
||||
, NoAbstractInXsiType = 55
|
||||
, NoDirectUseAbstractElement = 56
|
||||
, NoUseAbstractType = 57
|
||||
, BadXsiType = 58
|
||||
, NonDerivedXsiType = 59
|
||||
, ElemNoSubforBlock = 60
|
||||
, TypeNoSubforBlock = 61
|
||||
, AttributeNotQualified = 62
|
||||
, AttributeNotUnQualified = 63
|
||||
, IC_FieldMultipleMatch = 64
|
||||
, IC_UnknownField = 65
|
||||
, IC_AbsentKeyValue = 66
|
||||
, IC_KeyNotEnoughValues = 67
|
||||
, IC_KeyMatchesNillable = 68
|
||||
, IC_DuplicateUnique = 69
|
||||
, IC_DuplicateKey = 70
|
||||
, IC_KeyRefOutOfScope = 71
|
||||
, IC_KeyNotFound = 72
|
||||
, NonWSContent = 73
|
||||
, EmptyElemNotationAttr = 74
|
||||
, EmptyElemHasContent = 75
|
||||
, ElemOneNotationAttr = 76
|
||||
, AttrDupToken = 77
|
||||
, ElemChildrenHasInvalidWS = 78
|
||||
, E_HighBounds = 79
|
||||
, W_LowBounds = 80
|
||||
, W_HighBounds = 81
|
||||
, F_LowBounds = 82
|
||||
, F_HighBounds = 83
|
||||
};
|
||||
|
||||
static bool isFatal(const XMLValid::Codes toCheck)
|
||||
{
|
||||
return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
|
||||
}
|
||||
|
||||
static bool isWarning(const XMLValid::Codes toCheck)
|
||||
{
|
||||
return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
|
||||
}
|
||||
|
||||
static bool isError(const XMLValid::Codes toCheck)
|
||||
{
|
||||
return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
|
||||
}
|
||||
|
||||
static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck)
|
||||
{
|
||||
if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
|
||||
return XMLErrorReporter::ErrType_Warning;
|
||||
else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
|
||||
return XMLErrorReporter::ErrType_Fatal;
|
||||
else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
|
||||
return XMLErrorReporter::ErrType_Error;
|
||||
return XMLErrorReporter::ErrTypes_Unknown;
|
||||
}
|
||||
static DOMError::ErrorSeverity DOMErrorType(const XMLValid::Codes toCheck)
|
||||
{
|
||||
if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
|
||||
return DOMError::DOM_SEVERITY_WARNING;
|
||||
else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
|
||||
return DOMError::DOM_SEVERITY_FATAL_ERROR;
|
||||
else return DOMError::DOM_SEVERITY_ERROR;
|
||||
}
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XMLValid();
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PSVIAttribute.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/PSVIItem.hpp>
|
||||
#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
|
||||
#include <xercesc/validators/datatype/DatatypeValidator.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Represent the PSVI contributions for one attribute information item.
|
||||
* This is *always* owned by the scanner/parser object from which
|
||||
* it is obtained. The validator will specify
|
||||
* under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAttributeDeclaration;
|
||||
|
||||
class XMLPARSER_EXPORT PSVIAttribute : public PSVIItem
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~PSVIAttribute();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name PSVIAttribute methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* An item isomorphic to the attribute declaration used to validate
|
||||
* this attribute.
|
||||
*
|
||||
* @return an attribute declaration
|
||||
*/
|
||||
XSAttributeDeclaration *getAttributeDeclaration();
|
||||
|
||||
/**
|
||||
* An item isomorphic to the type definition used to validate this element.
|
||||
*
|
||||
* @return a type declaration
|
||||
*/
|
||||
XSTypeDefinition *getTypeDefinition();
|
||||
|
||||
/**
|
||||
* If and only if that type definition is a simple type definition
|
||||
* with {variety} union, or a complex type definition whose {content type}
|
||||
* is a simple thype definition with {variety} union, then an item isomorphic
|
||||
* to that member of the union's {member type definitions} which actually
|
||||
* validated the element item's normalized value.
|
||||
*
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
XSSimpleTypeDefinition *getMemberTypeDefinition();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* reset this object. Intended to be called by
|
||||
* the implementation.
|
||||
*/
|
||||
void reset(
|
||||
const XMLCh * const valContext
|
||||
, PSVIItem::VALIDITY_STATE state
|
||||
, PSVIItem::ASSESSMENT_TYPE assessmentType
|
||||
, XSSimpleTypeDefinition * validatingType
|
||||
, XSSimpleTypeDefinition * memberType
|
||||
, const XMLCh * const defaultValue
|
||||
, const bool isSpecified
|
||||
, XSAttributeDeclaration * attrDecl
|
||||
, DatatypeValidator * dv
|
||||
);
|
||||
|
||||
/**
|
||||
* set the schema normalized value (and
|
||||
* implicitly the canonical value) of this object; intended to be used
|
||||
* by the implementation.
|
||||
*/
|
||||
void setValue(const XMLCh * const normalizedValue);
|
||||
|
||||
/**
|
||||
* set VALIDITY_STATE to specified value; intended to be
|
||||
* called by implementation.
|
||||
*/
|
||||
void updateValidity(VALIDITY_STATE newValue);
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
PSVIAttribute(const PSVIAttribute&);
|
||||
PSVIAttribute & operator=(const PSVIAttribute &);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fAttributeDecl
|
||||
// attribute declaration component that validated this attribute
|
||||
// fDV
|
||||
// implementation-specific datatype validator used to validate this attribute
|
||||
XSAttributeDeclaration * fAttributeDecl;
|
||||
DatatypeValidator * fDV;
|
||||
};
|
||||
inline PSVIAttribute::~PSVIAttribute()
|
||||
{
|
||||
fMemoryManager->deallocate((void *)fCanonicalValue);
|
||||
}
|
||||
|
||||
inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration()
|
||||
{
|
||||
return fAttributeDecl;
|
||||
}
|
||||
|
||||
inline XSTypeDefinition* PSVIAttribute::getTypeDefinition()
|
||||
{
|
||||
return fType;
|
||||
}
|
||||
|
||||
inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition()
|
||||
{
|
||||
return fMemberType;
|
||||
}
|
||||
|
||||
inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue)
|
||||
{
|
||||
fValidityState = newValue;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PSVIAttributeList.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_LIST_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_LIST_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/framework/psvi/PSVIAttribute.hpp>
|
||||
#include <xercesc/util/RefVectorOf.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* A container for the PSVI contributions to attributes that occur
|
||||
* on a particular element.
|
||||
* This is always owned by the parser/validator from
|
||||
* which it is obtained. The parser/validator will specify
|
||||
* under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
class XMLPARSER_EXPORT PSVIAttributeStorage : public XMemory
|
||||
{
|
||||
public:
|
||||
PSVIAttributeStorage() :
|
||||
fPSVIAttribute(0)
|
||||
, fAttributeName(0)
|
||||
, fAttributeNamespace(0)
|
||||
{
|
||||
}
|
||||
|
||||
~PSVIAttributeStorage()
|
||||
{
|
||||
delete fPSVIAttribute;
|
||||
}
|
||||
|
||||
PSVIAttribute* fPSVIAttribute;
|
||||
const XMLCh* fAttributeName;
|
||||
const XMLCh* fAttributeNamespace;
|
||||
};
|
||||
|
||||
class XMLPARSER_EXPORT PSVIAttributeList : public XMemory
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
PSVIAttributeList( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~PSVIAttributeList();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name PSVIAttributeList methods */
|
||||
|
||||
//@{
|
||||
|
||||
/*
|
||||
* Get the number of attributes whose PSVI contributions
|
||||
* are contained in this list.
|
||||
*/
|
||||
XMLSize_t getLength() const;
|
||||
|
||||
/*
|
||||
* Get the PSVI contribution of attribute at position i
|
||||
* in this list. Indices start from 0.
|
||||
* @param index index from which the attribute PSVI contribution
|
||||
* is to come.
|
||||
* @return PSVIAttribute containing the attributes PSVI contributions;
|
||||
* null is returned if the index is out of range.
|
||||
*/
|
||||
PSVIAttribute *getAttributePSVIAtIndex(const XMLSize_t index);
|
||||
|
||||
/*
|
||||
* Get local part of attribute name at position index in the list.
|
||||
* Indices start from 0.
|
||||
* @param index index from which the attribute name
|
||||
* is to come.
|
||||
* @return local part of the attribute's name; null is returned if the index
|
||||
* is out of range.
|
||||
*/
|
||||
const XMLCh *getAttributeNameAtIndex(const XMLSize_t index);
|
||||
|
||||
/*
|
||||
* Get namespace of attribute at position index in the list.
|
||||
* Indices start from 0.
|
||||
* @param index index from which the attribute namespace
|
||||
* is to come.
|
||||
* @return namespace of the attribute;
|
||||
* null is returned if the index is out of range.
|
||||
*/
|
||||
const XMLCh *getAttributeNamespaceAtIndex(const XMLSize_t index);
|
||||
|
||||
/*
|
||||
* Get the PSVI contribution of attribute with given
|
||||
* local name and namespace.
|
||||
* @param attrName local part of the attribute's name
|
||||
* @param attrNamespace namespace of the attribute
|
||||
* @return null if the attribute PSVI does not exist
|
||||
*/
|
||||
PSVIAttribute *getAttributePSVIByName(const XMLCh *attrName
|
||||
, const XMLCh * attrNamespace);
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* returns a PSVI attribute of undetermined state and given name/namespace and
|
||||
* makes that object part of the internal list. Intended to be called
|
||||
* during validation of an element.
|
||||
* @param attrName name of this attribute
|
||||
* @param attrNS URI of the attribute
|
||||
* @return new, uninitialized, PSVIAttribute object
|
||||
*/
|
||||
PSVIAttribute *getPSVIAttributeToFill(
|
||||
const XMLCh * attrName
|
||||
, const XMLCh * attrNS);
|
||||
|
||||
/**
|
||||
* reset the list
|
||||
*/
|
||||
void reset();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
PSVIAttributeList(const PSVIAttributeList&);
|
||||
PSVIAttributeList & operator=(const PSVIAttributeList &);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fMemoryManager
|
||||
// handler to provide dynamically-need memory
|
||||
// fAttrList
|
||||
// list of PSVIAttributes contained by this object
|
||||
// fAttrPos
|
||||
// current number of initialized PSVIAttributes in fAttrList
|
||||
MemoryManager* fMemoryManager;
|
||||
RefVectorOf<PSVIAttributeStorage>* fAttrList;
|
||||
XMLSize_t fAttrPos;
|
||||
};
|
||||
|
||||
inline PSVIAttributeList::~PSVIAttributeList()
|
||||
{
|
||||
delete fAttrList;
|
||||
}
|
||||
|
||||
inline PSVIAttribute *PSVIAttributeList::getPSVIAttributeToFill(
|
||||
const XMLCh *attrName
|
||||
, const XMLCh * attrNS)
|
||||
{
|
||||
PSVIAttributeStorage* storage = 0;
|
||||
if(fAttrPos == fAttrList->size())
|
||||
{
|
||||
storage = new (fMemoryManager) PSVIAttributeStorage();
|
||||
storage->fPSVIAttribute = new (fMemoryManager) PSVIAttribute(fMemoryManager);
|
||||
fAttrList->addElement(storage);
|
||||
}
|
||||
else
|
||||
{
|
||||
storage = fAttrList->elementAt(fAttrPos);
|
||||
}
|
||||
storage->fAttributeName = attrName;
|
||||
storage->fAttributeNamespace = attrNS;
|
||||
fAttrPos++;
|
||||
return storage->fPSVIAttribute;
|
||||
}
|
||||
|
||||
inline void PSVIAttributeList::reset()
|
||||
{
|
||||
fAttrPos = 0;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PSVIElement.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_PSVIELEMENT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_PSVIELEMENT_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/PSVIItem.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Represent the PSVI contributions for one element information item.
|
||||
* This is *always* owned by the scanner/parser object from which
|
||||
* it is obtained. The validator will specify
|
||||
* under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSElementDeclaration;
|
||||
class XSNotationDeclaration;
|
||||
class XSModel;
|
||||
|
||||
class XMLPARSER_EXPORT PSVIElement : public PSVIItem
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
PSVIElement( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~PSVIElement();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name PSVIElement methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* An item isomorphic to the element declaration used to validate
|
||||
* this element.
|
||||
*
|
||||
* @return an element declaration
|
||||
*/
|
||||
XSElementDeclaration *getElementDeclaration();
|
||||
|
||||
/**
|
||||
* [notation]
|
||||
* @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation">XML Schema Part 1: Structures [notation]</a>
|
||||
* @return The notation declaration.
|
||||
*/
|
||||
XSNotationDeclaration *getNotationDeclaration();
|
||||
|
||||
/**
|
||||
* [schema information]
|
||||
* @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_information">XML Schema Part 1: Structures [schema information]</a>
|
||||
* @return The schema information property if it's the validation root,
|
||||
* null otherwise.
|
||||
*/
|
||||
XSModel *getSchemaInformation();
|
||||
|
||||
/**
|
||||
* An item isomorphic to the type definition used to validate this element.
|
||||
*
|
||||
* @return a type declaration
|
||||
*/
|
||||
XSTypeDefinition *getTypeDefinition();
|
||||
|
||||
/**
|
||||
* If and only if that type definition is a simple type definition
|
||||
* with {variety} union, or a complex type definition whose {content type}
|
||||
* is a simple type definition with {variety} union, then an item isomorphic
|
||||
* to that member of the union's {member type definitions} which actually
|
||||
* validated the element item's normalized value.
|
||||
*
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
XSSimpleTypeDefinition *getMemberTypeDefinition();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
void reset
|
||||
(
|
||||
const VALIDITY_STATE validityState
|
||||
, const ASSESSMENT_TYPE assessmentType
|
||||
, const XMLCh* const validationContext
|
||||
, bool isSpecified
|
||||
, XSElementDeclaration* const elemDecl
|
||||
, XSTypeDefinition* const typeDef
|
||||
, XSSimpleTypeDefinition* const memberType
|
||||
, XSModel* const schemaInfo
|
||||
, const XMLCh* const defaultValue
|
||||
, const XMLCh* const normalizedValue = 0
|
||||
, XMLCh* const canonicalValue = 0
|
||||
, XSNotationDeclaration* const notationDecl = 0
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
PSVIElement(const PSVIElement&);
|
||||
PSVIElement & operator=(const PSVIElement &);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fElementDecl
|
||||
// element declaration component that validated this element
|
||||
// fNotationDecl
|
||||
// (optional) notation decl associated with this element
|
||||
// fSchemaInfo
|
||||
// Schema Information Item with which this validation episode is associated
|
||||
XSElementDeclaration *fElementDecl;
|
||||
XSNotationDeclaration *fNotationDecl;
|
||||
XSModel *fSchemaInfo;
|
||||
};
|
||||
|
||||
inline XSElementDeclaration *PSVIElement::getElementDeclaration()
|
||||
{
|
||||
return fElementDecl;
|
||||
}
|
||||
|
||||
inline XSNotationDeclaration* PSVIElement::getNotationDeclaration()
|
||||
{
|
||||
return fNotationDecl;
|
||||
}
|
||||
|
||||
inline XSModel* PSVIElement::getSchemaInformation()
|
||||
{
|
||||
return fSchemaInfo;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PSVIHandler.hpp 676796 2008-07-15 05:04:13Z dbertoni $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_PSVIHANDLER_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_PSVIHANDLER_HPP
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
class PSVIElement;
|
||||
class PSVIAttributeList;
|
||||
|
||||
|
||||
/**
|
||||
* This abstract class provides the interface for the scanner to return
|
||||
* PSVI information to the application.
|
||||
*
|
||||
*/
|
||||
class XMLPARSER_EXPORT PSVIHandler
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors are hidden, just the virtual destructor is exposed
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~PSVIHandler()
|
||||
{
|
||||
}
|
||||
//@}
|
||||
|
||||
/** @name The PSVI handler interface */
|
||||
//@{
|
||||
/** Receive notification of the PSVI properties of an element.
|
||||
* The scanner will issue this call after the XMLDocumentHandler
|
||||
* endElement call. Since the scanner will issue the psviAttributes
|
||||
* call immediately after reading the start tag of an element, all element
|
||||
* content will be effectively bracketed by these two calls.
|
||||
* @param localName The name of the element whose end tag was just
|
||||
* parsed.
|
||||
* @param uri The namespace to which the element is bound
|
||||
* @param elementInfo Object containing the element's PSVI properties
|
||||
*/
|
||||
virtual void handleElementPSVI
|
||||
(
|
||||
const XMLCh* const localName
|
||||
, const XMLCh* const uri
|
||||
, PSVIElement * elementInfo
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Receive notification of partial PSVI properties of an element.
|
||||
* This callback is made right after the psviAttributes
|
||||
* call for non-empty element.
|
||||
*
|
||||
* The PSVIElement passed in has all fields properly set and it
|
||||
* can be safely accessed the same way as the one passed in handleElementPSVI.
|
||||
* However, fields listed below always have default values.
|
||||
*
|
||||
* getValidity() PSVIItem::VALIDITY_NOTKNOWN
|
||||
* getValidationAttemped() PSVIItem::VALIDATION_NONE
|
||||
* getMemberTypeDefinition() 0
|
||||
* getSchemaNormalizedValue() 0
|
||||
* getCanonicalRepresentation() 0
|
||||
* getNotationDeclaration() 0
|
||||
*
|
||||
*
|
||||
* @param localName The name of the element upon which start tag
|
||||
* these attributes were encountered.
|
||||
* @param uri The namespace to which the element is bound
|
||||
* @param elementInfo Object containing the element's partial PSVI properties
|
||||
*/
|
||||
virtual void handlePartialElementPSVI
|
||||
(
|
||||
const XMLCh* const localName
|
||||
, const XMLCh* const uri
|
||||
, PSVIElement * elementInfo
|
||||
);
|
||||
|
||||
/**
|
||||
* Enables PSVI information about attributes to be passed back to the
|
||||
* application. This callback will be made on *all*
|
||||
* elements; on elements with no attributes, the final parameter will
|
||||
* be null.
|
||||
* @param localName The name of the element upon which start tag
|
||||
* these attributes were encountered.
|
||||
* @param uri The namespace to which the element is bound
|
||||
* @param psviAttributes Object containing the attributes' PSVI properties
|
||||
* with information to identify them.
|
||||
*/
|
||||
virtual void handleAttributesPSVI
|
||||
(
|
||||
const XMLCh* const localName
|
||||
, const XMLCh* const uri
|
||||
, PSVIAttributeList * psviAttributes
|
||||
) = 0;
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
protected :
|
||||
// -----------------------------------------------------------------------
|
||||
// Hidden Constructors
|
||||
// -----------------------------------------------------------------------
|
||||
PSVIHandler()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
PSVIHandler(const PSVIHandler&);
|
||||
PSVIHandler& operator=(const PSVIHandler&);
|
||||
};
|
||||
|
||||
inline void PSVIHandler::handlePartialElementPSVI(const XMLCh* const /*localName*/
|
||||
, const XMLCh* const /*uri*/
|
||||
, PSVIElement * /*elementInfo*/
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
309
project/jni/xerces/include/xercesc/framework/psvi/PSVIItem.hpp
Normal file
309
project/jni/xerces/include/xercesc/framework/psvi/PSVIItem.hpp
Normal file
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PSVIItem.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_PSVIITEM_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_PSVIITEM_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Represent the PSVI contributions for one element or one attribute information item.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained. It is designed to be subclassed; subclasses will
|
||||
* specify under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSTypeDefinition;
|
||||
class XSSimpleTypeDefinition;
|
||||
class XSValue;
|
||||
|
||||
class XMLPARSER_EXPORT PSVIItem : public XMemory
|
||||
{
|
||||
public:
|
||||
|
||||
enum VALIDITY_STATE {
|
||||
/** Validity value indicating that validation has either not
|
||||
been performed or that a strict assessment of validity could
|
||||
not be performed
|
||||
*/
|
||||
VALIDITY_NOTKNOWN = 0,
|
||||
|
||||
/** Validity value indicating that validation has been strictly
|
||||
assessed and the element in question is invalid according to the
|
||||
rules of schema validation.
|
||||
*/
|
||||
VALIDITY_INVALID = 1,
|
||||
|
||||
/** Validity value indicating that validation has been strictly
|
||||
assessed and the element in question is valid according to the rules
|
||||
of schema validation.
|
||||
*/
|
||||
VALIDITY_VALID = 2
|
||||
};
|
||||
|
||||
enum ASSESSMENT_TYPE {
|
||||
/** Validation status indicating that schema validation has been
|
||||
performed and the element in question has specifically been skipped.
|
||||
*/
|
||||
VALIDATION_NONE = 0,
|
||||
|
||||
/** Validation status indicating that schema validation has been
|
||||
performed on the element in question under the rules of lax validation.
|
||||
*/
|
||||
VALIDATION_PARTIAL = 1,
|
||||
|
||||
/** Validation status indicating that full schema validation has been
|
||||
performed on the element. */
|
||||
VALIDATION_FULL = 2
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
PSVIItem(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~PSVIItem();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name PSVIItem methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [validation context]
|
||||
*
|
||||
* @return A string identifying the nearest ancestor element
|
||||
* information item with a [schema information] property
|
||||
* (or this element item itself if it has such a property)
|
||||
* (form to be determined)
|
||||
* @see <a href="http://www.w3.org/TR/xmlschema-1/#e-validation_context">XML Schema Part 1: Structures [validation context]</a>
|
||||
*/
|
||||
const XMLCh *getValidationContext();
|
||||
|
||||
/**
|
||||
* Determine the validity of the node with respect
|
||||
* to the validation being attempted
|
||||
*
|
||||
* @return return the [validity] property. Possible values are:
|
||||
* VALIDITY_UNKNOWN, VALIDITY_INVALID, VALIDITY_VALID
|
||||
*/
|
||||
VALIDITY_STATE getValidity() const;
|
||||
|
||||
/**
|
||||
* Determines the extent to which the item has been validated
|
||||
*
|
||||
* @return return the [validation attempted] property. The possible values are
|
||||
* VALIDATION_NONE, VALIDATION_ORDERED_PARTIAL and VALIDATION_FULL
|
||||
*/
|
||||
ASSESSMENT_TYPE getValidationAttempted() const;
|
||||
|
||||
/**
|
||||
* A list of error codes generated from validation attempts.
|
||||
* Need to find all the possible sub-clause reports that need reporting
|
||||
*
|
||||
* @return list of error codes
|
||||
*/
|
||||
/***
|
||||
const XMLCh ** getErrorCodes();
|
||||
****/
|
||||
|
||||
/**
|
||||
* [schema normalized value]
|
||||
*
|
||||
* @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_normalized_value">XML Schema Part 1: Structures [schema normalized value]</a>
|
||||
* @return the normalized value of this item after validation
|
||||
*/
|
||||
const XMLCh *getSchemaNormalizedValue();
|
||||
|
||||
/**
|
||||
* An item isomorphic to the type definition used to validate this element.
|
||||
*
|
||||
* @return a type declaration
|
||||
*/
|
||||
virtual XSTypeDefinition *getTypeDefinition() = 0;
|
||||
|
||||
/**
|
||||
* If and only if that type definition is a simple type definition
|
||||
* with {variety} union, or a complex type definition whose {content type}
|
||||
* is a simple thype definition with {variety} union, then an item isomorphic
|
||||
* to that member of the union's {member type definitions} which actually
|
||||
* validated the element item's normalized value.
|
||||
*
|
||||
* @return a simple type declaration
|
||||
*/
|
||||
virtual XSSimpleTypeDefinition *getMemberTypeDefinition() = 0;
|
||||
|
||||
/**
|
||||
* [schema default]
|
||||
*
|
||||
* @return The canonical lexical representation of the declaration's {value constraint} value.
|
||||
* @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_default">XML Schema Part 1: Structures [schema default]</a>
|
||||
*/
|
||||
const XMLCh *getSchemaDefault();
|
||||
|
||||
/**
|
||||
* [schema specified]
|
||||
* @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_specified">XML Schema Part 1: Structures [schema specified]</a>
|
||||
* @return true - value was specified in schema, false - value comes from the infoset
|
||||
*/
|
||||
bool getIsSchemaSpecified() const;
|
||||
|
||||
/**
|
||||
* Return the canonical representation of this value.
|
||||
* Note that, formally, this is not a PSVI property.
|
||||
* @return string representing the canonical representation, if this item
|
||||
* was validated by a simple type definition for which canonical
|
||||
* representations of values are defined.
|
||||
*/
|
||||
const XMLCh *getCanonicalRepresentation() const;
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get actual value in the form of XSValue,
|
||||
* caller needs to delete the object returned.
|
||||
*
|
||||
* @return an XSValue
|
||||
*/
|
||||
virtual XSValue *getActualValue() const;
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
void setValidationAttempted(PSVIItem::ASSESSMENT_TYPE attemptType);
|
||||
void setValidity(PSVIItem::VALIDITY_STATE validity);
|
||||
|
||||
/** reset the object
|
||||
* @param validationContext corresponds to schema validation context property
|
||||
* @param normalizedValue corresponds to schema normalized value property
|
||||
* @param validityState state of item's validity
|
||||
* @param assessmentType type of assessment carried out on item
|
||||
*/
|
||||
void reset(
|
||||
const XMLCh* const validationContext
|
||||
, const XMLCh* const normalizedValue
|
||||
, const VALIDITY_STATE validityState
|
||||
, const ASSESSMENT_TYPE assessmentType
|
||||
);
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
PSVIItem(const PSVIItem&);
|
||||
PSVIItem & operator=(const PSVIItem &);
|
||||
|
||||
|
||||
protected:
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fMemoryManager:
|
||||
// used for any memory allocations
|
||||
// fValidationContext
|
||||
// corresponds to the schema [validation context] property
|
||||
// fNormalizedValue
|
||||
// The schema normalized value (when present)
|
||||
// fDefaultValue
|
||||
// default value specified in the schema, if any
|
||||
// fCanonicalValue
|
||||
// canonicalized version of normalizedValue
|
||||
// fValidityState
|
||||
// Whether this item is valid or not
|
||||
// fAssessmentType
|
||||
// The kind of assessment that produced the given validity outcome
|
||||
// fIsSpecified
|
||||
// Whether this item exists because a default was specified in the schema
|
||||
// fType
|
||||
// type responsible for validating this item
|
||||
// fMemberType
|
||||
// If fType is a union type, the member type that validated this item
|
||||
MemoryManager* const fMemoryManager;
|
||||
const XMLCh* fValidationContext;
|
||||
const XMLCh* fNormalizedValue;
|
||||
const XMLCh* fDefaultValue;
|
||||
XMLCh* fCanonicalValue;
|
||||
VALIDITY_STATE fValidityState;
|
||||
ASSESSMENT_TYPE fAssessmentType;
|
||||
bool fIsSpecified;
|
||||
XSTypeDefinition * fType;
|
||||
XSSimpleTypeDefinition* fMemberType;
|
||||
};
|
||||
|
||||
inline PSVIItem::~PSVIItem() {}
|
||||
|
||||
inline const XMLCh *PSVIItem::getValidationContext()
|
||||
{
|
||||
return fValidationContext;
|
||||
}
|
||||
|
||||
inline const XMLCh* PSVIItem::getSchemaNormalizedValue()
|
||||
{
|
||||
return fNormalizedValue;
|
||||
}
|
||||
|
||||
inline const XMLCh* PSVIItem::getSchemaDefault()
|
||||
{
|
||||
return fDefaultValue;
|
||||
}
|
||||
|
||||
inline const XMLCh* PSVIItem::getCanonicalRepresentation() const
|
||||
{
|
||||
return fCanonicalValue;
|
||||
}
|
||||
|
||||
inline PSVIItem::VALIDITY_STATE PSVIItem::getValidity() const
|
||||
{
|
||||
return fValidityState;
|
||||
}
|
||||
|
||||
inline bool PSVIItem::getIsSchemaSpecified() const
|
||||
{
|
||||
return fIsSpecified;
|
||||
}
|
||||
|
||||
inline PSVIItem::ASSESSMENT_TYPE PSVIItem::getValidationAttempted() const
|
||||
{
|
||||
return fAssessmentType;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSAnnotation.hpp 672273 2008-06-27 13:57:00Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSANNOTATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSANNOTATION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
#include <xercesc/internal/XSerializable.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Annotation
|
||||
* component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class DOMNode;
|
||||
class ContentHandler;
|
||||
|
||||
class XMLPARSER_EXPORT XSAnnotation : public XSerializable, public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// TargetType
|
||||
enum ANNOTATION_TARGET {
|
||||
/**
|
||||
* The object type is <code>org.w3c.dom.Element</code>.
|
||||
*/
|
||||
W3C_DOM_ELEMENT = 1,
|
||||
/**
|
||||
* The object type is <code>org.w3c.dom.Document</code>.
|
||||
*/
|
||||
W3C_DOM_DOCUMENT = 2
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param contents The string that is to be the content of this XSAnnotation
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSAnnotation
|
||||
(
|
||||
const XMLCh* const contents
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSAnnotation();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSAnnotation methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Write contents of the annotation to the specified DOM object. In-scope
|
||||
* namespace declarations for <code>annotation</code> element are added as
|
||||
* attribute nodes of the serialized <code>annotation</code>.
|
||||
* @param node A target pointer to the annotation target object, i.e.
|
||||
* either <code>DOMDocument</code> or <code>DOMElement</code> cast as
|
||||
* <code>DOMNode</code>.
|
||||
* @param targetType A target type.
|
||||
*/
|
||||
|
||||
void writeAnnotation(DOMNode* node, ANNOTATION_TARGET targetType);
|
||||
|
||||
/**
|
||||
* Write contents of the annotation to the specified object.
|
||||
* The corresponding events for all in-scope namespace declarations are
|
||||
* sent via the specified document handler.
|
||||
* @param handler A target pointer to the annotation target object, i.e.
|
||||
* <code>ContentHandler</code>.
|
||||
*/
|
||||
void writeAnnotation(ContentHandler* handler);
|
||||
|
||||
/**
|
||||
* A text representation of annotation.
|
||||
*/
|
||||
const XMLCh *getAnnotationString() const;
|
||||
XMLCh *getAnnotationString();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
//@{
|
||||
void setNext(XSAnnotation* const nextAnnotation);
|
||||
XSAnnotation* getNext();
|
||||
//@}
|
||||
|
||||
//-----------------------------
|
||||
/** Getter */
|
||||
//@{
|
||||
inline void getLineCol(XMLFileLoc& line, XMLFileLoc& col) const;
|
||||
inline const XMLCh* getSystemId() const;
|
||||
//@}
|
||||
|
||||
//-----------------------------
|
||||
/** Setter */
|
||||
//@{
|
||||
inline void setLineCol(XMLFileLoc line, XMLFileLoc col);
|
||||
void setSystemId(const XMLCh* const systemId);
|
||||
//@}
|
||||
|
||||
/***
|
||||
* Support for Serialization/De-serialization
|
||||
***/
|
||||
DECL_XSERIALIZABLE(XSAnnotation)
|
||||
XSAnnotation(MemoryManager* const manager);
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSAnnotation(const XSAnnotation&);
|
||||
XSAnnotation & operator=(const XSAnnotation &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
XMLCh* fContents;
|
||||
XSAnnotation* fNext;
|
||||
|
||||
private:
|
||||
|
||||
XMLCh* fSystemId;
|
||||
XMLFileLoc fLine;
|
||||
XMLFileLoc fCol;
|
||||
|
||||
};
|
||||
|
||||
inline const XMLCh *XSAnnotation::getAnnotationString() const
|
||||
{
|
||||
return fContents;
|
||||
}
|
||||
|
||||
inline XMLCh *XSAnnotation::getAnnotationString()
|
||||
{
|
||||
return fContents;
|
||||
}
|
||||
|
||||
inline void XSAnnotation::getLineCol(XMLFileLoc& line, XMLFileLoc& col) const
|
||||
{
|
||||
line = fLine;
|
||||
col = fCol;
|
||||
}
|
||||
|
||||
inline const XMLCh* XSAnnotation::getSystemId() const
|
||||
{
|
||||
return fSystemId;
|
||||
}
|
||||
|
||||
inline void XSAnnotation::setLineCol(XMLFileLoc line, XMLFileLoc col)
|
||||
{
|
||||
fLine = line;
|
||||
fCol = col;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSAttributeDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Attribute
|
||||
* Declaration component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSComplexTypeDefinition;
|
||||
class XSSimpleTypeDefinition;
|
||||
class SchemaAttDef;
|
||||
|
||||
class XMLPARSER_EXPORT XSAttributeDeclaration : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param attDef
|
||||
* @param typeDef
|
||||
* @param annot
|
||||
* @param xsModel
|
||||
* @param scope
|
||||
* @param enclosingCTDefinition
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSAttributeDeclaration
|
||||
(
|
||||
SchemaAttDef* const attDef
|
||||
, XSSimpleTypeDefinition* const typeDef
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, XSConstants::SCOPE scope
|
||||
, XSComplexTypeDefinition* enclosingCTDefinition
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSAttributeDeclaration();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overridden XSObject methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem* getNamespaceItem();
|
||||
|
||||
//@}
|
||||
|
||||
/** @name XSAttributeDeclaration methods **/
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [type definition]: A simple type definition
|
||||
*/
|
||||
XSSimpleTypeDefinition *getTypeDefinition() const;
|
||||
|
||||
/**
|
||||
* Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>,
|
||||
* or <code>SCOPE_ABSENT</code>. If the scope is local, then the
|
||||
* <code>enclosingCTDefinition</code> is present.
|
||||
*/
|
||||
XSConstants::SCOPE getScope() const;
|
||||
|
||||
/**
|
||||
* The complex type definition for locally scoped declarations (see
|
||||
* <code>scope</code>).
|
||||
*/
|
||||
XSComplexTypeDefinition *getEnclosingCTDefinition();
|
||||
|
||||
/**
|
||||
* Value constraint: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>.
|
||||
*/
|
||||
XSConstants::VALUE_CONSTRAINT getConstraintType() const;
|
||||
|
||||
/**
|
||||
* Value constraint: The actual value with respect to the [type definition
|
||||
* ].
|
||||
*/
|
||||
const XMLCh *getConstraintValue();
|
||||
|
||||
/**
|
||||
* Optional. Annotation.
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
bool getRequired() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet);
|
||||
friend class XSObjectFactory;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSAttributeDeclaration(const XSAttributeDeclaration&);
|
||||
XSAttributeDeclaration & operator=(const XSAttributeDeclaration &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
SchemaAttDef* fAttDef;
|
||||
XSSimpleTypeDefinition* fTypeDefinition;
|
||||
XSAnnotation* fAnnotation;
|
||||
XSConstants::SCOPE fScope;
|
||||
XSComplexTypeDefinition* fEnclosingCTDefinition;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XSAttributeDeclaration: inline methods
|
||||
// ---------------------------------------------------------------------------
|
||||
inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const
|
||||
{
|
||||
return fTypeDefinition;
|
||||
}
|
||||
|
||||
inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const
|
||||
{
|
||||
return fScope;
|
||||
}
|
||||
|
||||
inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition()
|
||||
{
|
||||
return fEnclosingCTDefinition;
|
||||
}
|
||||
|
||||
inline void XSAttributeDeclaration::setEnclosingCTDefinition
|
||||
(
|
||||
XSComplexTypeDefinition* const toSet
|
||||
)
|
||||
{
|
||||
fEnclosingCTDefinition = toSet;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSAttributeGroupDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEGROUPDEFINITION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEGROUPDEFINITION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Attribute
|
||||
* Group Definition component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSAttributeUse;
|
||||
class XSWildcard;
|
||||
class XercesAttGroupInfo;
|
||||
|
||||
class XMLPARSER_EXPORT XSAttributeGroupDefinition : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param xercesAttGroupInfo
|
||||
* @param xsAttList
|
||||
* @param xsWildcard
|
||||
* @param xsAnnot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSAttributeGroupDefinition
|
||||
(
|
||||
XercesAttGroupInfo* const xercesAttGroupInfo
|
||||
, XSAttributeUseList* const xsAttList
|
||||
, XSWildcard* const xsWildcard
|
||||
, XSAnnotation* const xsAnnot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSAttributeGroupDefinition();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overridden XSObject methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem* getNamespaceItem();
|
||||
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSAttributeGroupDefinition methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* A set of [attribute uses].
|
||||
*/
|
||||
XSAttributeUseList *getAttributeUses();
|
||||
|
||||
/**
|
||||
* Optional. A [wildcard].
|
||||
*/
|
||||
XSWildcard *getAttributeWildcard() const;
|
||||
|
||||
/**
|
||||
* Optional. An [annotation].
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSAttributeGroupDefinition(const XSAttributeGroupDefinition&);
|
||||
XSAttributeGroupDefinition & operator=(const XSAttributeGroupDefinition &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
XercesAttGroupInfo* fXercesAttGroupInfo;
|
||||
XSAttributeUseList* fXSAttributeUseList;
|
||||
XSWildcard* fXSWildcard;
|
||||
XSAnnotation* fAnnotation;
|
||||
};
|
||||
|
||||
inline XSAttributeUseList* XSAttributeGroupDefinition::getAttributeUses()
|
||||
{
|
||||
return fXSAttributeUseList;
|
||||
}
|
||||
|
||||
inline XSWildcard* XSAttributeGroupDefinition::getAttributeWildcard() const
|
||||
{
|
||||
return fXSWildcard;
|
||||
}
|
||||
|
||||
inline XSAnnotation* XSAttributeGroupDefinition::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSAttributeUse.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEUSE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEUSE_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Attribute
|
||||
* Use component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAttributeDeclaration;
|
||||
|
||||
class XMLPARSER_EXPORT XSAttributeUse : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
* @param xsAttDecl
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSAttributeUse
|
||||
(
|
||||
XSAttributeDeclaration* const xsAttDecl,
|
||||
XSModel* const xsModel,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSAttributeUse();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSAttributeUse methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [required]: determines whether this use of an attribute declaration
|
||||
* requires an appropriate attribute information item to be present, or
|
||||
* merely allows it.
|
||||
*/
|
||||
bool getRequired() const;
|
||||
|
||||
/**
|
||||
* [attribute declaration]: provides the attribute declaration itself,
|
||||
* which will in turn determine the simple type definition used.
|
||||
*/
|
||||
XSAttributeDeclaration *getAttrDeclaration() const;
|
||||
|
||||
/**
|
||||
* Value Constraint: one of default, fixed.
|
||||
*/
|
||||
XSConstants::VALUE_CONSTRAINT getConstraintType() const;
|
||||
|
||||
/**
|
||||
* Value Constraint: The actual value.
|
||||
*/
|
||||
const XMLCh *getConstraintValue();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
// set data
|
||||
void set
|
||||
(
|
||||
const bool isRequired
|
||||
, XSConstants::VALUE_CONSTRAINT constraintType
|
||||
, const XMLCh* const constraintValue
|
||||
);
|
||||
|
||||
friend class XSObjectFactory;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSAttributeUse(const XSAttributeUse&);
|
||||
XSAttributeUse & operator=(const XSAttributeUse &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
bool fRequired;
|
||||
XSConstants::VALUE_CONSTRAINT fConstraintType;
|
||||
const XMLCh* fConstraintValue;
|
||||
XSAttributeDeclaration* fXSAttributeDeclaration;
|
||||
};
|
||||
|
||||
inline XSAttributeDeclaration *XSAttributeUse::getAttrDeclaration() const
|
||||
{
|
||||
return fXSAttributeDeclaration;
|
||||
}
|
||||
|
||||
inline bool XSAttributeUse::getRequired() const
|
||||
{
|
||||
return fRequired;
|
||||
}
|
||||
|
||||
inline XSConstants::VALUE_CONSTRAINT XSAttributeUse::getConstraintType() const
|
||||
{
|
||||
return fConstraintType;
|
||||
}
|
||||
|
||||
inline const XMLCh *XSAttributeUse::getConstraintValue()
|
||||
{
|
||||
return fConstraintValue;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSComplexTypeDefinition.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSCOMPLEXTYPEDEFINITION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSCOMPLEXTYPEDEFINITION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSTypeDefinition.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class represents a complexType definition
|
||||
* schema component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSAttributeUse;
|
||||
class XSSimpleTypeDefinition;
|
||||
class XSParticle;
|
||||
class XSWildcard;
|
||||
class ComplexTypeInfo;
|
||||
|
||||
class XMLPARSER_EXPORT XSComplexTypeDefinition : public XSTypeDefinition
|
||||
{
|
||||
public:
|
||||
|
||||
// Content Model Types
|
||||
enum CONTENT_TYPE {
|
||||
/**
|
||||
* Represents an empty content type. A content type with the distinguished
|
||||
* value empty validates elements with no character or element
|
||||
* information item children.
|
||||
*/
|
||||
CONTENTTYPE_EMPTY = 0,
|
||||
/**
|
||||
* Represents a simple content type. A content type which is a simple
|
||||
* validates elements with character-only children.
|
||||
*/
|
||||
CONTENTTYPE_SIMPLE = 1,
|
||||
/**
|
||||
* Represents an element-only content type. An element-only content type
|
||||
* validates elements with children that conform to the supplied content
|
||||
* model.
|
||||
*/
|
||||
CONTENTTYPE_ELEMENT = 2,
|
||||
/**
|
||||
* Represents a mixed content type.
|
||||
*/
|
||||
CONTENTTYPE_MIXED = 3
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param complexTypeInfo
|
||||
* @param xsWildcard
|
||||
* @param xsSimpleType
|
||||
* @param xsAttList
|
||||
* @param xsBaseType
|
||||
* @param xsParticle
|
||||
* @param headAnnot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSComplexTypeDefinition
|
||||
(
|
||||
ComplexTypeInfo* const complexTypeInfo
|
||||
, XSWildcard* const xsWildcard
|
||||
, XSSimpleTypeDefinition* const xsSimpleType
|
||||
, XSAttributeUseList* const xsAttList
|
||||
, XSTypeDefinition* const xsBaseType
|
||||
, XSParticle* const xsParticle
|
||||
, XSAnnotation* const headAnnot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSComplexTypeDefinition();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSComplexTypeDefinition methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [derivation method]: either <code>DERIVATION_EXTENSION</code>,
|
||||
* <code>DERIVATION_RESTRICTION</code>, or <code>DERIVATION_NONE</code>
|
||||
* (see <code>XSObject</code>).
|
||||
*/
|
||||
XSConstants::DERIVATION_TYPE getDerivationMethod() const;
|
||||
|
||||
/**
|
||||
* [abstract]: a boolean. Complex types for which <code>abstract</code> is
|
||||
* true must not be used as the type definition for the validation of
|
||||
* element information items.
|
||||
*/
|
||||
bool getAbstract() const;
|
||||
|
||||
/**
|
||||
* A set of attribute uses.
|
||||
*/
|
||||
XSAttributeUseList *getAttributeUses();
|
||||
|
||||
/**
|
||||
* Optional.An attribute wildcard.
|
||||
*/
|
||||
XSWildcard *getAttributeWildcard() const;
|
||||
|
||||
/**
|
||||
* [content type]: one of empty (<code>CONTENTTYPE_EMPTY</code>), a simple
|
||||
* type definition (<code>CONTENTTYPE_SIMPLE</code>), mixed (
|
||||
* <code>CONTENTTYPE_MIXED</code>), or element-only (
|
||||
* <code>CONTENTTYPE_ELEMENT</code>).
|
||||
*/
|
||||
CONTENT_TYPE getContentType() const;
|
||||
|
||||
/**
|
||||
* A simple type definition corresponding to simple content model,
|
||||
* otherwise <code>null</code>
|
||||
*/
|
||||
XSSimpleTypeDefinition *getSimpleType() const;
|
||||
|
||||
/**
|
||||
* A particle for mixed or element-only content model, otherwise
|
||||
* <code>null</code>
|
||||
*/
|
||||
XSParticle *getParticle() const;
|
||||
|
||||
/**
|
||||
* [prohibited substitutions]: a subset of {extension, restriction}
|
||||
* @param toTest Extension or restriction constants (see
|
||||
* <code>XSObject</code>).
|
||||
* @return True if toTest is a prohibited substitution, otherwise
|
||||
* false.
|
||||
*/
|
||||
bool isProhibitedSubstitution(XSConstants::DERIVATION_TYPE toTest);
|
||||
|
||||
/**
|
||||
* [prohibited substitutions]: A subset of {extension, restriction} or
|
||||
* <code>DERIVATION_NONE</code> represented as a bit flag (see
|
||||
* <code>XSObject</code>).
|
||||
*/
|
||||
short getProhibitedSubstitutions() const;
|
||||
|
||||
/**
|
||||
* A set of [annotations].
|
||||
*/
|
||||
XSAnnotationList *getAnnotations();
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
/**
|
||||
* A boolean that specifies if the type definition is
|
||||
* anonymous. Convenience attribute.
|
||||
*/
|
||||
bool getAnonymous() const;
|
||||
|
||||
/**
|
||||
* {base type definition}: either a simple type definition or a complex
|
||||
* type definition.
|
||||
*/
|
||||
XSTypeDefinition *getBaseType();
|
||||
|
||||
/**
|
||||
* Convenience method: check if this type is derived from the given
|
||||
* <code>ancestorType</code>.
|
||||
* @param ancestorType An ancestor type definition.
|
||||
* @return Return true if this type is derived from
|
||||
* <code>ancestorType</code>.
|
||||
*/
|
||||
bool derivedFromType(const XSTypeDefinition* const ancestorType);
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Set the base type
|
||||
*/
|
||||
void setBaseType(XSTypeDefinition* const xsBaseType);
|
||||
friend class XSObjectFactory;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSComplexTypeDefinition(const XSComplexTypeDefinition&);
|
||||
XSComplexTypeDefinition & operator=(const XSComplexTypeDefinition &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
ComplexTypeInfo* fComplexTypeInfo;
|
||||
XSWildcard* fXSWildcard;
|
||||
XSAttributeUseList* fXSAttributeUseList;
|
||||
XSSimpleTypeDefinition* fXSSimpleTypeDefinition;
|
||||
XSAnnotationList* fXSAnnotationList;
|
||||
XSParticle* fParticle;
|
||||
short fProhibitedSubstitution;
|
||||
};
|
||||
|
||||
|
||||
inline XSAttributeUseList* XSComplexTypeDefinition::getAttributeUses()
|
||||
{
|
||||
return fXSAttributeUseList;
|
||||
}
|
||||
|
||||
inline XSWildcard* XSComplexTypeDefinition::getAttributeWildcard() const
|
||||
{
|
||||
return fXSWildcard;
|
||||
}
|
||||
|
||||
inline XSSimpleTypeDefinition* XSComplexTypeDefinition::getSimpleType() const
|
||||
{
|
||||
return fXSSimpleTypeDefinition;
|
||||
}
|
||||
|
||||
inline short XSComplexTypeDefinition::getProhibitedSubstitutions() const
|
||||
{
|
||||
return fProhibitedSubstitution;
|
||||
}
|
||||
|
||||
inline XSParticle *XSComplexTypeDefinition::getParticle() const
|
||||
{
|
||||
return fParticle;
|
||||
}
|
||||
|
||||
inline void
|
||||
XSComplexTypeDefinition::setBaseType(XSTypeDefinition* const xsBaseType)
|
||||
{
|
||||
fBaseType = xsBaseType;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSConstants.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSCONSTANTS_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSCONSTANTS_HPP
|
||||
|
||||
#include <xercesc/util/RefVectorOf.hpp>
|
||||
#include <xercesc/util/RefArrayVectorOf.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This contains constants needed in the schema component model.
|
||||
*/
|
||||
|
||||
// forward definitions for typedefs
|
||||
class XSAnnotation;
|
||||
class XSAttributeUse;
|
||||
class XSFacet;
|
||||
class XSMultiValueFacet;
|
||||
class XSNamespaceItem;
|
||||
class XSParticle;
|
||||
class XSSimpleTypeDefinition;
|
||||
|
||||
// these typedefs are intended to help hide dependence on utility
|
||||
// classes, as well as to define more intuitive names for commonly
|
||||
// used concepts.
|
||||
|
||||
typedef RefVectorOf <XSAnnotation> XSAnnotationList;
|
||||
typedef RefVectorOf <XSAttributeUse> XSAttributeUseList;
|
||||
typedef RefVectorOf <XSFacet> XSFacetList;
|
||||
typedef RefVectorOf <XSMultiValueFacet> XSMultiValueFacetList;
|
||||
typedef RefVectorOf <XSNamespaceItem> XSNamespaceItemList;
|
||||
typedef RefVectorOf <XSParticle> XSParticleList;
|
||||
typedef RefVectorOf <XSSimpleTypeDefinition> XSSimpleTypeDefinitionList;
|
||||
typedef RefArrayVectorOf <XMLCh> StringList;
|
||||
|
||||
class XMLPARSER_EXPORT XSConstants
|
||||
{
|
||||
public:
|
||||
|
||||
// XML Schema Components
|
||||
enum COMPONENT_TYPE {
|
||||
/**
|
||||
* The object describes an attribute declaration.
|
||||
*/
|
||||
ATTRIBUTE_DECLARATION = 1,
|
||||
/**
|
||||
* The object describes an element declaration.
|
||||
*/
|
||||
ELEMENT_DECLARATION = 2,
|
||||
/**
|
||||
* The object describes a complex type or simple type definition.
|
||||
*/
|
||||
TYPE_DEFINITION = 3,
|
||||
/**
|
||||
* The object describes an attribute use definition.
|
||||
*/
|
||||
ATTRIBUTE_USE = 4,
|
||||
/**
|
||||
* The object describes an attribute group definition.
|
||||
*/
|
||||
ATTRIBUTE_GROUP_DEFINITION= 5,
|
||||
/**
|
||||
* The object describes a model group definition.
|
||||
*/
|
||||
MODEL_GROUP_DEFINITION = 6,
|
||||
/**
|
||||
* A model group.
|
||||
*/
|
||||
MODEL_GROUP = 7,
|
||||
/**
|
||||
* The object describes a particle.
|
||||
*/
|
||||
PARTICLE = 8,
|
||||
/**
|
||||
* The object describes a wildcard.
|
||||
*/
|
||||
WILDCARD = 9,
|
||||
/**
|
||||
* The object describes an identity constraint definition.
|
||||
*/
|
||||
IDENTITY_CONSTRAINT = 10,
|
||||
/**
|
||||
* The object describes a notation declaration.
|
||||
*/
|
||||
NOTATION_DECLARATION = 11,
|
||||
/**
|
||||
* The object describes an annotation.
|
||||
*/
|
||||
ANNOTATION = 12,
|
||||
/**
|
||||
* The object describes a constraining facet.
|
||||
*/
|
||||
FACET = 13,
|
||||
|
||||
/**
|
||||
* The object describes enumeration/pattern facets.
|
||||
*/
|
||||
MULTIVALUE_FACET = 14
|
||||
};
|
||||
|
||||
// Derivation constants
|
||||
enum DERIVATION_TYPE {
|
||||
/**
|
||||
* No constraint is available.
|
||||
*/
|
||||
DERIVATION_NONE = 0,
|
||||
/**
|
||||
* <code>XSTypeDefinition</code> final set or
|
||||
* <code>XSElementDeclaration</code> disallowed substitution group.
|
||||
*/
|
||||
DERIVATION_EXTENSION = 1,
|
||||
/**
|
||||
* <code>XSTypeDefinition</code> final set or
|
||||
* <code>XSElementDeclaration</code> disallowed substitution group.
|
||||
*/
|
||||
DERIVATION_RESTRICTION = 2,
|
||||
/**
|
||||
* <code>XSTypeDefinition</code> final set.
|
||||
*/
|
||||
DERIVATION_SUBSTITUTION = 4,
|
||||
/**
|
||||
* <code>XSTypeDefinition</code> final set.
|
||||
*/
|
||||
DERIVATION_UNION = 8,
|
||||
/**
|
||||
* <code>XSTypeDefinition</code> final set.
|
||||
*/
|
||||
DERIVATION_LIST = 16
|
||||
};
|
||||
|
||||
// Scope
|
||||
enum SCOPE {
|
||||
/**
|
||||
* The scope of a declaration within named model groups or attribute
|
||||
* groups is <code>absent</code>. The scope of such declaration is
|
||||
* determined when it is used in the construction of complex type
|
||||
* definitions.
|
||||
*/
|
||||
SCOPE_ABSENT = 0,
|
||||
/**
|
||||
* A scope of <code>global</code> identifies top-level declarations.
|
||||
*/
|
||||
SCOPE_GLOBAL = 1,
|
||||
/**
|
||||
* <code>Locally scoped</code> declarations are available for use only
|
||||
* within the complex type.
|
||||
*/
|
||||
SCOPE_LOCAL = 2
|
||||
};
|
||||
|
||||
// Value Constraint
|
||||
enum VALUE_CONSTRAINT {
|
||||
/**
|
||||
* Indicates that the component does not have any value constraint.
|
||||
*/
|
||||
VALUE_CONSTRAINT_NONE = 0,
|
||||
/**
|
||||
* Indicates that there is a default value constraint.
|
||||
*/
|
||||
VALUE_CONSTRAINT_DEFAULT = 1,
|
||||
/**
|
||||
* Indicates that there is a fixed value constraint for this attribute.
|
||||
*/
|
||||
VALUE_CONSTRAINT_FIXED = 2
|
||||
};
|
||||
|
||||
private:
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSConstants();
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSElementDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSELEMENTDECLARATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSELEMENTDECLARATION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
#include <xercesc/framework/psvi/XSNamedMap.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Element Declaration
|
||||
* component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSComplexTypeDefinition;
|
||||
class XSIDCDefinition;
|
||||
class XSTypeDefinition;
|
||||
class SchemaElementDecl;
|
||||
|
||||
class XMLPARSER_EXPORT XSElementDeclaration : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param schemaElementDecl
|
||||
* @param typeDefinition
|
||||
* @param substitutionGroupAffiliation
|
||||
* @param annot
|
||||
* @param identityConstraints
|
||||
* @param xsModel
|
||||
* @param elemScope
|
||||
* @param enclosingTypeDefinition
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSElementDeclaration
|
||||
(
|
||||
SchemaElementDecl* const schemaElementDecl
|
||||
, XSTypeDefinition* const typeDefinition
|
||||
, XSElementDeclaration* const substitutionGroupAffiliation
|
||||
, XSAnnotation* const annot
|
||||
, XSNamedMap<XSIDCDefinition>* const identityConstraints
|
||||
, XSModel* const xsModel
|
||||
, XSConstants::SCOPE elemScope = XSConstants::SCOPE_ABSENT
|
||||
, XSComplexTypeDefinition* const enclosingTypeDefinition = 0
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSElementDeclaration();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overridden XSXSObject methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSElementDeclaration methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [type definition]: either a simple type definition or a complex type
|
||||
* definition.
|
||||
*/
|
||||
XSTypeDefinition *getTypeDefinition() const;
|
||||
|
||||
/**
|
||||
* Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>,
|
||||
* or <code>SCOPE_ABSENT</code>. If the scope is local, then the
|
||||
* <code>enclosingCTDefinition</code> is present.
|
||||
*/
|
||||
XSConstants::SCOPE getScope() const;
|
||||
|
||||
/**
|
||||
* The complex type definition for locally scoped declarations (see
|
||||
* <code>scope</code>).
|
||||
*/
|
||||
XSComplexTypeDefinition *getEnclosingCTDefinition() const;
|
||||
|
||||
/**
|
||||
* [Value constraint]: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>.
|
||||
*/
|
||||
XSConstants::VALUE_CONSTRAINT getConstraintType() const;
|
||||
|
||||
/**
|
||||
* [Value constraint]: the actual value with respect to the [type
|
||||
* definition].
|
||||
*/
|
||||
const XMLCh *getConstraintValue();
|
||||
|
||||
/**
|
||||
* If nillable is true, then an element may also be valid if it carries
|
||||
* the namespace qualified attribute with local name <code>nil</code>
|
||||
* from namespace <code>http://www.w3.org/2001/XMLSchema-instance</code>
|
||||
* and value <code>true</code> (xsi:nil) even if it has no text or
|
||||
* element content despite a <code>content type</code> which would
|
||||
* otherwise require content.
|
||||
*/
|
||||
bool getNillable() const;
|
||||
|
||||
/**
|
||||
* identity-constraint definitions: a set of constraint definitions.
|
||||
*/
|
||||
XSNamedMap <XSIDCDefinition> *getIdentityConstraints();
|
||||
|
||||
/**
|
||||
* [substitution group affiliation]: optional. A top-level element
|
||||
* definition.
|
||||
*/
|
||||
XSElementDeclaration *getSubstitutionGroupAffiliation() const;
|
||||
|
||||
/**
|
||||
* Convenience method. Check if <code>exclusion</code> is a substitution
|
||||
* group exclusion for this element declaration.
|
||||
* @param exclusion
|
||||
* <code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code> or
|
||||
* <code>DERIVATION_NONE</code>. Represents final set for the element.
|
||||
* @return True if <code>exclusion</code> is a part of the substitution
|
||||
* group exclusion subset.
|
||||
*/
|
||||
bool isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion);
|
||||
|
||||
/**
|
||||
* [substitution group exclusions]: the returned value is a bit
|
||||
* combination of the subset of {
|
||||
* <code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>} or
|
||||
* <code>DERIVATION_NONE</code>.
|
||||
*/
|
||||
short getSubstitutionGroupExclusions() const;
|
||||
|
||||
/**
|
||||
* Convenience method. Check if <code>disallowed</code> is a disallowed
|
||||
* substitution for this element declaration.
|
||||
* @param disallowed {
|
||||
* <code>DERIVATION_SUBSTITUTION, DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>
|
||||
* } or <code>DERIVATION_NONE</code>. Represents a block set for the
|
||||
* element.
|
||||
* @return True if <code>disallowed</code> is a part of the substitution
|
||||
* group exclusion subset.
|
||||
*/
|
||||
bool isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed);
|
||||
|
||||
/**
|
||||
* [disallowed substitutions]: the returned value is a bit combination of
|
||||
* the subset of {
|
||||
* <code>DERIVATION_SUBSTITUTION, DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>
|
||||
* } corresponding to substitutions disallowed by this
|
||||
* <code>XSElementDeclaration</code> or <code>DERIVATION_NONE</code>.
|
||||
*/
|
||||
short getDisallowedSubstitutions() const;
|
||||
|
||||
/**
|
||||
* {abstract} A boolean.
|
||||
*/
|
||||
bool getAbstract() const;
|
||||
|
||||
/**
|
||||
* Optional. Annotation.
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
void setTypeDefinition(XSTypeDefinition* typeDefinition);
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet);
|
||||
friend class XSObjectFactory;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSElementDeclaration(const XSElementDeclaration&);
|
||||
XSElementDeclaration & operator=(const XSElementDeclaration &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
short fDisallowedSubstitutions;
|
||||
short fSubstitutionGroupExclusions;
|
||||
XSConstants::SCOPE fScope;
|
||||
SchemaElementDecl* fSchemaElementDecl;
|
||||
XSTypeDefinition* fTypeDefinition;
|
||||
XSComplexTypeDefinition* fEnclosingTypeDefinition;
|
||||
XSElementDeclaration* fSubstitutionGroupAffiliation;
|
||||
XSAnnotation* fAnnotation;
|
||||
XSNamedMap<XSIDCDefinition>* fIdentityConstraints;
|
||||
};
|
||||
|
||||
inline XSTypeDefinition* XSElementDeclaration::getTypeDefinition() const
|
||||
{
|
||||
return fTypeDefinition;
|
||||
}
|
||||
|
||||
inline XSNamedMap<XSIDCDefinition>* XSElementDeclaration::getIdentityConstraints()
|
||||
{
|
||||
return fIdentityConstraints;
|
||||
}
|
||||
|
||||
inline XSElementDeclaration* XSElementDeclaration::getSubstitutionGroupAffiliation() const
|
||||
{
|
||||
return fSubstitutionGroupAffiliation;
|
||||
}
|
||||
|
||||
inline short XSElementDeclaration::getSubstitutionGroupExclusions() const
|
||||
{
|
||||
return fSubstitutionGroupExclusions;
|
||||
}
|
||||
|
||||
inline short XSElementDeclaration::getDisallowedSubstitutions() const
|
||||
{
|
||||
return fDisallowedSubstitutions;
|
||||
}
|
||||
|
||||
inline XSAnnotation *XSElementDeclaration::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
inline XSConstants::SCOPE XSElementDeclaration::getScope() const
|
||||
{
|
||||
return fScope;
|
||||
}
|
||||
|
||||
inline XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() const
|
||||
{
|
||||
return fEnclosingTypeDefinition;
|
||||
}
|
||||
|
||||
inline void XSElementDeclaration::setTypeDefinition(XSTypeDefinition* typeDefinition)
|
||||
{
|
||||
fTypeDefinition = typeDefinition;
|
||||
}
|
||||
|
||||
inline void XSElementDeclaration::setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet)
|
||||
{
|
||||
fEnclosingTypeDefinition = toSet;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
151
project/jni/xerces/include/xercesc/framework/psvi/XSFacet.hpp
Normal file
151
project/jni/xerces/include/xercesc/framework/psvi/XSFacet.hpp
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSFacet.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSFACET_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSFACET_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This represents all Schema Facet components with the exception
|
||||
* of Enumeration and Pattern Facets, which are represented by the
|
||||
* XSMultiValueFacet interface.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
|
||||
class XMLPARSER_EXPORT XSFacet : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param facetKind
|
||||
* @param lexicalValue
|
||||
* @param isFixed
|
||||
* @param annot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSFacet
|
||||
(
|
||||
XSSimpleTypeDefinition::FACET facetKind
|
||||
, const XMLCh* const lexicalValue
|
||||
, bool isFixed
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSFacet();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSFacet methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* @return An indication as to the facet's type; see <code>XSSimpleTypeDefinition::FACET</code>
|
||||
*/
|
||||
XSSimpleTypeDefinition::FACET getFacetKind() const;
|
||||
|
||||
/**
|
||||
* @return Returns a value of a constraining facet.
|
||||
*/
|
||||
const XMLCh *getLexicalFacetValue() const;
|
||||
|
||||
/**
|
||||
* Check whether a facet value is fixed.
|
||||
*/
|
||||
bool isFixed() const;
|
||||
|
||||
/**
|
||||
* @return an annotation
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSFacet(const XSFacet&);
|
||||
XSFacet & operator=(const XSFacet &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
XSSimpleTypeDefinition::FACET fFacetKind;
|
||||
bool fIsFixed;
|
||||
const XMLCh* fLexicalValue;
|
||||
XSAnnotation* fAnnotation;
|
||||
};
|
||||
|
||||
inline XSSimpleTypeDefinition::FACET XSFacet::getFacetKind() const
|
||||
{
|
||||
return fFacetKind;
|
||||
}
|
||||
|
||||
inline const XMLCh* XSFacet::getLexicalFacetValue() const
|
||||
{
|
||||
return fLexicalValue;
|
||||
}
|
||||
|
||||
inline bool XSFacet::isFixed() const
|
||||
{
|
||||
return fIsFixed;
|
||||
}
|
||||
|
||||
inline XSAnnotation* XSFacet::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSIDCDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSIDCDEFINITION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSIDCDEFINITION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Identity Constraint
|
||||
* Definition component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class IdentityConstraint;
|
||||
|
||||
class XMLPARSER_EXPORT XSIDCDefinition : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Identity Constraints
|
||||
enum IC_CATEGORY {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
IC_KEY = 1,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
IC_KEYREF = 2,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
IC_UNIQUE = 3
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param identityConstraint
|
||||
* @param keyIC
|
||||
* @param headAnnot
|
||||
* @param stringList
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSIDCDefinition
|
||||
(
|
||||
IdentityConstraint* const identityConstraint
|
||||
, XSIDCDefinition* const keyIC
|
||||
, XSAnnotation* const headAnnot
|
||||
, StringList* const stringList
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSIDCDefinition();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overridden XSXSObject methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSIDCDefinition methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [identity-constraint category]: one of IC_KEY, IC_KEYREF or IC_UNIQUE.
|
||||
*/
|
||||
IC_CATEGORY getCategory() const;
|
||||
|
||||
/**
|
||||
* [selector]: a restricted XPath expression.
|
||||
*/
|
||||
const XMLCh *getSelectorStr();
|
||||
|
||||
/**
|
||||
* [fields]: a non-empty list of restricted XPath ([XPath]) expressions.
|
||||
*/
|
||||
StringList *getFieldStrs();
|
||||
|
||||
/**
|
||||
* [referenced key]: required if [identity-constraint category] is IC_KEYREF,
|
||||
* forbidden otherwise (when an identity-constraint definition with [
|
||||
* identity-constraint category] equal to IC_KEY or IC_UNIQUE).
|
||||
*/
|
||||
XSIDCDefinition *getRefKey() const;
|
||||
|
||||
/**
|
||||
* A set of [annotations].
|
||||
*/
|
||||
XSAnnotationList *getAnnotations();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSIDCDefinition(const XSIDCDefinition&);
|
||||
XSIDCDefinition & operator=(const XSIDCDefinition &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
IdentityConstraint* fIdentityConstraint;
|
||||
XSIDCDefinition* fKey;
|
||||
StringList* fStringList;
|
||||
XSAnnotationList* fXSAnnotationList;
|
||||
};
|
||||
|
||||
|
||||
inline StringList* XSIDCDefinition::getFieldStrs()
|
||||
{
|
||||
return fStringList;
|
||||
}
|
||||
|
||||
inline XSIDCDefinition* XSIDCDefinition::getRefKey() const
|
||||
{
|
||||
return fKey;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
338
project/jni/xerces/include/xercesc/framework/psvi/XSModel.hpp
Normal file
338
project/jni/xerces/include/xercesc/framework/psvi/XSModel.hpp
Normal file
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSModel.hpp 674012 2008-07-04 11:18:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSMODEL_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSMODEL_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
#include <xercesc/framework/psvi/XSNamedMap.hpp>
|
||||
|
||||
#include <xercesc/util/ValueVectorOf.hpp>
|
||||
#include <xercesc/validators/schema/SchemaElementDecl.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class contains all properties of the Schema infoitem as determined
|
||||
* after an entire validation episode. That is, it contains all the properties
|
||||
* of all the Schema Namespace Information objects that went into
|
||||
* the validation episode.
|
||||
* Since it is not like other components, it does not
|
||||
* inherit from the XSObject interface.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained. It is designed to be subclassed; subclasses will
|
||||
* specify under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class Grammar;
|
||||
class XMLGrammarPool;
|
||||
class XSAnnotation;
|
||||
class XSAttributeDeclaration;
|
||||
class XSAttributeGroupDefinition;
|
||||
class XSElementDeclaration;
|
||||
class XSModelGroupDefinition;
|
||||
class XSNamespaceItem;
|
||||
class XSNotationDeclaration;
|
||||
class XSTypeDefinition;
|
||||
class XSObjectFactory;
|
||||
|
||||
class XMLPARSER_EXPORT XSModel : public XMemory
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The constructor to be used when a grammar pool contains all needed info
|
||||
* @param grammarPool the grammar pool containing the underlying data structures
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSModel( XMLGrammarPool *grammarPool
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
/**
|
||||
* The constructor to be used when the XSModel must represent all
|
||||
* components in the union of an existing XSModel and a newly-created
|
||||
* Grammar(s) from the GrammarResolver
|
||||
*
|
||||
* @param baseModel the XSModel upon which this one is based
|
||||
* @param grammarResolver the grammar(s) whose components are to be merged
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSModel( XSModel *baseModel
|
||||
, GrammarResolver *grammarResolver
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSModel();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSModel methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a list of all namespaces that belong to
|
||||
* this schema. The value <code>null</code> is not a valid namespace
|
||||
* name, but if there are components that don't have a target namespace,
|
||||
* <code>null</code> is included in this list.
|
||||
*/
|
||||
StringList *getNamespaces();
|
||||
|
||||
/**
|
||||
* A set of namespace schema information information items ( of type
|
||||
* <code>XSNamespaceItem</code>), one for each namespace name which
|
||||
* appears as the target namespace of any schema component in the schema
|
||||
* used for that assessment, and one for absent if any schema component
|
||||
* in the schema had no target namespace. For more information see
|
||||
* schema information.
|
||||
*/
|
||||
XSNamespaceItemList *getNamespaceItems();
|
||||
|
||||
/**
|
||||
* [schema components]: a list of top-level components, i.e. element
|
||||
* declarations, attribute declarations, etc.
|
||||
* @param objectType The type of the declaration, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>,
|
||||
* <code>TYPE_DEFINITION</code> and any other component type that
|
||||
* may be a property of a schema component.
|
||||
* @return A list of top-level definition of the specified type in
|
||||
* <code>objectType</code> or <code>null</code>.
|
||||
*/
|
||||
XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a list of top-level component declarations
|
||||
* that are defined within the specified namespace, i.e. element
|
||||
* declarations, attribute declarations, etc.
|
||||
* @param objectType The type of the declaration, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>.
|
||||
* @param compNamespace The namespace to which declaration belongs or
|
||||
* <code>null</code> (for components with no target namespace).
|
||||
* @return A list of top-level definitions of the specified type in
|
||||
* <code>objectType</code> and defined in the specified
|
||||
* <code>namespace</code> or <code>null</code>.
|
||||
*/
|
||||
XSNamedMap<XSObject> *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType,
|
||||
const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* [annotations]: a set of annotations.
|
||||
*/
|
||||
XSAnnotationList *getAnnotations();
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level element declaration.
|
||||
* @param name The name of the declaration.
|
||||
* @param compNamespace The namespace of the declaration, null if absent.
|
||||
* @return A top-level element declaration or <code>null</code> if such
|
||||
* declaration does not exist.
|
||||
*/
|
||||
XSElementDeclaration *getElementDeclaration(const XMLCh *name
|
||||
, const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level attribute declaration.
|
||||
* @param name The name of the declaration.
|
||||
* @param compNamespace The namespace of the declaration, null if absent.
|
||||
* @return A top-level attribute declaration or <code>null</code> if such
|
||||
* declaration does not exist.
|
||||
*/
|
||||
XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name
|
||||
, const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level simple or complex type
|
||||
* definition.
|
||||
* @param name The name of the definition.
|
||||
* @param compNamespace The namespace of the declaration, null if absent.
|
||||
* @return An <code>XSTypeDefinition</code> or <code>null</code> if such
|
||||
* definition does not exist.
|
||||
*/
|
||||
XSTypeDefinition *getTypeDefinition(const XMLCh *name
|
||||
, const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level attribute group definition.
|
||||
* @param name The name of the definition.
|
||||
* @param compNamespace The namespace of the declaration, null if absent.
|
||||
* @return A top-level attribute group definition or <code>null</code> if
|
||||
* such definition does not exist.
|
||||
*/
|
||||
XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name
|
||||
, const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level model group definition.
|
||||
* @param name The name of the definition.
|
||||
* @param compNamespace The namespace of the declaration, null if absent.
|
||||
* @return A top-level model group definition definition or
|
||||
* <code>null</code> if such definition does not exist.
|
||||
*/
|
||||
XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name
|
||||
, const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level notation declaration.
|
||||
* @param name The name of the declaration.
|
||||
* @param compNamespace The namespace of the declaration, null if absent.
|
||||
* @return A top-level notation declaration or <code>null</code> if such
|
||||
* declaration does not exist.
|
||||
*/
|
||||
XSNotationDeclaration *getNotationDeclaration(const XMLCh *name
|
||||
, const XMLCh *compNamespace);
|
||||
|
||||
/**
|
||||
* Optional. Return a component given a component type and a unique Id.
|
||||
* May not be supported for all component types.
|
||||
* @param compId unique Id of the component within its type
|
||||
* @param compType type of the component
|
||||
* @return the component of the given type with the given Id, or 0
|
||||
* if no such component exists or this is unsupported for
|
||||
* this type of component.
|
||||
*/
|
||||
XSObject *getXSObjectById(XMLSize_t compId,
|
||||
XSConstants::COMPONENT_TYPE compType);
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
XMLStringPool* getURIStringPool();
|
||||
|
||||
XSNamespaceItem* getNamespaceItem(const XMLCh* const key);
|
||||
|
||||
/**
|
||||
* Get the XSObject (i.e. XSElementDeclaration) that corresponds to
|
||||
* to a schema grammar component (i.e. SchemaElementDecl)
|
||||
* @param key schema component object
|
||||
*
|
||||
* @return the corresponding XSObject
|
||||
*/
|
||||
XSObject* getXSObject(void* key);
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
void addGrammarToXSModel
|
||||
(
|
||||
XSNamespaceItem* namespaceItem
|
||||
);
|
||||
void addS4SToXSModel
|
||||
(
|
||||
XSNamespaceItem* const namespaceItem
|
||||
, RefHashTableOf<DatatypeValidator>* const builtInDV
|
||||
);
|
||||
void addComponentToNamespace
|
||||
(
|
||||
XSNamespaceItem* const namespaceItem
|
||||
, XSObject* const component
|
||||
, XMLSize_t componentIndex
|
||||
, bool addToXSModel = true
|
||||
);
|
||||
|
||||
void addComponentToIdVector
|
||||
(
|
||||
XSObject* const component
|
||||
, XMLSize_t componentIndex
|
||||
);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSModel(const XSModel&);
|
||||
XSModel & operator=(const XSModel &);
|
||||
|
||||
protected:
|
||||
friend class XSObjectFactory;
|
||||
friend class XSObject;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fMemoryManager:
|
||||
// used for any memory allocations
|
||||
MemoryManager* const fMemoryManager;
|
||||
|
||||
StringList* fNamespaceStringList;
|
||||
XSNamespaceItemList* fXSNamespaceItemList;
|
||||
|
||||
RefVectorOf<XSObject>* fIdVector[XSConstants::MULTIVALUE_FACET];
|
||||
|
||||
/* Need a XSNamedMap for each component top-level?
|
||||
ATTRIBUTE_DECLARATION = 1,
|
||||
ELEMENT_DECLARATION = 2,
|
||||
TYPE_DEFINITION = 3,
|
||||
ATTRIBUTE_USE = 4, no
|
||||
ATTRIBUTE_GROUP_DEFINITION= 5,
|
||||
MODEL_GROUP_DEFINITION = 6,
|
||||
MODEL_GROUP = 7, no
|
||||
PARTICLE = 8, no
|
||||
WILDCARD = 9, no
|
||||
IDENTITY_CONSTRAINT = 10, no
|
||||
NOTATION_DECLARATION = 11,
|
||||
ANNOTATION = 12, no
|
||||
FACET = 13, no
|
||||
MULTIVALUE_FACET = 14 no
|
||||
*/
|
||||
XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET];
|
||||
XMLStringPool* fURIStringPool;
|
||||
XSAnnotationList* fXSAnnotationList;
|
||||
RefHashTableOf<XSNamespaceItem>* fHashNamespace;
|
||||
XSObjectFactory* fObjFactory;
|
||||
RefVectorOf<XSNamespaceItem>* fDeleteNamespace;
|
||||
XSModel* fParent;
|
||||
bool fDeleteParent;
|
||||
bool fAddedS4SGrammar;
|
||||
};
|
||||
|
||||
inline XMLStringPool* XSModel::getURIStringPool()
|
||||
{
|
||||
return fURIStringPool;
|
||||
}
|
||||
|
||||
inline StringList *XSModel::getNamespaces()
|
||||
{
|
||||
return fNamespaceStringList;
|
||||
}
|
||||
|
||||
inline XSNamespaceItemList *XSModel::getNamespaceItems()
|
||||
{
|
||||
return fXSNamespaceItemList;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSModelGroup.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSMODELGROUP_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSMODELGROUP_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Model Group
|
||||
* component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSParticle;
|
||||
|
||||
class XMLPARSER_EXPORT XSModelGroup : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Content model compositors
|
||||
enum COMPOSITOR_TYPE {
|
||||
/**
|
||||
* This constant value signifies a sequence operator.
|
||||
*/
|
||||
COMPOSITOR_SEQUENCE = 1,
|
||||
/**
|
||||
* This constant value signifies a choice operator.
|
||||
*/
|
||||
COMPOSITOR_CHOICE = 2,
|
||||
/**
|
||||
* This content model represents a simplified version of the SGML
|
||||
* &-Connector and is limited to the top-level of any content model.
|
||||
* No element in the all content model may appear more than once.
|
||||
*/
|
||||
COMPOSITOR_ALL = 3
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param compositorType
|
||||
* @param particleList
|
||||
* @param annot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSModelGroup
|
||||
(
|
||||
COMPOSITOR_TYPE compositorType
|
||||
, XSParticleList* const particleList
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSModelGroup();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSModelGroup methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [compositor]: one of all, choice or sequence. The valid constants
|
||||
* values are:
|
||||
* <code>COMPOSITOR_SEQUENCE, COMPOSITOR_CHOICE, COMPOSITOR_ALL</code>.
|
||||
*/
|
||||
COMPOSITOR_TYPE getCompositor() const;
|
||||
|
||||
/**
|
||||
* A list of [particles].
|
||||
*/
|
||||
XSParticleList *getParticles() const;
|
||||
|
||||
/**
|
||||
* Optional. An [annotation].
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSModelGroup(const XSModelGroup&);
|
||||
XSModelGroup & operator=(const XSModelGroup &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
COMPOSITOR_TYPE fCompositorType;
|
||||
XSParticleList* fParticleList;
|
||||
XSAnnotation* fAnnotation;
|
||||
};
|
||||
|
||||
inline XSModelGroup::COMPOSITOR_TYPE XSModelGroup::getCompositor() const
|
||||
{
|
||||
return fCompositorType;
|
||||
}
|
||||
|
||||
inline XSParticleList* XSModelGroup::getParticles() const
|
||||
{
|
||||
return fParticleList;
|
||||
}
|
||||
|
||||
inline XSAnnotation* XSModelGroup::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSModelGroupDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSMODELGROUPDEFINITION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSMODELGROUPDEFINITION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Model Group
|
||||
* Definition component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSModelGroup;
|
||||
class XSParticle;
|
||||
class XercesGroupInfo;
|
||||
|
||||
class XMLPARSER_EXPORT XSModelGroupDefinition : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param groupInfo
|
||||
* @param groupParticle
|
||||
* @param annot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSModelGroupDefinition
|
||||
(
|
||||
XercesGroupInfo* const groupInfo
|
||||
, XSParticle* const groupParticle
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSModelGroupDefinition();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overridden XSXSObject methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSModelGroupDefinition methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* A model group.
|
||||
*/
|
||||
XSModelGroup *getModelGroup();
|
||||
|
||||
/**
|
||||
* Optional. An [annotation].
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSModelGroupDefinition(const XSModelGroupDefinition&);
|
||||
XSModelGroupDefinition & operator=(const XSModelGroupDefinition &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
XercesGroupInfo* fGroupInfo;
|
||||
XSParticle* fModelGroupParticle;
|
||||
XSAnnotation* fAnnotation;
|
||||
};
|
||||
|
||||
inline XSAnnotation* XSModelGroupDefinition::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSMultiValueFacet.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSMULTIVALUEFACET_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSMULTIVALUEFACET_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class represents all Schema Facets which may possess multiple
|
||||
* lexical values/annotations (i.e., Pattern and Enumeration facets).
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
|
||||
class XMLPARSER_EXPORT XSMultiValueFacet : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param facetKind
|
||||
* @param lexicalValues
|
||||
* @param isFixed
|
||||
* @param headAnnot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSMultiValueFacet
|
||||
(
|
||||
XSSimpleTypeDefinition::FACET facetKind
|
||||
, StringList* lexicalValues
|
||||
, bool isFixed
|
||||
, XSAnnotation* const headAnnot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSMultiValueFacet();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSMultiValueFacet methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* @return An indication as to the facet's type; see <code>XSSimpleTypeDefinition::FACET</code>
|
||||
*/
|
||||
XSSimpleTypeDefinition::FACET getFacetKind() const;
|
||||
|
||||
/**
|
||||
* @return Returns the values of a constraining facet.
|
||||
*/
|
||||
StringList *getLexicalFacetValues();
|
||||
|
||||
/**
|
||||
* Check whether a facet value is fixed.
|
||||
*/
|
||||
bool isFixed() const;
|
||||
|
||||
/**
|
||||
* @return the annotations belonging to this facet's values
|
||||
*/
|
||||
XSAnnotationList *getAnnotations();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSMultiValueFacet(const XSMultiValueFacet&);
|
||||
XSMultiValueFacet & operator=(const XSMultiValueFacet &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
XSSimpleTypeDefinition::FACET fFacetKind;
|
||||
bool fIsFixed;
|
||||
StringList* fLexicalValues; // not owned by this class
|
||||
XSAnnotationList* fXSAnnotationList;
|
||||
};
|
||||
|
||||
|
||||
inline XSSimpleTypeDefinition::FACET XSMultiValueFacet::getFacetKind() const
|
||||
{
|
||||
return fFacetKind;
|
||||
}
|
||||
|
||||
inline bool XSMultiValueFacet::isFixed() const
|
||||
{
|
||||
return fIsFixed;
|
||||
}
|
||||
|
||||
inline StringList *XSMultiValueFacet::getLexicalFacetValues()
|
||||
{
|
||||
return fLexicalValues;
|
||||
}
|
||||
|
||||
inline XSAnnotationList *XSMultiValueFacet::getAnnotations()
|
||||
{
|
||||
return fXSAnnotationList;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
138
project/jni/xerces/include/xercesc/framework/psvi/XSNamedMap.hpp
Normal file
138
project/jni/xerces/include/xercesc/framework/psvi/XSNamedMap.hpp
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSNamedMap.hpp 674012 2008-07-04 11:18:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP
|
||||
|
||||
|
||||
#include <xercesc/util/XMemory.hpp>
|
||||
#include <xercesc/util/RefHash2KeysTableOf.hpp>
|
||||
#include <xercesc/util/RefVectorOf.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class XMLStringPool;
|
||||
|
||||
/*
|
||||
* This template provides convenient mappings between name,namespace
|
||||
* pairs and individual components, as well as means to iterate through all the
|
||||
* named components on some object.
|
||||
*/
|
||||
|
||||
template <class TVal> class XSNamedMap: public XMemory
|
||||
{
|
||||
public:
|
||||
// -----------------------------------------------------------------------
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
XSNamedMap(const XMLSize_t maxElems,
|
||||
const XMLSize_t modulus,
|
||||
XMLStringPool* uriStringPool,
|
||||
const bool adoptElems,
|
||||
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSNamedMap();
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// XSNamedMap methods
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name XSNamedMap methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The number of <code>XSObjects</code> in the <code>XSObjectList</code>.
|
||||
* The range of valid child object indices is 0 to
|
||||
* <code>mapLength-1</code> inclusive.
|
||||
*/
|
||||
XMLSize_t getLength() const;
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>th item in the collection. The index
|
||||
* starts at 0. If <code>index</code> is greater than or equal to the
|
||||
* number of objects in the list, this returns <code>null</code>.
|
||||
* @param index index into the collection.
|
||||
* @return The <code>XSObject</code> at the <code>index</code>th
|
||||
* position in the <code>XSObjectList</code>, or <code>null</code> if
|
||||
* that is not a valid index.
|
||||
*/
|
||||
TVal *item(XMLSize_t index);
|
||||
const TVal *item(XMLSize_t index) const;
|
||||
|
||||
/**
|
||||
* Retrieves a component specified by local name and namespace URI.
|
||||
* <br>applications must use the value null as the
|
||||
* <code>compNamespace</code> parameter for components whose targetNamespace property
|
||||
* is absent.
|
||||
* @param compNamespace The namespace URI of the component to retrieve.
|
||||
* @param localName The local name of the component to retrieve.
|
||||
* @return A component (of any type) with the specified local
|
||||
* name and namespace URI, or <code>null</code> if they do not
|
||||
* identify any node in this map.
|
||||
*/
|
||||
TVal *itemByName(const XMLCh *compNamespace,
|
||||
const XMLCh *localName);
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
void addElement(TVal* const toAdd, const XMLCh* key1, const XMLCh* key2);
|
||||
//@}
|
||||
|
||||
|
||||
private :
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSNamedMap(const XSNamedMap<TVal>&);
|
||||
XSNamedMap<TVal>& operator=(const XSNamedMap<TVal>&);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Data members
|
||||
//
|
||||
// fMemoryManager
|
||||
// manager used to allocate memory needed by this object
|
||||
MemoryManager *const fMemoryManager;
|
||||
XMLStringPool* fURIStringPool;
|
||||
RefVectorOf<TVal>* fVector;
|
||||
RefHash2KeysTableOf<TVal>* fHash;
|
||||
};
|
||||
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#if !defined(XERCES_TMPLSINC)
|
||||
#include <xercesc/framework/psvi/XSNamedMap.c>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSNamespaceItem.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
#include <xercesc/framework/psvi/XSNamedMap.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class contains all properties of the Schema Namespace Information infoitem.
|
||||
* These items correspond to the result of processing a schema document
|
||||
* and all its included/redefined schema documents. It corresponds to the
|
||||
* schema component discussed in the schema specifications, but since it
|
||||
* is not like other components does not inherit from the XSObject interface.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained. It is designed to be subclassed; subclasses will
|
||||
* specify under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSAttributeDeclaration;
|
||||
class XSAttributeGroupDefinition;
|
||||
class XSElementDeclaration;
|
||||
class XSModelGroupDefinition;
|
||||
class XSNotationDeclaration;
|
||||
class XSTypeDefinition;
|
||||
class SchemaGrammar;
|
||||
class XSModel;
|
||||
|
||||
class XMLPARSER_EXPORT XSNamespaceItem : public XMemory
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param xsModel
|
||||
* @param grammar
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSNamespaceItem
|
||||
(
|
||||
XSModel* const xsModel
|
||||
, SchemaGrammar* const grammar
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
XSNamespaceItem
|
||||
(
|
||||
XSModel* const xsModel
|
||||
, const XMLCh* const schemaNamespace
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSNamespaceItem();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSNamespaceItem methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [schema namespace]: A namespace name or <code>null</code>
|
||||
* corresponding to the target namespace of the schema document.
|
||||
*/
|
||||
const XMLCh *getSchemaNamespace() const;
|
||||
|
||||
/**
|
||||
* [schema components]: a list of top-level components, i.e. element
|
||||
* declarations, attribute declarations, etc.
|
||||
* @param objectType The type of the declaration, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>,
|
||||
* <code>TYPE_DEFINITION</code> and any other component type that
|
||||
* may be a property of a schema component.
|
||||
* @return A list of top-level definition of the specified type in
|
||||
* <code>objectType</code> or <code>null</code>.
|
||||
*/
|
||||
XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
|
||||
|
||||
/**
|
||||
* [annotations]: a set of annotations.
|
||||
*/
|
||||
XSAnnotationList *getAnnotations();
|
||||
const XSAnnotationList *getAnnotations() const;
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level element declaration.
|
||||
* @param name The name of the declaration.
|
||||
* @return A top-level element declaration or <code>null</code> if such
|
||||
* declaration does not exist.
|
||||
*/
|
||||
XSElementDeclaration *getElementDeclaration(const XMLCh *name);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level attribute declaration.
|
||||
* @param name The name of the declaration.
|
||||
* @return A top-level attribute declaration or <code>null</code> if such
|
||||
* declaration does not exist.
|
||||
*/
|
||||
XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level simple or complex type
|
||||
* definition.
|
||||
* @param name The name of the definition.
|
||||
* @return An <code>XSTypeDefinition</code> or <code>null</code> if such
|
||||
* definition does not exist.
|
||||
*/
|
||||
XSTypeDefinition *getTypeDefinition(const XMLCh *name);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level attribute group definition.
|
||||
* @param name The name of the definition.
|
||||
* @return A top-level attribute group definition or <code>null</code> if
|
||||
* such definition does not exist.
|
||||
*/
|
||||
XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level model group definition.
|
||||
* @param name The name of the definition.
|
||||
* @return A top-level model group definition definition or
|
||||
* <code>null</code> if such definition does not exist.
|
||||
*/
|
||||
XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a top-level notation declaration.
|
||||
* @param name The name of the declaration.
|
||||
* @return A top-level notation declaration or <code>null</code> if such
|
||||
* declaration does not exist.
|
||||
*/
|
||||
XSNotationDeclaration *getNotationDeclaration(const XMLCh *name);
|
||||
|
||||
/**
|
||||
* [document location] - a list of locations URI for the documents that
|
||||
* contributed to the XSModel.
|
||||
*/
|
||||
const StringList *getDocumentLocations();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSNamespaceItem(const XSNamespaceItem&);
|
||||
XSNamespaceItem & operator=(const XSNamespaceItem &);
|
||||
|
||||
protected:
|
||||
friend class XSModel;
|
||||
friend class XSObjectFactory;
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fMemoryManager:
|
||||
// used for any memory allocations
|
||||
MemoryManager* const fMemoryManager;
|
||||
SchemaGrammar* fGrammar;
|
||||
XSModel* fXSModel;
|
||||
|
||||
/* Need a XSNamedMap for each component top-level?
|
||||
that is top level.
|
||||
ATTRIBUTE_DECLARATION = 1,
|
||||
ELEMENT_DECLARATION = 2,
|
||||
TYPE_DEFINITION = 3,
|
||||
ATTRIBUTE_USE = 4, no
|
||||
ATTRIBUTE_GROUP_DEFINITION= 5,
|
||||
MODEL_GROUP_DEFINITION = 6,
|
||||
MODEL_GROUP = 7, no
|
||||
PARTICLE = 8, no
|
||||
WILDCARD = 9, no
|
||||
IDENTITY_CONSTRAINT = 10, no
|
||||
NOTATION_DECLARATION = 11,
|
||||
ANNOTATION = 12, no
|
||||
FACET = 13, no
|
||||
MULTIVALUE_FACET = 14 no
|
||||
*/
|
||||
XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET];
|
||||
XSAnnotationList* fXSAnnotationList;
|
||||
RefHashTableOf<XSObject>* fHashMap[XSConstants::MULTIVALUE_FACET];
|
||||
const XMLCh* fSchemaNamespace;
|
||||
};
|
||||
|
||||
inline XSAnnotationList* XSNamespaceItem::getAnnotations()
|
||||
{
|
||||
return fXSAnnotationList;
|
||||
}
|
||||
|
||||
inline const XSAnnotationList* XSNamespaceItem::getAnnotations() const
|
||||
{
|
||||
return fXSAnnotationList;
|
||||
}
|
||||
|
||||
inline const XMLCh *XSNamespaceItem::getSchemaNamespace() const
|
||||
{
|
||||
return fSchemaNamespace;
|
||||
}
|
||||
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSNotationDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSNOTATIONDECLARATION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSNOTATIONDECLARATION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Notation Declaration
|
||||
* component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XMLNotationDecl;
|
||||
|
||||
class XMLPARSER_EXPORT XSNotationDeclaration : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param xmlNotationDecl
|
||||
* @param annot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSNotationDeclaration
|
||||
(
|
||||
XMLNotationDecl* const xmlNotationDecl
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSNotationDeclaration();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overridden XSXSObject methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSNotationDeclaration methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The URI reference representing the system identifier for the notation
|
||||
* declaration, if present, <code>null</code> otherwise.
|
||||
*/
|
||||
const XMLCh *getSystemId();
|
||||
|
||||
/**
|
||||
* The string representing the public identifier for this notation
|
||||
* declaration, if present; <code>null</code> otherwise.
|
||||
*/
|
||||
const XMLCh *getPublicId();
|
||||
|
||||
/**
|
||||
* Optional. An [annotation].
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSNotationDeclaration(const XSNotationDeclaration&);
|
||||
XSNotationDeclaration & operator=(const XSNotationDeclaration &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
XMLNotationDecl* fXMLNotationDecl;
|
||||
XSAnnotation* fAnnotation;
|
||||
};
|
||||
|
||||
inline XSAnnotation* XSNotationDeclaration::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
152
project/jni/xerces/include/xercesc/framework/psvi/XSObject.hpp
Normal file
152
project/jni/xerces/include/xercesc/framework/psvi/XSObject.hpp
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSObject.hpp 674012 2008-07-04 11:18:21Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSOBJECT_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSOBJECT_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/framework/psvi/XSConstants.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* The XSObject forms the base of the Schema Component Model. It contains
|
||||
* all properties common to the majority of XML Schema components.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained. It is designed to be subclassed; subclasses will
|
||||
* specify under what conditions it may be relied upon to have meaningful contents.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSNamespaceItem;
|
||||
class XSModel;
|
||||
|
||||
class XMLPARSER_EXPORT XSObject : public XMemory
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param compType
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSObject
|
||||
(
|
||||
XSConstants::COMPONENT_TYPE compType
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~XSObject();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSObject methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The <code>type</code> of this object, i.e.
|
||||
* <code>ELEMENT_DECLARATION</code>.
|
||||
*/
|
||||
XSConstants::COMPONENT_TYPE getType() const;
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
virtual const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
virtual const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
virtual XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
/**
|
||||
* Optional. Return a unique identifier for a component within this XSModel, to
|
||||
* optimize querying. May not be defined for all types of component.
|
||||
* @return id unique for this type of component within this XSModel or 0
|
||||
* to indicate that this is not supported for this type of component.
|
||||
*/
|
||||
virtual XMLSize_t getId() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
/**
|
||||
* Set the id to be returned on getId().
|
||||
*/
|
||||
void setId(XMLSize_t id);
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSObject(const XSObject&);
|
||||
XSObject & operator=(const XSObject &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fMemoryManager:
|
||||
// used for any memory allocations
|
||||
// fComponentType
|
||||
// the type of the actual component
|
||||
XSConstants::COMPONENT_TYPE fComponentType;
|
||||
XSModel* fXSModel;
|
||||
MemoryManager* fMemoryManager;
|
||||
XMLSize_t fId;
|
||||
};
|
||||
|
||||
inline XSConstants::COMPONENT_TYPE XSObject::getType() const
|
||||
{
|
||||
return fComponentType;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
198
project/jni/xerces/include/xercesc/framework/psvi/XSParticle.hpp
Normal file
198
project/jni/xerces/include/xercesc/framework/psvi/XSParticle.hpp
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSParticle.hpp 883665 2009-11-24 11:41:38Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSPARTICLE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSPARTICLE_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Particle
|
||||
* component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSElementDeclaration;
|
||||
class XSModelGroup;
|
||||
class XSWildcard;
|
||||
|
||||
class XMLPARSER_EXPORT XSParticle : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// possible terms of this particle
|
||||
enum TERM_TYPE {
|
||||
/*
|
||||
* an empty particle
|
||||
*/
|
||||
TERM_EMPTY = 0,
|
||||
/*
|
||||
* the particle has element content
|
||||
*/
|
||||
TERM_ELEMENT = XSConstants::ELEMENT_DECLARATION,
|
||||
/*
|
||||
* the particle's content is a model group
|
||||
*/
|
||||
TERM_MODELGROUP = XSConstants::MODEL_GROUP_DEFINITION,
|
||||
/*
|
||||
* the particle's content is a wildcard
|
||||
*/
|
||||
TERM_WILDCARD = XSConstants::WILDCARD
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param termType
|
||||
* @param xsModel
|
||||
* @param particleTerm
|
||||
* @param minOccurs
|
||||
* @param maxOccurs
|
||||
* @param unbounded
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSParticle
|
||||
(
|
||||
TERM_TYPE termType
|
||||
, XSModel* const xsModel
|
||||
, XSObject* const particleTerm
|
||||
, XMLSize_t minOccurs
|
||||
, XMLSize_t maxOccurs
|
||||
, bool unbounded
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSParticle();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSParticle methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [min occurs]: determines the minimum number of terms that can occur.
|
||||
*/
|
||||
XMLSize_t getMinOccurs() const;
|
||||
|
||||
/**
|
||||
* [max occurs] determines the maximum number of terms that can occur. To
|
||||
* query for value of unbounded use <code>maxOccursUnbounded</code>.
|
||||
*/
|
||||
XMLSize_t getMaxOccurs() const;
|
||||
|
||||
/**
|
||||
* [max occurs] whether the maxOccurs value is unbounded.
|
||||
*/
|
||||
bool getMaxOccursUnbounded() const;
|
||||
|
||||
/**
|
||||
* Returns the type of the [term]: one of
|
||||
* TERM_EMPTY, TERM_ELEMENT, TERM_MODELGROUP, or TERM_WILDCARD.
|
||||
*/
|
||||
TERM_TYPE getTermType() const;
|
||||
|
||||
/**
|
||||
* If this particle has an [element declaration] for its term,
|
||||
* this method returns that declaration; otherwise, it returns 0.
|
||||
* @returns The element declaration that is the [term] of this Particle
|
||||
* if and only if getTermType() == TERM_ELEMENT.
|
||||
*/
|
||||
XSElementDeclaration *getElementTerm();
|
||||
|
||||
/**
|
||||
* If this particle has a [model group] for its term,
|
||||
* this method returns that definition; otherwise, it returns 0.
|
||||
* @returns The model group that is the [term] of this Particle
|
||||
* if and only if getTermType() == TERM_MODELGROUP.
|
||||
*/
|
||||
XSModelGroup *getModelGroupTerm();
|
||||
|
||||
/**
|
||||
* If this particle has an [wildcard] for its term,
|
||||
* this method returns that declaration; otherwise, it returns 0.
|
||||
* @returns The wildcard declaration that is the [term] of this Particle
|
||||
* if and only if getTermType() == TERM_WILDCARD.
|
||||
*/
|
||||
XSWildcard *getWildcardTerm();
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSParticle(const XSParticle&);
|
||||
XSParticle & operator=(const XSParticle &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
TERM_TYPE fTermType;
|
||||
XMLSize_t fMinOccurs;
|
||||
XMLSize_t fMaxOccurs;
|
||||
bool fUnbounded;
|
||||
XSObject* fTerm;
|
||||
};
|
||||
|
||||
inline XMLSize_t XSParticle::getMinOccurs() const
|
||||
{
|
||||
return fMinOccurs;
|
||||
}
|
||||
|
||||
inline XMLSize_t XSParticle::getMaxOccurs() const
|
||||
{
|
||||
return fMaxOccurs;
|
||||
}
|
||||
|
||||
inline bool XSParticle::getMaxOccursUnbounded() const
|
||||
{
|
||||
return fUnbounded;
|
||||
}
|
||||
|
||||
inline XSParticle::TERM_TYPE XSParticle::getTermType() const
|
||||
{
|
||||
return fTermType;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,458 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSSimpleTypeDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSTypeDefinition.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class represents a simpleType definition
|
||||
* schema component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class XSFacet;
|
||||
class XSMultiValueFacet;
|
||||
class DatatypeValidator;
|
||||
|
||||
class XMLPARSER_EXPORT XSSimpleTypeDefinition : public XSTypeDefinition
|
||||
{
|
||||
public:
|
||||
|
||||
// Variety definitions
|
||||
enum VARIETY {
|
||||
/**
|
||||
* The variety is absent for the anySimpleType definition.
|
||||
*/
|
||||
VARIETY_ABSENT = 0,
|
||||
/**
|
||||
* <code>Atomic</code> type.
|
||||
*/
|
||||
VARIETY_ATOMIC = 1,
|
||||
/**
|
||||
* <code>List</code> type.
|
||||
*/
|
||||
VARIETY_LIST = 2,
|
||||
/**
|
||||
* <code>Union</code> type.
|
||||
*/
|
||||
VARIETY_UNION = 3
|
||||
};
|
||||
|
||||
// Facets
|
||||
enum FACET {
|
||||
/**
|
||||
* No facets defined.
|
||||
*/
|
||||
FACET_NONE = 0,
|
||||
/**
|
||||
* 4.3.1 Length
|
||||
*/
|
||||
FACET_LENGTH = 1,
|
||||
/**
|
||||
* 4.3.2 minLength.
|
||||
*/
|
||||
FACET_MINLENGTH = 2,
|
||||
/**
|
||||
* 4.3.3 maxLength.
|
||||
*/
|
||||
FACET_MAXLENGTH = 4,
|
||||
/**
|
||||
* 4.3.4 pattern.
|
||||
*/
|
||||
FACET_PATTERN = 8,
|
||||
/**
|
||||
* 4.3.5 whitespace.
|
||||
*/
|
||||
FACET_WHITESPACE = 16,
|
||||
/**
|
||||
* 4.3.7 maxInclusive.
|
||||
*/
|
||||
FACET_MAXINCLUSIVE = 32,
|
||||
/**
|
||||
* 4.3.9 maxExclusive.
|
||||
*/
|
||||
FACET_MAXEXCLUSIVE = 64,
|
||||
/**
|
||||
* 4.3.9 minExclusive.
|
||||
*/
|
||||
FACET_MINEXCLUSIVE = 128,
|
||||
/**
|
||||
* 4.3.10 minInclusive.
|
||||
*/
|
||||
FACET_MININCLUSIVE = 256,
|
||||
/**
|
||||
* 4.3.11 totalDigits .
|
||||
*/
|
||||
FACET_TOTALDIGITS = 512,
|
||||
/**
|
||||
* 4.3.12 fractionDigits.
|
||||
*/
|
||||
FACET_FRACTIONDIGITS = 1024,
|
||||
/**
|
||||
* 4.3.5 enumeration.
|
||||
*/
|
||||
FACET_ENUMERATION = 2048
|
||||
};
|
||||
|
||||
// possible order relations
|
||||
enum ORDERING {
|
||||
/**
|
||||
* A constant defined for the 'ordered' fundamental facet: Not ordered.
|
||||
*/
|
||||
ORDERED_FALSE = 0,
|
||||
/**
|
||||
* A constant defined for the 'ordered' fundamental facet: partially
|
||||
* ordered.
|
||||
*/
|
||||
ORDERED_PARTIAL = 1,
|
||||
/**
|
||||
* A constant defined for the 'ordered' fundamental facet: total ordered.
|
||||
*/
|
||||
ORDERED_TOTAL = 2
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param datatypeValidator
|
||||
* @param stVariety
|
||||
* @param xsBaseType
|
||||
* @param primitiveOrItemType
|
||||
* @param memberTypes
|
||||
* @param headAnnot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSSimpleTypeDefinition
|
||||
(
|
||||
DatatypeValidator* const datatypeValidator
|
||||
, VARIETY stVariety
|
||||
, XSTypeDefinition* const xsBaseType
|
||||
, XSSimpleTypeDefinition* const primitiveOrItemType
|
||||
, XSSimpleTypeDefinitionList* const memberTypes
|
||||
, XSAnnotation* headAnnot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSSimpleTypeDefinition();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSSimpleTypeDefinition methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* [variety]: one of {atomic, list, union} or absent
|
||||
*/
|
||||
VARIETY getVariety() const;
|
||||
|
||||
/**
|
||||
* If variety is <code>atomic</code> the primitive type definition (a
|
||||
* built-in primitive datatype definition or the simple ur-type
|
||||
* definition) is available, otherwise <code>null</code>.
|
||||
*/
|
||||
XSSimpleTypeDefinition *getPrimitiveType();
|
||||
|
||||
/**
|
||||
* If variety is <code>list</code> the item type definition (an atomic or
|
||||
* union simple type definition) is available, otherwise
|
||||
* <code>null</code>.
|
||||
*/
|
||||
XSSimpleTypeDefinition *getItemType();
|
||||
|
||||
/**
|
||||
* If variety is <code>union</code> the list of member type definitions (a
|
||||
* non-empty sequence of simple type definitions) is available,
|
||||
* otherwise <code>null</code>.
|
||||
*/
|
||||
XSSimpleTypeDefinitionList *getMemberTypes() const;
|
||||
|
||||
/**
|
||||
* [facets]: get all facets defined on this type. The value is a bit
|
||||
* combination of FACET_XXX constants of all defined facets.
|
||||
*/
|
||||
int getDefinedFacets() const;
|
||||
|
||||
/**
|
||||
* Convenience method. [Facets]: check whether a facet is defined on this
|
||||
* type.
|
||||
* @param facetName The name of the facet.
|
||||
* @return True if the facet is defined, false otherwise.
|
||||
*/
|
||||
bool isDefinedFacet(FACET facetName);
|
||||
|
||||
/**
|
||||
* [facets]: get all facets defined and fixed on this type.
|
||||
*/
|
||||
int getFixedFacets() const;
|
||||
|
||||
/**
|
||||
* Convenience method. [Facets]: check whether a facet is defined and
|
||||
* fixed on this type.
|
||||
* @param facetName The name of the facet.
|
||||
* @return True if the facet is fixed, false otherwise.
|
||||
*/
|
||||
bool isFixedFacet(FACET facetName);
|
||||
|
||||
/**
|
||||
* Convenience method. Returns a value of a single constraining facet for
|
||||
* this simple type definition. This method must not be used to retrieve
|
||||
* values for <code>enumeration</code> and <code>pattern</code> facets.
|
||||
* @param facetName The name of the facet, i.e.
|
||||
* <code>FACET_LENGTH, FACET_TOTALDIGITS </code> (see
|
||||
* <code>XSConstants</code>).To retrieve value for pattern or
|
||||
* enumeration, see <code>enumeration</code> and <code>pattern</code>.
|
||||
* @return A value of the facet specified in <code>facetName</code> for
|
||||
* this simple type definition or <code>null</code>.
|
||||
*/
|
||||
const XMLCh *getLexicalFacetValue(FACET facetName);
|
||||
|
||||
/**
|
||||
* Returns a list of enumeration values.
|
||||
*/
|
||||
StringList *getLexicalEnumeration();
|
||||
|
||||
/**
|
||||
* Returns a list of pattern values.
|
||||
*/
|
||||
StringList *getLexicalPattern();
|
||||
|
||||
/**
|
||||
* Fundamental Facet: ordered
|
||||
*/
|
||||
ORDERING getOrdered() const;
|
||||
|
||||
/**
|
||||
* Fundamental Facet: cardinality.
|
||||
*/
|
||||
bool getFinite() const;
|
||||
|
||||
/**
|
||||
* Fundamental Facet: bounded.
|
||||
*/
|
||||
bool getBounded() const;
|
||||
|
||||
/**
|
||||
* Fundamental Facet: numeric.
|
||||
*/
|
||||
bool getNumeric() const;
|
||||
|
||||
/**
|
||||
* Optional. A set of [annotation]s.
|
||||
*/
|
||||
XSAnnotationList *getAnnotations();
|
||||
/**
|
||||
* @return list of constraining facets.
|
||||
* This method must not be used to retrieve
|
||||
* values for <code>enumeration</code> and <code>pattern</code> facets.
|
||||
*/
|
||||
XSFacetList *getFacets();
|
||||
|
||||
/**
|
||||
* @return list of enumeration and pattern facets.
|
||||
*/
|
||||
XSMultiValueFacetList *getMultiValueFacets();
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
const XMLCh* getName() const;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
const XMLCh* getNamespace();
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
XSNamespaceItem *getNamespaceItem();
|
||||
|
||||
/**
|
||||
* A boolean that specifies if the type definition is
|
||||
* anonymous. Convenience attribute.
|
||||
*/
|
||||
bool getAnonymous() const;
|
||||
|
||||
/**
|
||||
* {base type definition}: either a simple type definition or a complex
|
||||
* type definition.
|
||||
*/
|
||||
XSTypeDefinition *getBaseType();
|
||||
|
||||
/**
|
||||
* Convenience method: check if this type is derived from the given
|
||||
* <code>ancestorType</code>.
|
||||
* @param ancestorType An ancestor type definition.
|
||||
* @return Return true if this type is derived from
|
||||
* <code>ancestorType</code>.
|
||||
*/
|
||||
bool derivedFromType(const XSTypeDefinition* const ancestorType);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
inline DatatypeValidator* getDatatypeValidator() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
|
||||
XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
|
||||
|
||||
/**
|
||||
* Helper method for construct
|
||||
*/
|
||||
void setFacetInfo
|
||||
(
|
||||
int definedFacets
|
||||
, int fixedFacets
|
||||
, XSFacetList* const xsFacetList
|
||||
, XSMultiValueFacetList* const xsMultiValueFacetList
|
||||
, StringList* const patternList
|
||||
);
|
||||
void setPrimitiveType(XSSimpleTypeDefinition* const toSet);
|
||||
|
||||
friend class XSObjectFactory;
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
int fDefinedFacets;
|
||||
int fFixedFacets;
|
||||
VARIETY fVariety;
|
||||
DatatypeValidator* fDatatypeValidator;
|
||||
XSFacetList* fXSFacetList;
|
||||
XSMultiValueFacetList* fXSMultiValueFacetList;
|
||||
StringList* fPatternList;
|
||||
XSSimpleTypeDefinition* fPrimitiveOrItemType;
|
||||
XSSimpleTypeDefinitionList* fMemberTypes;
|
||||
XSAnnotationList* fXSAnnotationList;
|
||||
};
|
||||
|
||||
inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
|
||||
{
|
||||
return fVariety;
|
||||
}
|
||||
|
||||
inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
|
||||
{
|
||||
if (fVariety == VARIETY_ATOMIC)
|
||||
return fPrimitiveOrItemType;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
|
||||
{
|
||||
if (fVariety == VARIETY_LIST)
|
||||
return fPrimitiveOrItemType;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
|
||||
{
|
||||
return fMemberTypes;
|
||||
}
|
||||
|
||||
inline int XSSimpleTypeDefinition::getDefinedFacets() const
|
||||
{
|
||||
return fDefinedFacets;
|
||||
}
|
||||
|
||||
inline int XSSimpleTypeDefinition::getFixedFacets() const
|
||||
{
|
||||
return fFixedFacets;
|
||||
}
|
||||
|
||||
inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
|
||||
{
|
||||
return fPatternList;
|
||||
}
|
||||
|
||||
inline XSFacetList* XSSimpleTypeDefinition::getFacets()
|
||||
{
|
||||
return fXSFacetList;
|
||||
}
|
||||
|
||||
inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
|
||||
{
|
||||
return fXSMultiValueFacetList;
|
||||
}
|
||||
|
||||
inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
|
||||
{
|
||||
return fXSAnnotationList;
|
||||
}
|
||||
|
||||
inline void
|
||||
XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
|
||||
{
|
||||
fPrimitiveOrItemType = toSet;
|
||||
}
|
||||
|
||||
inline DatatypeValidator*
|
||||
XSSimpleTypeDefinition::getDatatypeValidator() const
|
||||
{
|
||||
return fDatatypeValidator;
|
||||
}
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSTypeDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
// forward declarations
|
||||
class XSNamespaceItem;
|
||||
|
||||
/**
|
||||
* This class represents a complexType or simpleType definition.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*
|
||||
*/
|
||||
|
||||
class XMLPARSER_EXPORT XSTypeDefinition : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
enum TYPE_CATEGORY {
|
||||
/**
|
||||
* This constant value signifies a complex type.
|
||||
*/
|
||||
COMPLEX_TYPE = 15,
|
||||
/**
|
||||
* This constant value signifies a simple type.
|
||||
*/
|
||||
SIMPLE_TYPE = 16
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param typeCategory
|
||||
* @param xsBaseType
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSTypeDefinition
|
||||
(
|
||||
TYPE_CATEGORY typeCategory
|
||||
, XSTypeDefinition* const xsBaseType
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
virtual ~XSTypeDefinition();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name overloaded XSObject methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The name of type <code>NCName</code> of this declaration as defined in
|
||||
* XML Namespaces.
|
||||
*/
|
||||
virtual const XMLCh* getName() const = 0;
|
||||
|
||||
/**
|
||||
* The [target namespace] of this object, or <code>null</code> if it is
|
||||
* unspecified.
|
||||
*/
|
||||
virtual const XMLCh* getNamespace() = 0;
|
||||
|
||||
/**
|
||||
* A namespace schema information item corresponding to the target
|
||||
* namespace of the component, if it's globally declared; or null
|
||||
* otherwise.
|
||||
*/
|
||||
virtual XSNamespaceItem *getNamespaceItem() = 0;
|
||||
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSTypeDefinition methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Return whether this type definition is a simple type or complex type.
|
||||
*/
|
||||
TYPE_CATEGORY getTypeCategory() const;
|
||||
|
||||
/**
|
||||
* {base type definition}: either a simple type definition or a complex
|
||||
* type definition.
|
||||
*/
|
||||
virtual XSTypeDefinition *getBaseType() = 0;
|
||||
|
||||
/**
|
||||
* {final}. For complex type definition it is a subset of {extension,
|
||||
* restriction}. For simple type definition it is a subset of
|
||||
* {extension, list, restriction, union}.
|
||||
* @param toTest Extension, restriction, list, union constants
|
||||
* (defined in <code>XSObject</code>).
|
||||
* @return True if toTest is in the final set, otherwise false.
|
||||
*/
|
||||
bool isFinal(short toTest);
|
||||
|
||||
/**
|
||||
* For complex types the returned value is a bit combination of the subset
|
||||
* of {<code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>}
|
||||
* corresponding to <code>final</code> set of this type or
|
||||
* <code>DERIVATION_NONE</code>. For simple types the returned value is
|
||||
* a bit combination of the subset of {
|
||||
* <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
|
||||
* } corresponding to <code>final</code> set of this type or
|
||||
* <code>DERIVATION_NONE</code>.
|
||||
*/
|
||||
short getFinal() const;
|
||||
|
||||
/**
|
||||
* A boolean that specifies if the type definition is
|
||||
* anonymous. Convenience attribute.
|
||||
*/
|
||||
virtual bool getAnonymous() const = 0;
|
||||
|
||||
/**
|
||||
* Convenience method: check if this type is derived from the given
|
||||
* <code>ancestorType</code>.
|
||||
* @param ancestorType An ancestor type definition.
|
||||
* @return Return true if this type is derived from
|
||||
* <code>ancestorType</code>.
|
||||
*/
|
||||
virtual bool derivedFromType(const XSTypeDefinition* const ancestorType) = 0;
|
||||
|
||||
/**
|
||||
* Convenience method: check if this type is derived from the given
|
||||
* ancestor type.
|
||||
* @param typeNamespace An ancestor type namespace.
|
||||
* @param name An ancestor type name.
|
||||
* @return Return true if this type is derived from
|
||||
* the ancestor defined by <code>typeNamespace</code> and <code>name</code>.
|
||||
*/
|
||||
bool derivedFrom(const XMLCh* typeNamespace,
|
||||
const XMLCh* name);
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSTypeDefinition(const XSTypeDefinition&);
|
||||
XSTypeDefinition & operator=(const XSTypeDefinition &);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
// fTypeCategory
|
||||
// whether this is a simpleType or complexType
|
||||
// fFinal
|
||||
// the final properties which is set by the derived class.
|
||||
TYPE_CATEGORY fTypeCategory;
|
||||
short fFinal;
|
||||
XSTypeDefinition* fBaseType; // owned by XSModel
|
||||
};
|
||||
|
||||
inline XSTypeDefinition::TYPE_CATEGORY XSTypeDefinition::getTypeCategory() const
|
||||
{
|
||||
return fTypeCategory;
|
||||
}
|
||||
|
||||
inline short XSTypeDefinition::getFinal() const
|
||||
{
|
||||
return fFinal;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
406
project/jni/xerces/include/xercesc/framework/psvi/XSValue.hpp
Normal file
406
project/jni/xerces/include/xercesc/framework/psvi/XSValue.hpp
Normal file
@@ -0,0 +1,406 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSValue.hpp 932887 2010-04-11 13:04:59Z borisk $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSVALUE_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSVALUE_HPP
|
||||
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/ValueHashTableOf.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
class RegularExpression;
|
||||
|
||||
class XMLPARSER_EXPORT XSValue : public XMemory
|
||||
{
|
||||
public:
|
||||
|
||||
enum DataType {
|
||||
dt_string = 0,
|
||||
dt_boolean = 1,
|
||||
dt_decimal = 2,
|
||||
dt_float = 3,
|
||||
dt_double = 4,
|
||||
dt_duration = 5,
|
||||
dt_dateTime = 6,
|
||||
dt_time = 7,
|
||||
dt_date = 8,
|
||||
dt_gYearMonth = 9,
|
||||
dt_gYear = 10,
|
||||
dt_gMonthDay = 11,
|
||||
dt_gDay = 12,
|
||||
dt_gMonth = 13,
|
||||
dt_hexBinary = 14,
|
||||
dt_base64Binary = 15,
|
||||
dt_anyURI = 16,
|
||||
dt_QName = 17,
|
||||
dt_NOTATION = 18,
|
||||
dt_normalizedString = 19,
|
||||
dt_token = 20,
|
||||
dt_language = 21,
|
||||
dt_NMTOKEN = 22,
|
||||
dt_NMTOKENS = 23,
|
||||
dt_Name = 24,
|
||||
dt_NCName = 25,
|
||||
dt_ID = 26,
|
||||
dt_IDREF = 27,
|
||||
dt_IDREFS = 28,
|
||||
dt_ENTITY = 29,
|
||||
dt_ENTITIES = 30,
|
||||
dt_integer = 31,
|
||||
dt_nonPositiveInteger = 32,
|
||||
dt_negativeInteger = 33,
|
||||
dt_long = 34,
|
||||
dt_int = 35,
|
||||
dt_short = 36,
|
||||
dt_byte = 37,
|
||||
dt_nonNegativeInteger = 38,
|
||||
dt_unsignedLong = 39,
|
||||
dt_unsignedInt = 40,
|
||||
dt_unsignedShort = 41,
|
||||
dt_unsignedByte = 42,
|
||||
dt_positiveInteger = 43,
|
||||
dt_MAXCOUNT = 44
|
||||
};
|
||||
|
||||
enum XMLVersion {
|
||||
ver_10,
|
||||
ver_11
|
||||
};
|
||||
|
||||
enum Status {
|
||||
st_Init,
|
||||
st_NoContent,
|
||||
st_NoCanRep,
|
||||
st_NoActVal,
|
||||
st_NotSupported,
|
||||
st_CantCreateRegEx,
|
||||
st_FOCA0002, //invalid lexical value
|
||||
st_FOCA0001, //input value too large/too small for decimal
|
||||
st_FOCA0003, //input value too large for integer
|
||||
st_FODT0003, //invalid timezone value
|
||||
st_UnknownType
|
||||
};
|
||||
|
||||
enum DataGroup {
|
||||
dg_numerics,
|
||||
dg_datetimes,
|
||||
dg_strings
|
||||
};
|
||||
|
||||
enum DoubleFloatType
|
||||
{
|
||||
DoubleFloatType_NegINF,
|
||||
DoubleFloatType_PosINF,
|
||||
DoubleFloatType_NaN,
|
||||
DoubleFloatType_Zero,
|
||||
DoubleFloatType_Normal
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSValue();
|
||||
//@}
|
||||
|
||||
//---------------------------------
|
||||
/** @name Externalization methods */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Validate a given string of the data type specified
|
||||
*
|
||||
* @param content data to be validated
|
||||
* @param datatype schema datatype
|
||||
* @param status validation status which is set upon validation fails
|
||||
* @param version xml version
|
||||
* @param manager memory manager provided
|
||||
*/
|
||||
static
|
||||
bool validate
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, XMLVersion version = ver_10
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the canonical representation for a given string of the
|
||||
* data type specified
|
||||
*
|
||||
* @param content raw data
|
||||
* @param datatype schema datatype
|
||||
* @param status validation status which is set upon validation fails
|
||||
* @param version xml version
|
||||
* @param toValidate to validate the content before generate canonical representation
|
||||
* @param manager memory manager provided
|
||||
*/
|
||||
static
|
||||
XMLCh* getCanonicalRepresentation
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, XMLVersion version = ver_10
|
||||
, bool toValidate = true
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the actual value, in the form of XSValue, for a given string of the
|
||||
* data type specified
|
||||
*
|
||||
* Client application is responsible for the deletion of the XSValue returned.
|
||||
*
|
||||
* @param content raw data
|
||||
* @param datatype schema datatype
|
||||
* @param status validation status which is set upon validation fails
|
||||
* @param version xml version
|
||||
* @param toValidate to validate the content before generate actual value
|
||||
* @param manager memory manager provided
|
||||
*/
|
||||
static
|
||||
XSValue* getActualValue
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, XMLVersion version = ver_10
|
||||
, bool toValidate = true
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
static
|
||||
DataType getDataType (const XMLCh* const dtString);
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** public data */
|
||||
|
||||
struct XSValue_Data {
|
||||
|
||||
DataType f_datatype;
|
||||
|
||||
union {
|
||||
bool f_bool;
|
||||
char f_char;
|
||||
unsigned char f_uchar;
|
||||
short f_short;
|
||||
unsigned short f_ushort;
|
||||
int f_int;
|
||||
unsigned int f_uint;
|
||||
long f_long;
|
||||
unsigned long f_ulong;
|
||||
float f_float;
|
||||
double f_double;
|
||||
XMLCh* f_strVal;
|
||||
XMLByte* f_byteVal;
|
||||
|
||||
struct decimal {
|
||||
double f_dvalue;
|
||||
} f_decimal;
|
||||
|
||||
struct datetime {
|
||||
int f_year;
|
||||
int f_month;
|
||||
int f_day;
|
||||
int f_hour;
|
||||
int f_min;
|
||||
int f_second;
|
||||
double f_milisec;
|
||||
|
||||
} f_datetime;
|
||||
|
||||
struct doubletype {
|
||||
double f_double;
|
||||
DoubleFloatType f_doubleEnum;
|
||||
} f_doubleType;
|
||||
|
||||
struct floattype {
|
||||
float f_float;
|
||||
DoubleFloatType f_floatEnum;
|
||||
} f_floatType;
|
||||
|
||||
|
||||
|
||||
} fValue;
|
||||
|
||||
} fData;
|
||||
|
||||
private:
|
||||
|
||||
typedef union
|
||||
{
|
||||
long f_long;
|
||||
unsigned long f_ulong;
|
||||
} t_value;
|
||||
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
*/
|
||||
XSValue(
|
||||
DataType const dt
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSValue(const XSValue&);
|
||||
XSValue & operator=(const XSValue &);
|
||||
|
||||
//---------------------------------
|
||||
/** @name Helpers */
|
||||
|
||||
//@{
|
||||
|
||||
static const XSValue::DataGroup inGroup[];
|
||||
static const bool numericSign[];
|
||||
|
||||
//@}
|
||||
|
||||
static
|
||||
bool validateNumerics
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
bool validateDateTimes
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
bool validateStrings
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, XMLVersion version
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
XMLCh* getCanRepNumerics
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, bool toValidate
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
XMLCh* getCanRepDateTimes
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, bool toValidate
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
XMLCh* getCanRepStrings
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, XMLVersion version
|
||||
, bool toValidate
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
XSValue* getActValNumerics
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, bool toValidate
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
XSValue* getActValDateTimes
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
XSValue* getActValStrings
|
||||
(
|
||||
const XMLCh* const content
|
||||
, DataType datatype
|
||||
, Status& status
|
||||
, XMLVersion version
|
||||
, bool toValidate
|
||||
, MemoryManager* const manager
|
||||
);
|
||||
|
||||
static
|
||||
bool getActualNumericValue
|
||||
(
|
||||
const XMLCh* const content
|
||||
, Status& status
|
||||
, t_value& retVal
|
||||
, MemoryManager* const manager
|
||||
, DataType datatype
|
||||
);
|
||||
|
||||
static ValueHashTableOf<DataType>* fDataTypeRegistry;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// static helper methods
|
||||
// -----------------------------------------------------------------------
|
||||
static void initializeRegistry();
|
||||
friend class XMLInitializer;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
bool fMemAllocated;
|
||||
MemoryManager* fMemoryManager;
|
||||
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
201
project/jni/xerces/include/xercesc/framework/psvi/XSWildcard.hpp
Normal file
201
project/jni/xerces/include/xercesc/framework/psvi/XSWildcard.hpp
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: XSWildcard.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_XSWILDCARD_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_XSWILDCARD_HPP
|
||||
|
||||
#include <xercesc/framework/psvi/XSObject.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This class describes all properties of a Schema Wildcard
|
||||
* component.
|
||||
* This is *always* owned by the validator /parser object from which
|
||||
* it is obtained.
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
class XSAnnotation;
|
||||
class SchemaAttDef;
|
||||
class ContentSpecNode;
|
||||
|
||||
class XMLPARSER_EXPORT XSWildcard : public XSObject
|
||||
{
|
||||
public:
|
||||
|
||||
// Namespace Constraint
|
||||
enum NAMESPACE_CONSTRAINT {
|
||||
/**
|
||||
* Namespace Constraint: any namespace is allowed.
|
||||
*/
|
||||
NSCONSTRAINT_ANY = 1,
|
||||
/**
|
||||
* Namespace Constraint: namespaces in the list are not allowed.
|
||||
*/
|
||||
NSCONSTRAINT_NOT = 2,
|
||||
/**
|
||||
* Namespace Constraint: namespaces in the list are allowed.
|
||||
*/
|
||||
NSCONSTRAINT_DERIVATION_LIST = 3
|
||||
};
|
||||
|
||||
// Process contents
|
||||
enum PROCESS_CONTENTS {
|
||||
/**
|
||||
* There must be a top-level declaration for the item available, or the
|
||||
* item must have an xsi:type, and the item must be valid as appropriate.
|
||||
*/
|
||||
PC_STRICT = 1,
|
||||
/**
|
||||
* No constraints at all: the item must simply be well-formed XML.
|
||||
*/
|
||||
PC_SKIP = 2,
|
||||
/**
|
||||
* If the item, or any items among its [children] is an element
|
||||
* information item, has a uniquely determined declaration available, it
|
||||
* must be valid with respect to that definition, that is, validate
|
||||
* where you can, don't worry when you can't.
|
||||
*/
|
||||
PC_LAX = 3
|
||||
};
|
||||
|
||||
// Constructors and Destructor
|
||||
// -----------------------------------------------------------------------
|
||||
/** @name Constructors */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The default constructor
|
||||
*
|
||||
* @param attWildCard
|
||||
* @param annot
|
||||
* @param xsModel
|
||||
* @param manager The configurable memory manager
|
||||
*/
|
||||
XSWildcard
|
||||
(
|
||||
SchemaAttDef* const attWildCard
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
XSWildcard
|
||||
(
|
||||
const ContentSpecNode* const elmWildCard
|
||||
, XSAnnotation* const annot
|
||||
, XSModel* const xsModel
|
||||
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
||||
);
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Destructor */
|
||||
//@{
|
||||
~XSWildcard();
|
||||
//@}
|
||||
|
||||
//---------------------
|
||||
/** @name XSWildcard methods */
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Namespace constraint: A constraint type: any, not, list.
|
||||
*/
|
||||
NAMESPACE_CONSTRAINT getConstraintType() const;
|
||||
|
||||
/**
|
||||
* Namespace constraint. For <code>constraintType</code>
|
||||
* <code>NSCONSTRAINT_DERIVATION_LIST</code>, the list contains allowed namespaces.
|
||||
* For <code>constraintType</code> <code>NSCONSTRAINT_NOT</code>, the
|
||||
* list contains disallowed namespaces.
|
||||
*/
|
||||
StringList *getNsConstraintList();
|
||||
|
||||
/**
|
||||
* [process contents]: one of skip, lax or strict. Valid constants values
|
||||
* are: <code>PC_SKIP, PC_LAX, PC_STRICT</code>.
|
||||
*/
|
||||
PROCESS_CONTENTS getProcessContents() const;
|
||||
|
||||
/**
|
||||
* Optional. An [annotation].
|
||||
*/
|
||||
XSAnnotation *getAnnotation() const;
|
||||
|
||||
//@}
|
||||
|
||||
//----------------------------------
|
||||
/** methods needed by implementation */
|
||||
|
||||
//@{
|
||||
|
||||
//@}
|
||||
private:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Unimplemented constructors and operators
|
||||
// -----------------------------------------------------------------------
|
||||
XSWildcard(const XSWildcard&);
|
||||
XSWildcard & operator=(const XSWildcard &);
|
||||
|
||||
/**
|
||||
* Build namespace list
|
||||
*/
|
||||
void buildNamespaceList(const ContentSpecNode* const rootNode);
|
||||
|
||||
protected:
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// data members
|
||||
// -----------------------------------------------------------------------
|
||||
NAMESPACE_CONSTRAINT fConstraintType;
|
||||
PROCESS_CONTENTS fProcessContents;
|
||||
StringList* fNsConstraintList;
|
||||
XSAnnotation* fAnnotation;
|
||||
};
|
||||
|
||||
inline XSAnnotation *XSWildcard::getAnnotation() const
|
||||
{
|
||||
return fAnnotation;
|
||||
}
|
||||
|
||||
inline XSWildcard::PROCESS_CONTENTS XSWildcard::getProcessContents() const
|
||||
{
|
||||
return fProcessContents;
|
||||
}
|
||||
|
||||
inline StringList* XSWildcard::getNsConstraintList()
|
||||
{
|
||||
return fNsConstraintList;
|
||||
}
|
||||
|
||||
inline XSWildcard::NAMESPACE_CONSTRAINT XSWildcard::getConstraintType() const
|
||||
{
|
||||
return fConstraintType;
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user