CDATASection constructor fixes

This commit is contained in:
jez_higgins 2005-08-30 11:35:12 +00:00
parent 7b9f9999cb
commit a395a7e20e
2 changed files with 6 additions and 3 deletions

View file

@ -21,10 +21,10 @@ class CDATASection : public Text<stringT>
CDATASection() : Text<stringT>() { } CDATASection() : Text<stringT>() { }
explicit CDATASection(CDATASection_impl<stringT>* impl) : Text<stringT>(impl) { } explicit CDATASection(CDATASection_impl<stringT>* impl) : Text<stringT>(impl) { }
CDATASection(const CDATASection& rhs) : Text<stringT>(rhs) { } CDATASection(const CDATASection& rhs) : Text<stringT>(rhs) { }
explicit CDATASection(const Node<stringT>& rhs) : Text<stringT>(rhs) explicit CDATASection(const Node<stringT>& rhs) : Text<stringT>(rhs, 0)
{ {
if(dynamic_cast<CDATASection_impl<stringT>*>(rhs.impl()) == 0) if(rhs.getNodeType() != CDATA_SECTION_NODE)
throw std::bad_cast(); throw std::bad_cast("Cannot convert Node to CDATA section");
} // CDATASection } // CDATASection
CDATASection<stringT> splitText(int offset) CDATASection<stringT> splitText(int offset)

View file

@ -28,6 +28,9 @@ class Text : public CharacterData<stringT>
throw std::bad_cast("Cannot cast Node to Text"); throw std::bad_cast("Cannot cast Node to Text");
} // Text } // Text
protected:
Text(const Node<stringT>& rhs, int dummy) : CharacterData<stringT>(rhs, 0) { }
Text splitText(int offset) Text splitText(int offset)
{ {
return tImpl()->splitText(offset); return tImpl()->splitText(offset);