You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/10/22 22:33:42 UTC

cvs commit: xml-xerces/c/src/xercesc/validators/schema XSDDOMParser.cpp XSDDOMParser.hpp

knoaman     2003/10/22 13:33:42

  Modified:    c/src/xercesc/parsers AbstractDOMParser.hpp
               c/src/xercesc/util XMLUni.cpp XMLUni.hpp
               c/src/xercesc/validators/schema XSDDOMParser.cpp
                        XSDDOMParser.hpp
  Log:
  Prepare for annotation support
  
  Revision  Changes    Path
  1.23      +3 -2      xml-xerces/c/src/xercesc/parsers/AbstractDOMParser.hpp
  
  Index: AbstractDOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/parsers/AbstractDOMParser.hpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AbstractDOMParser.hpp	24 Sep 2003 10:37:53 -0000	1.22
  +++ AbstractDOMParser.hpp	22 Oct 2003 20:33:42 -0000	1.23
  @@ -1423,8 +1423,9 @@
       void initialize();
       void cleanUp();
   
  +protected:
       // -----------------------------------------------------------------------
  -    //  Private data members
  +    //  Protected data members
       //
       //  fCurrentNode
       //  fCurrentParent
  
  
  
  1.36      +12 -1     xml-xerces/c/src/xercesc/util/XMLUni.cpp
  
  Index: XMLUni.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLUni.cpp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- XMLUni.cpp	18 Sep 2003 20:23:30 -0000	1.35
  +++ XMLUni.cpp	22 Oct 2003 20:33:42 -0000	1.36
  @@ -702,6 +702,17 @@
       ,   chLatin_c, chLatin_a, chLatin_n, chLatin_n, chLatin_e, chLatin_r, chNull
   };
   
  +const XMLCh XMLUni::fgCDataStart[] =
  +{
  +        chOpenAngle, chBang, chOpenSquare, chLatin_C, chLatin_D
  +    ,   chLatin_A, chLatin_T, chLatin_A, chOpenSquare, chNull
  +};
  +
  +const XMLCh XMLUni::fgCDataEnd[] =
  +{
  +         chCloseSquare, chCloseSquare, chCloseAngle, chNull
  +};
  +
   //Exception strings
   const XMLCh XMLUni::fgArrayIndexOutOfBoundsException_Name[] =
   {
  
  
  
  1.30      +3 -2      xml-xerces/c/src/xercesc/util/XMLUni.hpp
  
  Index: XMLUni.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLUni.hpp,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- XMLUni.hpp	18 Sep 2003 20:23:30 -0000	1.29
  +++ XMLUni.hpp	22 Oct 2003 20:33:42 -0000	1.30
  @@ -184,7 +184,6 @@
       static const XMLCh fgXMLDeclStringHTabU[];
       static const XMLCh fgXMLDeclStringLFU[];
       static const XMLCh fgXMLDeclStringCRU[];
  -
       static const XMLCh fgXMLNSString[];
       static const XMLCh fgXMLNSColonString[];
       static const XMLCh fgXMLNSURIName[];
  @@ -202,6 +201,8 @@
       static const XMLCh fgIGXMLScanner[];
       static const XMLCh fgSGXMLScanner[];
       static const XMLCh fgDGXMLScanner[];
  +    static const XMLCh fgCDataStart[];
  +    static const XMLCh fgCDataEnd[];
   
       // Exception Name
       static const XMLCh fgArrayIndexOutOfBoundsException_Name[];
  
  
  
  1.11      +420 -6    xml-xerces/c/src/xercesc/validators/schema/XSDDOMParser.cpp
  
  Index: XSDDOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/XSDDOMParser.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XSDDOMParser.cpp	20 Jun 2003 19:03:04 -0000	1.10
  +++ XSDDOMParser.cpp	22 Oct 2003 20:33:42 -0000	1.11
  @@ -64,8 +64,14 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <xercesc/validators/schema/XSDDOMParser.hpp>
  -#include <xercesc/dom/DOMDocument.hpp>
  +#include <xercesc/validators/schema/SchemaSymbols.hpp>
   #include <xercesc/internal/XMLScanner.hpp>
  +#include <xercesc/internal/ElemStack.hpp>
  +#include <xercesc/dom/DOMDocument.hpp>
  +#include <xercesc/dom/impl/DOMElementImpl.hpp>
  +#include <xercesc/dom/impl/DOMAttrImpl.hpp>
  +#include <xercesc/dom/impl/DOMTextImpl.hpp>
  +#include <xercesc/framework/XMLValidityCodes.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -77,14 +83,24 @@
                             , XMLGrammarPool* const gramPool):
       XercesDOMParser(valToAdopt, manager, gramPool)
       , fSawFatal(false)
  +    , fAnnotationDepth(-1)
  +    , fInnerAnnotationDepth(-1)
  +    , fDepth(-1)
       , fUserErrorReporter(0)
  +    , fUserEntityHandler(0)
  +    , fAnnotationBuf(1023, manager)
  +    , fURIs(0)
   {
  -
  +    fURIs = new (manager) ValueVectorOf<unsigned int>(16, manager);
  +    fXSDErrorReporter.setErrorReporter(this);    
  +    setValidationScheme(XercesDOMParser::Val_Never);
  +    setDoNamespaces(true);
   }
   
   
   XSDDOMParser::~XSDDOMParser()
   {
  +    delete fURIs;
   }
   
   
  @@ -95,26 +111,424 @@
                                                 const XMLCh *qualifiedName)
   {
       ReaderMgr::LastExtEntityInfo lastInfo;
  -    ((ReaderMgr*) getScanner()->getLocator())->getLastExtEntityInfo(lastInfo);
  +    ((ReaderMgr*) fScanner->getLocator())->getLastExtEntityInfo(lastInfo);
   
       return getDocument()->createElementNS(namespaceURI, qualifiedName,
                                             lastInfo.lineNumber, lastInfo.colNumber);
   }
   
   
  +void XSDDOMParser::startAnnotation( const XMLElementDecl&       elemDecl
  +                                  , const RefVectorOf<XMLAttr>& attrList
  +                                  , const unsigned int          attrCount)
  +{
  +    fAnnotationBuf.append(chOpenAngle);
  +	fAnnotationBuf.append(elemDecl.getFullName());
  +    fAnnotationBuf.append(chSpace);
  +
  +    // attributes are a bit of a pain.  To get this right, we have to keep track
  +    // of the namespaces we've seen declared, then examine the namespace context
  +    // for other namespaces so that we can also include them.
  +    // optimized for simplicity and the case that not many
  +    // namespaces are declared on this annotation...
  +    fURIs->removeAllElements();
  +    for (unsigned int i=0; i < attrCount; i++) {
  +
  +        const XMLAttr* oneAttrib = attrList.elementAt(i);
  +        const XMLCh* attrValue = oneAttrib->getValue();
  +        unsigned int attrURIId = oneAttrib->getURIId();
  +
  +        if (XMLString::equals(oneAttrib->getName(), XMLUni::fgXMLNSString))
  +            fURIs->addElement(fScanner->getPrefixId(XMLUni::fgZeroLenString));
  +        else  if (!XMLString::compareNString(oneAttrib->getQName(), XMLUni::fgXMLNSColonString, 6))
  +            fURIs->addElement(fScanner->getPrefixId(oneAttrib->getName()));
  +
  +        fAnnotationBuf.append(oneAttrib->getQName());
  +        fAnnotationBuf.append(chEqual);
  +        fAnnotationBuf.append(chDoubleQuote);
  +        fAnnotationBuf.append(attrValue);
  +        fAnnotationBuf.append(chDoubleQuote);
  +        fAnnotationBuf.append(chSpace);
  +    }
  +
  +    // now we have to look through currently in-scope namespaces to see what
  +    // wasn't declared here
  +    ValueVectorOf<PrefMapElem*>* namespaceContext = fScanner->getNamespaceContext();
  +    for (unsigned int j=0; j < namespaceContext->size(); j++)
  +    {
  +        unsigned int prefId = namespaceContext->elementAt(j)->fPrefId;
  +
  +        if (!fURIs->containsElement(prefId)) {
  +
  +            const XMLCh* prefix = fScanner->getPrefixForId(prefId);
  +
  +            if (XMLString::equals(prefix, XMLUni::fgZeroLenString)) {
  +                fAnnotationBuf.append(XMLUni::fgXMLNSString);
  +            }
  +            else  {
  +                fAnnotationBuf.append(XMLUni::fgXMLNSColonString);
  +                fAnnotationBuf.append(prefix);
  +            }
  +
  +            fAnnotationBuf.append(chEqual);
  +            fAnnotationBuf.append(chDoubleQuote);
  +            fAnnotationBuf.append(fScanner->getURIText(namespaceContext->elementAt(j)->fURIId));
  +            fAnnotationBuf.append(chDoubleQuote);
  +            fAnnotationBuf.append(chSpace);
  +        }
  +    }
  +
  +    fAnnotationBuf.append(chCloseAngle);
  +    fAnnotationBuf.append(chLF);
  +}
  +
  +void XSDDOMParser::startAnnotationElement( const XMLElementDecl&       elemDecl
  +                                         , const RefVectorOf<XMLAttr>& attrList
  +                                         , const unsigned int          attrCount)
  +{
  +    fAnnotationBuf.append(chOpenAngle);
  +    fAnnotationBuf.append(elemDecl.getFullName());
  +    //fAnnotationBuf.append(chSpace);
  +
  +    for(unsigned int i=0; i < attrCount; i++) {
  +
  +        const XMLAttr* oneAttr = attrList.elementAt(i);
  +        fAnnotationBuf.append(chSpace);
  +        fAnnotationBuf.append(oneAttr ->getQName());
  +        fAnnotationBuf.append(chEqual);
  +        fAnnotationBuf.append(chDoubleQuote);
  +        fAnnotationBuf.append(oneAttr->getValue());
  +        fAnnotationBuf.append(chDoubleQuote);
  +    }
  +
  +    fAnnotationBuf.append(chCloseAngle);
  +}
  +
  +void XSDDOMParser::endAnnotationElement( const XMLElementDecl& elemDecl
  +                                       , bool complete)
  +{
  +    if (complete)
  +    {
  +        fAnnotationBuf.append(chLF);
  +        fAnnotationBuf.append(chOpenAngle);
  +        fAnnotationBuf.append(chForwardSlash);
  +        fAnnotationBuf.append(elemDecl.getFullName());
  +        fAnnotationBuf.append(chCloseAngle);
  +
  +        // note that this is always called after endElement on <annotation>'s
  +        // child and before endElement on annotation.
  +        // hence, we must make this the child of the current
  +        // parent's only child.
  +        DOMTextImpl *node = (DOMTextImpl *)fDocument->createTextNode(fAnnotationBuf.getRawBuffer());
  +        fCurrentNode->appendChild(node);
  +        fAnnotationBuf.reset();
  +    }
  +    else      //capturing character calls
  +    {
  +        fAnnotationBuf.append(chOpenAngle);
  +        fAnnotationBuf.append(chForwardSlash);
  +        fAnnotationBuf.append(elemDecl.getFullName());
  +        fAnnotationBuf.append(chCloseAngle);
  +    }
  +}
  +
  +
   // ---------------------------------------------------------------------------
   //  XSDDOMParser: Setter methods
   // ---------------------------------------------------------------------------
   void XSDDOMParser::setUserErrorReporter(XMLErrorReporter* const errorReporter)
   {
       fUserErrorReporter = errorReporter;
  -    getScanner()->setErrorReporter(this);
  +    fScanner->setErrorReporter(this);
   }
   
   void XSDDOMParser::setUserEntityHandler(XMLEntityHandler* const entityHandler)
   {
       fUserEntityHandler = entityHandler;
  -    getScanner()->setEntityHandler(this);
  +    fScanner->setEntityHandler(this);
  +}
  +
  +
  +// ---------------------------------------------------------------------------
  +//  XSDDOMParser: Implementation of the XMLDocumentHandler interface
  +// ---------------------------------------------------------------------------
  +void XSDDOMParser::startElement( const XMLElementDecl&       elemDecl
  +                               , const unsigned int          urlId
  +                               , const XMLCh* const          elemPrefix
  +                               , const RefVectorOf<XMLAttr>& attrList
  +                               , const unsigned int          attrCount
  +                               , const bool                  isEmpty
  +                               , const bool                  isRoot)
  +{
  +    fDepth++;
  +
  +    // while it is true that non-whitespace character data
  +    // may only occur in appInfo or documentation
  +    // elements, it's certainly legal for comments and PI's to
  +    // occur as children of annotation; we need
  +    // to account for these here.
  +    if (fAnnotationDepth == -1)
  +    {
  +        if (XMLString::equals(elemDecl.getBaseName(), SchemaSymbols::fgELT_ANNOTATION) &&
  +            XMLString::equals(getURIText(urlId), SchemaSymbols::fgURI_SCHEMAFORSCHEMA))
  +        {
  +
  +            fAnnotationDepth = fDepth;
  +            startAnnotation(elemDecl, attrList, attrCount);
  +        } 
  +    }
  +    else if (fDepth == fAnnotationDepth+1)
  +    {
  +        fInnerAnnotationDepth = fDepth;
  +        startAnnotationElement(elemDecl, attrList, attrCount);
  +    }
  +    else
  +    {
  +        startAnnotationElement(elemDecl, attrList, attrCount);
  +        // avoid falling through; don't call startElement in this case
  +        return;
  +    }
  +
  +    DOMElement *elem;
  +    if (urlId != fScanner->getEmptyNamespaceId())  //TagName has a prefix
  +    {
  +        if (elemPrefix && *elemPrefix)
  +        {
  +            XMLBufBid elemQName(&fBufMgr);
  +            elemQName.set(elemPrefix);
  +            elemQName.append(chColon);
  +            elemQName.append(elemDecl.getBaseName());
  +            elem = createElementNSNode(
  +                fScanner->getURIText(urlId), elemQName.getRawBuffer());
  +        }
  +        else {
  +            elem = createElementNSNode(
  +                fScanner->getURIText(urlId), elemDecl.getBaseName());
  +        }
  +    }
  +    else {
  +        elem = createElementNSNode(0, elemDecl.getBaseName());
  +    }
  +
  +    DOMElementImpl *elemImpl = (DOMElementImpl *) elem;
  +    for (unsigned int index = 0; index < attrCount; ++index)
  +    {
  +        const XMLAttr* oneAttrib = attrList.elementAt(index);
  +        unsigned int attrURIId = oneAttrib->getURIId();
  +        const XMLCh* namespaceURI = 0;
  +
  +        //for xmlns=...
  +        if (XMLString::equals(oneAttrib->getName(), XMLUni::fgXMLNSString))
  +            attrURIId = fScanner->getXMLNSNamespaceId();
  +
  +        //TagName has a prefix
  +        if (attrURIId != fScanner->getEmptyNamespaceId())
  +            namespaceURI = fScanner->getURIText(attrURIId); //get namespaceURI
  +
  +        //  revisit.  Optimize to init the named node map to the
  +        //            right size up front.
  +        DOMAttrImpl *attr = (DOMAttrImpl *)
  +            fDocument->createAttributeNS(namespaceURI, oneAttrib->getQName());
  +        attr->setValue(oneAttrib -> getValue());
  +        DOMNode* remAttr = elemImpl->setAttributeNodeNS(attr);
  +        if (remAttr)
  +            remAttr->release();
  +
  +        // Attributes of type ID.  If this is one, add it to the hashtable of IDs
  +        //   that is constructed for use by GetElementByID().
  +        if (oneAttrib->getType()==XMLAttDef::ID)
  +        {
  +            if (fDocument->fNodeIDMap == 0)
  +                fDocument->fNodeIDMap = new (fDocument) DOMNodeIDMap(500, fDocument);
  +            fDocument->fNodeIDMap->add(attr);
  +            attr->fNode.isIdAttr(true);
  +        }
  +
  +        attr->setSpecified(oneAttrib->getSpecified());
  +    }
  +
  +    // set up the default attributes
  +    if (elemDecl.hasAttDefs())
  +	{
  +        XMLAttDefList* defAttrs = &elemDecl.getAttDefList();
  +        XMLAttDef* attr = 0;
  +        DOMAttrImpl * insertAttr = 0;
  +
  +        while (defAttrs->hasMoreElements())
  +        {
  +            attr = &defAttrs->nextElement();
  +
  +            const XMLAttDef::DefAttTypes defType = attr->getDefaultType();
  +            if ((defType == XMLAttDef::Default)
  +            ||  (defType == XMLAttDef::Fixed))
  +            {
  +                // DOM Level 2 wants all namespace declaration attributes
  +                // to be bound to "http://www.w3.org/2000/xmlns/"
  +                // So as long as the XML parser doesn't do it, it needs to
  +                // done here.
  +                const XMLCh* qualifiedName = attr->getFullName();
  +                XMLBufBid bbPrefixQName(&fBufMgr);
  +                XMLBuffer& prefixBuf = bbPrefixQName.getBuffer();
  +                int colonPos = -1;
  +                unsigned int uriId = fScanner->resolveQName(qualifiedName, prefixBuf, ElemStack::Mode_Attribute, colonPos);
  +
  +                const XMLCh* namespaceURI = 0;
  +                if (XMLString::equals(qualifiedName, XMLUni::fgXMLNSString))
  +                    uriId = fScanner->getXMLNSNamespaceId();
  +
  +                //TagName has a prefix
  +                if (uriId != fScanner->getEmptyNamespaceId())
  +                    namespaceURI = fScanner->getURIText(uriId);
  +
  +                insertAttr = (DOMAttrImpl *) fDocument->createAttributeNS(
  +                    namespaceURI, qualifiedName);
  +
  +                DOMAttr* remAttr = elemImpl->setDefaultAttributeNodeNS(insertAttr);
  +                if (remAttr)
  +                    remAttr->release();
  +
  +                if (attr->getValue() != 0)
  +                {
  +                    insertAttr->setValue(attr->getValue());
  +                    insertAttr->setSpecified(false);
  +                }
  +            }
  +
  +            insertAttr = 0;
  +            attr->reset();
  +        }
  +    }
  +
  +    fCurrentParent->appendChild(elem);
  +    fNodeStack->push(fCurrentParent);
  +    fCurrentParent = elem;
  +    fCurrentNode = elem;
  +    fWithinElement = true;
  +
  +    // If an empty element, do end right now (no endElement() will be called)
  +    if (isEmpty)
  +        endElement(elemDecl, urlId, isRoot, elemPrefix);
  +}
  +
  +
  +
  +void XSDDOMParser::endElement( const XMLElementDecl& elemDecl
  +                             , const unsigned int    urlId
  +                             , const bool            isRoot
  +                             , const XMLCh* const    elemPrefix)
  +{
  +    if(fAnnotationDepth > -1)
  +    {
  +        if (fInnerAnnotationDepth == fDepth)
  +        {
  +            fInnerAnnotationDepth = -1;
  +            endAnnotationElement(elemDecl, false);
  +	    }
  +        else if (fAnnotationDepth == fDepth) 
  +        {
  +            fAnnotationDepth = -1;
  +            endAnnotationElement(elemDecl, true);
  +        }
  +        else 
  +        {   // inside a child of annotation
  +            endAnnotationElement(elemDecl, false);
  +            fDepth--;
  +            return;
  +        }
  +    }
  +
  +	fDepth--;
  +    fCurrentNode   = fCurrentParent;
  +    fCurrentParent = fNodeStack->pop();
  +
  +    // If we've hit the end of content, clear the flag
  +    if (fNodeStack->empty())
  +        fWithinElement = false;
  +}
  +
  +void XSDDOMParser::docCharacters(  const   XMLCh* const    chars
  +                              , const unsigned int    length
  +                              , const bool            cdataSection)
  +{
  +    // Ignore chars outside of content
  +    if (!fWithinElement)
  +        return;
  +
  +    if (fInnerAnnotationDepth == -1)
  +    {
  +        if (!((ReaderMgr*) fScanner->getReaderMgr())->getCurrentReader()->isAllSpaces(chars, length))
  +        {
  +            ReaderMgr::LastExtEntityInfo lastInfo;
  +            fScanner->getReaderMgr()->getLastExtEntityInfo(lastInfo);
  +            fXSLocator.setValues(lastInfo.systemId, lastInfo.publicId, lastInfo.lineNumber, lastInfo.colNumber);
  +            fXSDErrorReporter.emitError(XMLValid::NonWSContent, XMLUni::fgValidityDomain, &fXSLocator);
  +        }
  +    }
  +    // when it's within either of the 2 annotation subelements, characters are
  +    // allowed and we need to store them.
  +    else if (cdataSection == true)
  +    {
  +        fAnnotationBuf.append(XMLUni::fgCDataStart);
  +        fAnnotationBuf.append(chars, length);
  +        fAnnotationBuf.append(XMLUni::fgCDataEnd);
  +    }
  +    else
  +    {
  +        for(unsigned int i = 0; i < length; i++ )
  +        {
  +            if(chars[i] == chAmpersand)
  +            {
  +                fAnnotationBuf.append(chAmpersand);
  +                fAnnotationBuf.append(XMLUni::fgAmp);
  +                fAnnotationBuf.append(chSemiColon);
  +            }
  +            else if (chars[i] == chOpenAngle)
  +            {
  +                fAnnotationBuf.append(chAmpersand);
  +                fAnnotationBuf.append(XMLUni::fgLT);
  +                fAnnotationBuf.append(chSemiColon);
  +            }
  +            else {
  +                fAnnotationBuf.append(chars[i]);
  +            }
  +        }
  +    }
  +}
  +
  +void XSDDOMParser::docComment(const XMLCh* const comment)
  +{
  +    if (fAnnotationDepth > -1)
  +    {
  +        fAnnotationBuf.append(XMLUni::fgCommentString);
  +        fAnnotationBuf.append(comment);
  +        fAnnotationBuf.append(chDash);
  +        fAnnotationBuf.append(chDash);
  +        fAnnotationBuf.append(chCloseAngle);
  +    }
  +}
  +
  +void XSDDOMParser::startEntityReference(const XMLEntityDecl& entDecl)
  +{
  +    int i=0;
  +    i++;
  +}
  +
  +void XSDDOMParser::endEntityReference(const XMLEntityDecl& entDecl)
  +{
  +    int j=0;
  +    j++;
  +}
  +
  +void XSDDOMParser::ignorableWhitespace( const XMLCh* const chars
  +                                      , const unsigned int length
  +                                      , const bool         cdataSection)
  +{
  +    // Ignore chars before the root element
  +    if (!fWithinElement || !fIncludeIgnorableWhitespace)
  +        return;
  +
  +    if (fAnnotationDepth > -1)
  +        fAnnotationBuf.append(chars, length);
   }
   
   // ---------------------------------------------------------------------------
  
  
  
  1.9       +191 -4    xml-xerces/c/src/xercesc/validators/schema/XSDDOMParser.hpp
  
  Index: XSDDOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/XSDDOMParser.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSDDOMParser.hpp	20 Jun 2003 19:03:04 -0000	1.8
  +++ XSDDOMParser.hpp	22 Oct 2003 20:33:42 -0000	1.9
  @@ -64,6 +64,8 @@
   
   
   #include <xercesc/parsers/XercesDOMParser.hpp>
  +#include <xercesc/validators/schema/XSDErrorReporter.hpp>
  +#include <xercesc/validators/schema/XSDLocator.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -111,6 +113,160 @@
   
       //@}
   
  +    // -----------------------------------------------------------------------
  +    //  Implementation of the XMLDocumentHandler interface.
  +    // -----------------------------------------------------------------------
  +
  +    /** @name Implementation of the XMLDocumentHandler interface. */
  +    //@{
  +
  +    /** Handle a start element event
  +      *
  +      * This method is used to report the start of an element. It is
  +      * called at the end of the element, by which time all attributes
  +      * specified are also parsed. A new DOM Element node is created
  +      * along with as many attribute nodes as required. This new element
  +      * is added appended as a child of the current node in the tree, and
  +      * then replaces it as the current node (if the isEmpty flag is false.)
  +      *
  +      * @param elemDecl A const reference to the object containing element
  +      *                 declaration information.
  +      * @param urlId    An id referring to the namespace prefix, if
  +      *                 namespaces setting is switched on.
  +      * @param elemPrefix A const pointer to a Unicode string containing
  +      *                 the namespace prefix for this element. Applicable
  +      *                 only when namespace processing is enabled.
  +      * @param attrList A const reference to the object containing the
  +      *                 list of attributes just scanned for this element.
  +      * @param attrCount A count of number of attributes in the list
  +      *                 specified by the parameter 'attrList'.
  +      * @param isEmpty  A flag indicating whether this is an empty element
  +      *                 or not. If empty, then no endElement() call will
  +      *                 be made.
  +      * @param isRoot   A flag indicating whether this element was the
  +      *                 root element.
  +      * @see DocumentHandler#startElement
  +      */
  +    virtual void startElement
  +    (
  +        const   XMLElementDecl&         elemDecl
  +        , const unsigned int            urlId
  +        , const XMLCh* const            elemPrefix
  +        , const RefVectorOf<XMLAttr>&   attrList
  +        , const unsigned int            attrCount
  +        , const bool                    isEmpty
  +        , const bool                    isRoot
  +    );
  +
  +    /** Handle and end of element event
  +      *
  +      * This method is used to indicate the end tag of an element. The
  +      * DOM parser pops the current element off the top of the element
  +      * stack, and make it the new current element.
  +      *
  +      * @param elemDecl A const reference to the object containing element
  +      *                 declaration information.
  +      * @param urlId    An id referring to the namespace prefix, if
  +      *                 namespaces setting is switched on.
  +      * @param isRoot   A flag indicating whether this element was the
  +      *                 root element.
  +      * @param elemPrefix A const pointer to a Unicode string containing
  +      *                 the namespace prefix for this element. Applicable
  +      *                 only when namespace processing is enabled.
  +      */
  +    virtual void endElement
  +    (
  +        const   XMLElementDecl& elemDecl
  +        , const unsigned int    urlId
  +        , const bool            isRoot
  +        , const XMLCh* const    elemPrefix
  +    );
  +
  +    /** Handle document character events
  +      *
  +      * This method is used to report all the characters scanned by the
  +      * parser. This DOM implementation stores this data in the appropriate
  +      * DOM node, creating one if necessary.
  +      *
  +      * @param chars   A const pointer to a Unicode string representing the
  +      *                character data.
  +      * @param length  The length of the Unicode string returned in 'chars'.
  +      * @param cdataSection  A flag indicating if the characters represent
  +      *                      content from the CDATA section.
  +      */
  +    virtual void docCharacters
  +    (
  +        const   XMLCh* const    chars
  +        , const unsigned int    length
  +        , const bool            cdataSection
  +    );
  +
  +    /** Handle a document comment event
  +      *
  +      * This method is used to report any comments scanned by the parser.
  +      * A new comment node is created which stores this data.
  +      *
  +      * @param comment A const pointer to a null terminated Unicode
  +      *                string representing the comment text.
  +      */
  +    virtual void docComment
  +    (
  +        const   XMLCh* const    comment
  +    );
  +
  +    /** Handle a start entity reference event
  +      *
  +      * This method is used to indicate the start of an entity reference.
  +      * If the expand entity reference flag is true, then a new
  +      * DOM Entity reference node is created.
  +      *
  +      * @param entDecl A const reference to the object containing the
  +      *                entity declaration information.
  +      */
  +    virtual void startEntityReference
  +    (
  +        const   XMLEntityDecl&  entDecl
  +    );
  +
  +    /** Handle and end of entity reference event
  +      *
  +      * This method is used to indicate that an end of an entity reference
  +      * was just scanned.
  +      *
  +      * @param entDecl A const reference to the object containing the
  +      *                entity declaration information.
  +      */
  +    virtual void endEntityReference
  +    (
  +        const   XMLEntityDecl&  entDecl
  +    );
  +
  +    /** Handle an ignorable whitespace vent
  +      *
  +      * This method is used to report all the whitespace characters, which
  +      * are determined to be 'ignorable'. This distinction between characters
  +      * is only made, if validation is enabled.
  +      *
  +      * Any whitespace before content is ignored. If the current node is
  +      * already of type DOMNode::TEXT_NODE, then these whitespaces are
  +      * appended, otherwise a new Text node is created which stores this
  +      * data. Essentially all contiguous ignorable characters are collected
  +      * in one node.
  +      *
  +      * @param chars   A const pointer to a Unicode string representing the
  +      *                ignorable whitespace character data.
  +      * @param length  The length of the Unicode string 'chars'.
  +      * @param cdataSection  A flag indicating if the characters represent
  +      *                      content from the CDATA section.
  +      */
  +    virtual void ignorableWhitespace
  +    (
  +        const   XMLCh* const    chars
  +        , const unsigned int    length
  +        , const bool            cdataSection
  +    );
  +
  +    //@}
   
       // -----------------------------------------------------------------------
       //  Get methods
  @@ -158,9 +314,40 @@
                                               const XMLCh *qualifiedName);
   
   private:
  -    bool              fSawFatal;
  -    XMLErrorReporter* fUserErrorReporter;
  -    XMLEntityHandler* fUserEntityHandler;
  +    // -----------------------------------------------------------------------
  +    //  Private Helper methods
  +    // -----------------------------------------------------------------------
  +    void startAnnotation
  +    (
  +        const   XMLElementDecl&         elemDecl
  +        , const RefVectorOf<XMLAttr>&   attrList
  +        , const unsigned int            attrCount
  +    );
  +    void startAnnotationElement
  +    (
  +        const   XMLElementDecl&         elemDecl
  +        , const RefVectorOf<XMLAttr>&   attrList
  +        , const unsigned int            attrCount
  +    );
  +    void endAnnotationElement
  +    (
  +        const XMLElementDecl& elemDecl
  +        ,     bool            complete
  +    );
  +
  +    // -----------------------------------------------------------------------
  +    //  Private data members
  +    // -----------------------------------------------------------------------
  +    bool                         fSawFatal;
  +    int                          fAnnotationDepth;
  +    int                          fInnerAnnotationDepth;
  +    int                          fDepth;
  +    XMLErrorReporter*            fUserErrorReporter;
  +    XMLEntityHandler*            fUserEntityHandler;
  +    ValueVectorOf<unsigned int>* fURIs;
  +    XMLBuffer                    fAnnotationBuf;
  +    XSDErrorReporter             fXSDErrorReporter;
  +    XSDLocator                   fXSLocator;
   };
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org