00001 00002 #ifndef _B_XML_ENTITY_PARSE_CONTEXT_H 00003 #define _B_XML_ENTITY_PARSE_CONTEXT_H 00004 00005 #include <xml/BParser.h> 00006 00007 namespace B { 00008 namespace XML { 00009 00010 // BXMLEntityParseContext 00011 // ===================================================================== 00012 class BXMLEntityParseContext : public BXMLDocumentCreationContext 00013 { 00014 public: 00015 BXMLEntityParseContext(BEntityDecl * decl, 00016 bool parameterEntity, 00017 BDocumentType * dt, 00018 BXMLObjectFactory * factory, 00019 BEntityStore * entityStore, 00020 BDocumentTypeDefinition * dtd = NULL); 00021 virtual ~BXMLEntityParseContext(); 00022 00023 00024 status_t ExpandEntities(BString & str, const char delim); 00025 00026 private: 00027 bool _parameterEntity; 00028 BEntityDecl * _decl; 00029 BDocumentType * _dt; 00030 bool _deleteDTDObjectsWhenDone; 00031 BDocumentTypeDefinition * _dtdObjects; 00032 00033 public: 00034 // Implementations of BXMLDocumentCreationContext functions 00035 virtual status_t OnBeginDocumentNode(); 00036 virtual status_t OnEndDocumentNode(); 00037 virtual status_t OnStartTagNode(BElement * element); 00038 virtual status_t OnEndTagNode(BElement * element); 00039 virtual status_t OnTextNode(BText * text); 00040 virtual status_t OnCDataNode(BCData * cData); 00041 virtual status_t OnCommentNode(BComment * comment); 00042 virtual status_t OnBeginDocumentTypeNode(BDocumentType * dt); 00043 virtual status_t OnExternalSubsetNode(BDocumentTypeDefinition * dtd); 00044 virtual status_t OnBeginInternalSubsetNode(BDocumentTypeDefinition * dtd); 00045 virtual status_t OnEndInternalSubsetNode(); 00046 virtual status_t OnEndDocumentTypeNode(); 00047 virtual status_t OnProcessingInstructionNode(BProcessingInstruction * pi); 00048 virtual status_t OnElementDeclNode(BElementDecl * decl); 00049 virtual status_t OnAttributeDeclNode(BAttributeDecl * decl); 00050 virtual status_t OnEntityDeclNode(BEntityDecl * decl); 00051 //virtual status_t OnNotationDeclNode(BNotationDecl * decl); XXX Not implemented 00052 00053 virtual BDocumentType * GetDocumentType(); 00054 00055 // Implementations of BXMLParseContext functions 00056 virtual status_t OnGeneralParsedEntityRef(BString & name); 00057 virtual status_t OnGeneralParsedEntityRef(BString & name, BString & replacement); 00058 virtual status_t OnParameterEntityRef(BString & name); 00059 virtual status_t OnParameterEntityRef(BString & name, BString & replacement); 00060 }; 00061 00062 00063 00064 }; // namespace XML 00065 }; // namespace B 00066 00067 00068 #endif // _B_XML_ENTITY_PARSE_CONTEXT_H