diff --git a/src/xercesc/framework/psvi/XSAnnotation.cpp b/src/xercesc/framework/psvi/XSAnnotation.cpp index dd8ec4b91fe485b0d6cb919bcf64f0807161d93a..0ef0664a9ed868cc8c9e74b937a52ef4f12a9da8 100644 --- a/src/xercesc/framework/psvi/XSAnnotation.cpp +++ b/src/xercesc/framework/psvi/XSAnnotation.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.9 2004/04/02 16:51:05 peiyongz + * Better error report support + * * Revision 1.8 2003/12/19 07:18:56 neilg * remove a throw clause inserted during debugging (but should we really swallow this exception?) * @@ -97,18 +100,24 @@ XERCES_CPP_NAMESPACE_BEGIN -XSAnnotation::XSAnnotation(const XMLCh* const content, - MemoryManager * const manager): - XSObject(XSConstants::ANNOTATION, 0, manager) - , fContents(XMLString::replicate(content, manager)) - , fNext(0) +XSAnnotation::XSAnnotation(const XMLCh* const content, + MemoryManager * const manager) +:XSObject(XSConstants::ANNOTATION, 0, manager) +,fContents(XMLString::replicate(content, manager)) +,fNext(0) +,fSystemId(0) +,fLine(0) +,fCol(0) { } -XSAnnotation::XSAnnotation(MemoryManager * const manager): - XSObject(XSConstants::ANNOTATION, 0, manager) - , fContents(0) - , fNext(0) +XSAnnotation::XSAnnotation(MemoryManager * const manager) +:XSObject(XSConstants::ANNOTATION, 0, manager) +,fContents(0) +,fNext(0) +,fSystemId(0) +,fLine(0) +,fCol(0) { } @@ -118,6 +127,8 @@ XSAnnotation::~XSAnnotation() if (fNext) delete fNext; + + fMemoryManager->deallocate(fSystemId); } // XSAnnotation methods @@ -201,6 +212,19 @@ XSAnnotation* XSAnnotation::getNext() return fNext; } +void XSAnnotation::setSystemId(const XMLCh* const systemId) +{ + if (fSystemId) + { + fMemoryManager->deallocate(fSystemId); + fSystemId = 0; + } + + if (systemId) + fSystemId = XMLString::replicate(systemId, fMemoryManager); + +} + /*** * Support for Serialization/De-serialization ***/ @@ -209,25 +233,22 @@ IMPL_XSERIALIZABLE_TOCREATE(XSAnnotation) void XSAnnotation::serialize(XSerializeEngine& serEng) { - /*** - * Since we are pretty sure that fIdMap and fHashTable is - * not shared by any other object, therefore there is no owned/referenced - * issue. Thus we can serialize the raw data only, rather than serializing - * both fIdMap and fHashTable. - * - * And we can rebuild the fIdMap and fHashTable out of the raw data during - * deserialization. - * - ***/ + if (serEng.isStoring()) { serEng.writeString(fContents); serEng<<fNext; + serEng.writeString(fSystemId); + serEng<<fLine; + serEng<<fCol; } else { serEng.readString(fContents); serEng>>fNext; + serEng.readString(fSystemId); + serEng>>fLine; + serEng>>fCol; } } diff --git a/src/xercesc/framework/psvi/XSAnnotation.hpp b/src/xercesc/framework/psvi/XSAnnotation.hpp index 4107a2f54dc7f7b22b162f314d62aa37f876ccd5..312f199441ad9d5d4dbe4d9d45f5397da3e538c3 100644 --- a/src/xercesc/framework/psvi/XSAnnotation.hpp +++ b/src/xercesc/framework/psvi/XSAnnotation.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.9 2004/04/02 16:51:05 peiyongz + * Better error report support + * * Revision 1.8 2003/12/01 23:23:26 neilg * fix for bug 25118; thanks to Jeroen Witmond * @@ -185,6 +188,20 @@ public: XSAnnotation* getNext(); //@} + //----------------------------- + /** Getter */ + //@{ + inline void getLineCol(int& line, int& col) const; + inline const XMLCh* getSystemId() const; + //@} + + //----------------------------- + /** Setter */ + //@{ + inline void setLineCol(int line, int col); + void setSystemId(const XMLCh* const systemId); + //@} + /*** * Support for Serialization/De-serialization ***/ @@ -206,6 +223,13 @@ protected: // ----------------------------------------------------------------------- XMLCh* fContents; XSAnnotation* fNext; + +private: + + XMLCh* fSystemId; + int fLine; + int fCol; + }; inline const XMLCh *XSAnnotation::getAnnotationString() const @@ -218,6 +242,23 @@ inline XMLCh *XSAnnotation::getAnnotationString() return fContents; } +inline void XSAnnotation::getLineCol(int& line, int& col) const +{ + line = fLine; + col = fCol; +} + +inline const XMLCh* XSAnnotation::getSystemId() const +{ + return fSystemId; +} + +inline void XSAnnotation::setLineCol(int line, int col) +{ + fLine = line; + fCol = col; +} + XERCES_CPP_NAMESPACE_END #endif