Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:02

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 #if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP)
0019 #define XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP
0020 
0021 //------------------------------------------------------------------------------------
0022 //  Includes
0023 //------------------------------------------------------------------------------------
0024 
0025 #include <xercesc/util/XMLString.hpp>
0026 #include <xercesc/util/RefVectorOf.hpp>
0027 #include <xercesc/dom/DOMStringList.hpp>
0028 
0029 XERCES_CPP_NAMESPACE_BEGIN
0030 
0031 /**
0032  *   The DOMConfiguration interface represents the configuration of
0033  *   a document  and  maintains  a  table of recognized parameters.
0034  *   Using  the   configuration,   it   is   possible   to   change
0035  *   Document.normalizeDocument  behavior,  such  as replacing
0036  *   CDATASection   nodes   with   Text  nodes  or
0037  *   specifying  the  type  of the schema that must be used when the
0038  *   validation of the Document is requested. DOMConfiguration
0039  *   objects  are  also used in [DOM Level 3 Load and Save] in
0040  *   the DOMLSParser and DOMLSSerializer interfaces.
0041  *
0042  *   The  DOMConfiguration  distinguish  two  types  of  parameters:
0043  *   boolean     (boolean    parameters)    and    DOMUserData
0044  *   (parameters). The names used by the DOMConfiguration object are
0045  *   defined  throughout  the  DOM Level 3 specifications. Names are
0046  *   case-insensitive.   To   avoid   possible   conflicts,   as  a
0047  *   convention,   names   referring   to   boolean  parameters  and
0048  *   parameters defined outside the DOM specification should be made
0049  *   unique.  Names  are  recommended  to  follow the XML name
0050  *   production   rule   but   it   is   not  enforced  by  the  DOM
0051  *   implementation.  DOM  Level 3 Core Implementations are required
0052  *   to  recognize  all boolean parameters and parameters defined in
0053  *   this  specification.  Each boolean parameter state or parameter
0054  *   value may then be supported or not by the implementation. Refer
0055  *   to  their  definition  to  know  if  a state or a value must be
0056  *   supported or not.
0057  *
0058  *   Note: Parameters are similar to features and properties used in
0059  *   SAX2 [SAX].
0060  *
0061  *   The following list of parameters defined in the DOM:
0062  *
0063  * "error-handler"
0064  *         [required]
0065  *         A   DOMErrorHandler   object.   If   an   error  is
0066  *         encountered in the document, the implementation will call
0067  *         back  the  DOMErrorHandler  registered  using  this
0068  *         parameter.
0069  *         When  called, DOMError.relatedData will contain the
0070  *         closest   node   to  where  the  error  occured.  If  the
0071  *         implementation  is unable to determine the node where the
0072  *         error occurs, DOMError.relatedData will contain the
0073  *         Document  node.  Mutations  to  the  document  from
0074  *         within  an  error  handler  will result in implementation
0075  *         dependent behaviour.
0076  *
0077  * "schema-type"
0078  *         [optional]
0079  *         A  DOMString  object containing an absolute URI and
0080  *         representing  the  type  of  the  schema language used to
0081  *         validate   a  document  against.  Note  that  no  lexical
0082  *         checking is done on the absolute URI.
0083  *         If  this  parameter  is  not  set, a default value may be
0084  *         provided  by  the  implementation,  based  on  the schema
0085  *         languages  supported  and  on the schema language used at
0086  *         load time.
0087  *
0088  *         Note:   For   XML   Schema  [XML  Schema  Part  1],
0089  *         applications must use the value
0090  *         "http://www.w3.org/2001/XMLSchema".     For    XML    DTD
0091  *         [XML   1.0],   applications   must  use  the  value
0092  *         "http://www.w3.org/TR/REC-xml".  Other  schema  languages
0093  *         are  outside  the  scope  of the W3C and therefore should
0094  *         recommend an absolute URI in order to use this method.
0095  *
0096  * "schema-location"
0097  *         [optional]
0098  *         A  DOMString  object  containing  a  list  of URIs,
0099  *         separated   by  white  spaces  (characters  matching  the
0100  *         nonterminal  production  S  defined  in section 2.3
0101  *         [XML  1.0]),  that  represents  the schemas against
0102  *         which  validation  should  occur.  The  types  of schemas
0103  *         referenced  in  this  list  must match the type specified
0104  *         with   schema-type,   otherwise   the   behaviour  of  an
0105  *         implementation  is  undefined.  If the schema type is XML
0106  *         Schema  [XML  Schema  Part  1], only one of the XML
0107  *         Schemas in the list can be with no namespace.
0108  *         If  validation  occurs  against a namespace aware schema,
0109  *         i.e.  XML  Schema,  and  the  targetNamespace of a schema
0110  *         (specified    using    this    property)    matches   the
0111  *         targetNamespace  of  a  schema  occurring in the instance
0112  *         document,  i.e  in  schemaLocation  attribute, the schema
0113  *         specified  by  the  user using this property will be used
0114  *         (i.e.,  in XML Schema the schemaLocation attribute in the
0115  *         instance  document  or  on  the  import  element  will be
0116  *         effectively ignored).
0117  *
0118  *         Note:  It is illegal to set the schema-location parameter
0119  *         if  the  schema-type  parameter  value  is not set. It is
0120  *         strongly  recommended that DOMInputSource.baseURI will be
0121  *         set,  so  that an implementation can successfully resolve
0122  *         any external entities referenced.
0123  *
0124  *   The  following list of boolean parameters (features) defined in
0125  *   the DOM:
0126  *
0127  * "canonical-form"
0128  *
0129  *       true
0130  *               [optional]
0131  *               Canonicalize  the  document  according to the rules
0132  *               specified  in [Canonical XML]. Note that this
0133  *               is  limited  to what can be represented in the DOM.
0134  *               In particular, there is no way to specify the order
0135  *               of the attributes in the DOM.
0136  *
0137  *       false
0138  *               [required] (default)
0139  *               Do not canonicalize the document.
0140  *
0141  * "cdata-sections"
0142  *
0143  *       true
0144  *               [required] (default)
0145  *               Keep CDATASection nodes in the document.
0146  *
0147  *       false
0148  *               [required]
0149  *               Transform  CDATASection nodes in the document
0150  *               into  Text  nodes. The new Text node is
0151  *               then combined with any adjacent Text node.
0152  *
0153  * "comments"
0154  *
0155  *       true
0156  *               [required] (default)
0157  *               Keep Comment nodes in the document.
0158  *
0159  *       false
0160  *               [required]
0161  *               Discard Comment nodes in the Document.
0162  *
0163  * "datatype-normalization"
0164  *
0165  *       true
0166  *               [required]
0167  *               Exposed normalized values in the tree.
0168  *
0169  *       false
0170  *               [required] (default)
0171  *               Do not perform normalization on the tree.
0172  *
0173  * "discard-default-content"
0174  *
0175  *       true
0176  *               [required] (default)
0177  *               Use   whatever   information   available   to   the
0178  *               implementation (i.e. XML schema, DTD, the specified
0179  *               flag on Attr nodes, and so on) to decide what
0180  *               attributes  and content should be discarded or not.
0181  *               Note that the specified flag on Attr nodes in
0182  *               itself  is not always reliable, it is only reliable
0183  *               when  it  is set to false since the only case where
0184  *               it  can  be  set  to  false is if the attribute was
0185  *               created  by the implementation. The default content
0186  *               won't be removed if an implementation does not have
0187  *               any information available.
0188  *
0189  *       false
0190  *               [required]
0191  *               Keep all attributes and all content.
0192  *
0193  * "entities"
0194  *
0195  *       true
0196  *               [required]
0197  *               Keep  EntityReference  and Entity nodes
0198  *               in the document.
0199  *
0200  *       false
0201  *               [required] (default)
0202  *               Remove  all  EntityReference and Entity
0203  *               nodes   from   the  document,  putting  the  entity
0204  *               expansions  directly  in  their  place.  Text
0205  *               nodes     are     into    "normal"    form.    Only
0206  *               EntityReference nodes to non-defined entities
0207  *               are kept in the document.
0208  *
0209  * "infoset"
0210  *
0211  *       true
0212  *               [required]
0213  *               Only  keep  in the document the information defined
0214  *               in  the  XML Information Set [XML Information
0215  *               set].
0216  *               This   forces  the  following  features  to  false:
0217  *               namespace-declarations,         validate-if-schema,
0218  *               entities, datatype-normalization, cdata-sections.
0219  *               This   forces   the  following  features  to  true:
0220  *               whitespace-in-element-content,            comments,
0221  *               namespaces.
0222  *               Other  features  are  not  changed unless explicitly
0223  *               specified in the description of the features.
0224  *               Note  that  querying  this  feature with getFeature
0225  *               returns   true  only  if  the  individual  features
0226  *               specified above are appropriately set.
0227  *
0228  *       false
0229  *               Setting infoset to false has no effect.
0230  *
0231  * "namespaces"
0232  *
0233  *       true
0234  *               [required] (default)
0235  *               Perform  the  namespace  processing  as  defined in
0236  *               [XML Namespaces].
0237  *
0238  *       false
0239  *               [optional]
0240  *               Do not perform the namespace processing.
0241  *
0242  * "namespace-declarations"
0243  *
0244  *       true
0245  *               [required] (default)
0246  *               Include namespace declaration attributes, specified
0247  *               or  defaulted  from  the  schema or the DTD, in the
0248  *               document.  See  also  the  section  Declaring
0249  *               Namespaces in [XML Namespaces].
0250  *
0251  *       false
0252  *               [required]
0253  *               Discard  all  namespace declaration attributes. The
0254  *               Namespace   prefixes  are  retained  even  if  this
0255  *               feature is set to false.
0256  *
0257  * "normalize-characters"
0258  *
0259  *       true
0260  *               [optional]
0261  *               Perform   the   W3C   Text   Normalization  of  the
0262  *               characters [CharModel] in the document.
0263  *
0264  *       false
0265  *               [required] (default)
0266  *               Do not perform character normalization.
0267  *
0268  * "split-cdata-sections"
0269  *
0270  *       true
0271  *               [required] (default)
0272  *               Split  CDATA  sections containing the CDATA section
0273  *               termination  marker  ']]>'. When a CDATA section is
0274  *               split a warning is issued.
0275  *
0276  *       false
0277  *               [required]
0278  *               Signal an error if a CDATASection contains an
0279  *               unrepresentable character.
0280  *
0281  * "validate"
0282  *
0283  *       true
0284  *               [optional]
0285  *               Require  the  validation against a schema (i.e. XML
0286  *               schema,  DTD,  any  other type or representation of
0287  *               schema)  of  the document as it is being normalized
0288  *               as defined by [XML 1.0]. If validation errors
0289  *               are  found,  or  no  schema  was  found,  the error
0290  *               handler  is  notified.  Note  also  that normalized
0291  *               values  will  not  be exposed to the schema in used
0292  *               unless the feature datatype-normalization is true.
0293  *
0294  *               Note:  validate-if-schema and validate are mutually
0295  *               exclusive, setting one of them to true will set the
0296  *               other one to false.
0297  *
0298  *       false
0299  *               [required] (default)
0300  *               Only  XML  1.0  non-validating  processing  must be
0301  *               done.  Note  that  validation might still happen if
0302  *               validate-if-schema is true.
0303  *
0304  * "validate-if-schema"
0305  *
0306  *       true
0307  *               [optional]
0308  *               Enable  validation  only  if  a declaration for the
0309  *               document  element  can  be  found (independently of
0310  *               where  it  is  found,  i.e. XML schema, DTD, or any
0311  *               other   type   or  representation  of  schema).  If
0312  *               validation  errors  are found, the error handler is
0313  *               notified. Note also that normalized values will not
0314  *               be exposed to the schema in used unless the feature
0315  *               datatype-normalization is true.
0316  *
0317  *               Note:  validate-if-schema and validate are mutually
0318  *               exclusive, setting one of them to true will set the
0319  *               other one to false.
0320  *
0321  *       false
0322  *               [required] (default)
0323  *               No  validation  should be performed if the document
0324  *               has  a  schema.  Note  that  validation  must still
0325  *               happen if validate is true.
0326  *
0327  * "element-content-whitespace"
0328  *
0329  *       true
0330  *               [required] (default)
0331  *               Keep all white spaces in the document.
0332  *
0333  *       false
0334  *               [optional]
0335  *               Discard   white  space  in  element  content  while
0336  *               normalizing.  The implementation is expected to use
0337  *               the isWhitespaceInElementContent flag on Text
0338  *               nodes to determine if a text node should be written
0339  *               out or not.
0340  *
0341  *   The  resolutions  of  entities  is done using Document.baseURI.
0342  *   However,  when  the  features "LS-Load" or "LS-Save" defined in
0343  *   [DOM  Level  3  Load  and  Save] are supported by the DOM
0344  *   implementation,  the  parameter  "entity-resolver"  can also be
0345  *   used  on  DOMConfiguration  objects  attached to Document
0346  *   nodes. If this parameter is set,
0347  *   Document.normalizeDocument   will   invoke   the   entity
0348  *   resolver instead of using Document.baseURI.
0349  */
0350 class CDOM_EXPORT DOMConfiguration
0351 {
0352 protected:
0353     //-----------------------------------------------------------------------------------
0354     //  Constructor
0355     //-----------------------------------------------------------------------------------
0356     /** @name Hidden constructors */
0357     //@{
0358     DOMConfiguration() {};
0359     //@}
0360 
0361 private:
0362     // -----------------------------------------------------------------------
0363     // Unimplemented constructors and operators
0364     // -----------------------------------------------------------------------
0365     /** @name Unimplemented constructors and operators */
0366     //@{
0367     DOMConfiguration(const DOMConfiguration &);
0368     DOMConfiguration & operator = (const DOMConfiguration &);
0369     //@}
0370 
0371 public:
0372 
0373     // -----------------------------------------------------------------------
0374     //  Setter methods
0375     // -----------------------------------------------------------------------
0376     
0377     /** Set the value of a parameter. 
0378      * @param name The name of the parameter to set.
0379      * @param value The new value or null if the user wishes to unset the 
0380      * parameter. While the type of the value parameter is defined as 
0381      * <code>DOMUserData</code>, the object type must match the type defined
0382      * by the definition of the parameter. For example, if the parameter is 
0383      * "error-handler", the value must be of type <code>DOMErrorHandler</code>
0384      * @exception DOMException (NOT_SUPPORTED_ERR) Raised when the 
0385      * parameter name is recognized but the requested value cannot be set.
0386      * @exception DOMException (NOT_FOUND_ERR) Raised when the 
0387      * parameter name is not recognized.
0388      * @since DOM level 3
0389      **/
0390     virtual void setParameter(const XMLCh* name, const void* value) = 0;
0391     virtual void setParameter(const XMLCh* name, bool value) = 0;
0392 
0393     // -----------------------------------------------------------------------
0394     //  Getter methods
0395     // -----------------------------------------------------------------------
0396     /** Return the value of a parameter if known. 
0397      * @param name The name of the parameter.
0398      * @return The current object associated with the specified parameter or 
0399      * null if no object has been associated or if the parameter is not 
0400      * supported.
0401      * @exception DOMException (NOT_FOUND_ERR) Raised when the i
0402      * boolean parameter 
0403      * name is not recognized.
0404      * @since DOM level 3
0405      **/    
0406     virtual const void* getParameter(const XMLCh* name) const = 0;
0407 
0408                                         
0409     // -----------------------------------------------------------------------
0410     //  Query methods
0411     // -----------------------------------------------------------------------
0412 
0413     /** Check if setting a parameter to a specific value is supported. 
0414      * @param name The name of the parameter to check.
0415      * @param value An object. if null, the returned value is true.
0416      * @return true if the parameter could be successfully set to the specified 
0417      * value, or false if the parameter is not recognized or the requested value 
0418      * is not supported. This does not change the current value of the parameter 
0419      * itself.
0420      * @since DOM level 3
0421      **/
0422     virtual bool canSetParameter(const XMLCh* name, const void* value) const = 0;
0423     virtual bool canSetParameter(const XMLCh* name, bool value) const = 0;
0424 
0425     /**
0426      * The list of the parameters supported by this DOMConfiguration object and 
0427      * for which at least one value can be set by the application. 
0428      * Note that this list can also contain parameter names defined outside this specification.
0429      *
0430      * @return The list of parameters that can be used with setParameter/getParameter
0431      * @since DOM level 3
0432      **/
0433     virtual const DOMStringList* getParameterNames() const = 0;
0434 
0435     // -----------------------------------------------------------------------
0436     //  All constructors are hidden, just the destructor is available
0437     // -----------------------------------------------------------------------
0438     /** @name Destructor */
0439     //@{
0440     /**
0441      * Destructor
0442      *
0443      */
0444     virtual ~DOMConfiguration() {};
0445     //@}
0446 };
0447     
0448 XERCES_CPP_NAMESPACE_END
0449 
0450 #endif 
0451 
0452 /**
0453  * End of file DOMConfiguration.hpp
0454  */