You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ar...@locus.apache.org on 2000/09/13 01:05:31 UTC

cvs commit: xml-xerces/c/src/parsers DOMParser.cpp DOMParser.hpp

aruna1      00/09/12 16:05:31

  Modified:    c/src/parsers DOMParser.cpp DOMParser.hpp
  Log:
  Changed get/set functions of expandEntityReferneces to createEntityReferenceNodes.
  expandEntityRefernce functions are there but deprecated.
  
  Revision  Changes    Path
  1.30      +16 -6     xml-xerces/c/src/parsers/DOMParser.cpp
  
  Index: DOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.cpp,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DOMParser.cpp	2000/08/17 22:47:17	1.29
  +++ DOMParser.cpp	2000/09/12 23:05:30	1.30
  @@ -59,7 +59,7 @@
   *  handler with the scanner. In these handler methods, appropriate DOM nodes
   *  are created and added to the DOM tree.
   *
  -* $Id: DOMParser.cpp,v 1.29 2000/08/17 22:47:17 lehors Exp $
  +* $Id: DOMParser.cpp,v 1.30 2000/09/12 23:05:30 aruna1 Exp $
   * 
   */
   
  @@ -97,7 +97,7 @@
   
   fErrorHandler(0)
   , fEntityResolver(0)
  -, fExpandEntityReferences(false)
  +, fCreateEntityReferenceNodes(false)
   , fToCreateXMLDeclTypeNode(false)
   , fIncludeIgnorableWhitespace(true)
   , fNodeStack(0)
  @@ -492,7 +492,7 @@
   
   void DOMParser::endEntityReference(const XMLEntityDecl& entDecl)
   {
  -    if (fExpandEntityReferences == true)
  +    if (fCreateEntityReferenceNodes == true)
       {
           fCurrentParent = fNodeStack->pop();
           fCurrentNode   = fCurrentParent;
  @@ -665,7 +665,7 @@
   
   void DOMParser::startEntityReference(const XMLEntityDecl& entDecl)
   {
  -    if (fExpandEntityReferences == true)
  +    if (fCreateEntityReferenceNodes == true)
       {
   		DOMString entName(entDecl.getName());
           DOM_EntityReference er = fDocument.createEntityReference(entName);
  @@ -674,10 +674,20 @@
           fCurrentParent = er;
           fCurrentNode = er;
   
  -		//this entityRef needs to be stored in Entity map too.
  +		// this entityRef needs to be stored in Entity map too.
  +        // We'd decide later whether the entity nodes should be created by a 
  +        // separated method in parser or not. For now just stick it in if 
  +        // the ref nodes are created
   		EntityImpl* entity = (EntityImpl*)fDocumentType->entities->getNamedItem(entName);
   		entity->setEntityRef((EntityReferenceImpl*)er.fImpl);
  -		fDocumentType->entities->setNamedItem(entity);
  +        bool owned = entity->isOwned();
  +        if (owned)
  +            entity->isOwned(false);
  +        
  +        fDocumentType->entities->setNamedItem(entity);
  +        
  +        if (entity->isOwned != owned)
  +            entity->isOwned(owned);
       }
   }
   
  
  
  
  1.13      +56 -10    xml-xerces/c/src/parsers/DOMParser.hpp
  
  Index: DOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DOMParser.hpp	2000/09/09 00:10:58	1.12
  +++ DOMParser.hpp	2000/09/12 23:05:30	1.13
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DOMParser.hpp,v 1.12 2000/09/09 00:10:58 andyh Exp $
  + * $Id: DOMParser.hpp,v 1.13 2000/09/12 23:05:30 aruna1 Exp $
    *
    */
   
  @@ -249,6 +249,7 @@
       bool getExitOnFirstFatalError() const;
   
       /** Get the 'expand entity references' flag.
  +      * DEPRECATED Use getCreateEntityReferenceNodes() instead.
         *
         * This method returns the state of the parser's expand entity
         * references flag.
  @@ -260,8 +261,27 @@
         */
       bool getExpandEntityReferences() const;
   
  -    /** Get the 'include ignorable whitespace' flag.
  +    /** Get the 'include entity references' flag
         *
  +      * This flag  specifies whether the parser is
  +      * creating entity reference nodes in the DOM tree being produced.
  +      * When the 'create' flag is
  +      * true, the DOM tree will contain entity reference nodes. 
  +      * When the 'create' flag is false, no entity reference nodes
  +      * are included in the DOM tree.
  +      * <p>The replacement text
  +      * of the entity is included in either case, either as a
  +      * child of the Entity Reference node or in place at the location
  +      * of the reference.
  +      *
  +      * @return  The state of the create entity reference node
  +      *               flag.
  +      * @see #setCreateEntityReferenceNodes
  +      */
  +    bool  getCreateEntityReferenceNodes()const;
  +
  +   /** Get the 'include ignorable whitespace' flag.
  +      *
         * This method returns the state of the parser's include ignorable
         * whitespace flag.
         *
  @@ -366,6 +386,7 @@
   
       /** Set the 'expand entity references' flag
         *
  +      * DEPRECATED.  USE setCreateEntityReferenceNodes instead.
         * This method allows the user to specify whether the parser should
         * expand all entity reference nodes. When the 'do expansion' flag is
         * true, the DOM tree does not have any entity reference nodes. It is
  @@ -378,8 +399,26 @@
         *               flag.
         */
       void setExpandEntityReferences(const bool expand);
  +
  +     /** Set the 'include entity references' flag
  +      *
  +      * This method allows the user to specify whether the parser should
  +      * create entity reference nodes in the DOM tree being produced.
  +      * When the 'create' flag is
  +      * true, the DOM tree constains entity reference nodes. 
  +      * When the 'create' flag is false, no entity reference nodes
  +      * are included in the DOM tree.
  +      * <p>The replacement text
  +      * of the entity is included in either case, either as a
  +      * child of the Entity Reference node or in place at the location
  +      * of the reference.
  +      *
  +      * @param create The new state of the create entity reference nodes
  +      *               flag.
  +      */
  +    void setCreateEntityReferenceNodes(const bool create);
   
  -    /** Set the 'include ignorable whitespace' flag
  +   /** Set the 'include ignorable whitespace' flag
         *
         * This method allows the user to specify whether a validating parser
         * should include ignorable whitespaces as text nodes.  It has no effect
  @@ -1179,10 +1218,8 @@
       //  fErrorHandler
       //      The installed SAX error handler, if any. Null if none.
       //
  -    //  fExpandEntityReference
  -    //      Indicates whether entity reference nodes should be expanded to
  -    //      its constituent text nodes or just created a single (end result)
  -    //      text node.
  +    //  fCreateEntityReferenceNode
  +    //      Indicates whether entity reference nodes should be created.
       //
       //  fIncludeIgnorableWhitespace
       //      Indicates whether ignorable whiltespace should be added to
  @@ -1227,7 +1264,7 @@
       DOM_Document            fDocument;
       EntityResolver*         fEntityResolver;
       ErrorHandler*           fErrorHandler;
  -    bool                    fExpandEntityReferences;
  +    bool                    fCreateEntityReferenceNodes;
       bool                    fIncludeIgnorableWhitespace;
       ValueStackOf<DOM_Node>* fNodeStack;
       bool                    fParseInProgress;
  @@ -1305,8 +1342,12 @@
   }
   
   inline bool DOMParser::getExpandEntityReferences() const
  +{
  +    return fCreateEntityReferenceNodes;
  +}
  +inline bool DOMParser::getCreateEntityReferenceNodes() const
   {
  -    return fExpandEntityReferences;
  +    return fCreateEntityReferenceNodes;
   }
   
   inline bool DOMParser::getIncludeIgnorableWhitespace() const
  @@ -1329,8 +1370,13 @@
   //  DOMParser: Setter methods
   // ---------------------------------------------------------------------------
   inline void DOMParser::setExpandEntityReferences(const bool expand)
  +{
  +    fCreateEntityReferenceNodes = expand;
  +}
  +
  +inline void DOMParser::setCreateEntityReferenceNodes(const bool create)
   {
  -    fExpandEntityReferences = expand;
  +    fCreateEntityReferenceNodes = create;
   }
   
   inline void DOMParser::setIncludeIgnorableWhitespace(const bool include)