X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..4388f060552cc537e71e957d32f35e9d75a61233:/icuSources/tools/toolutil/xmlparser.cpp?ds=sidebyside diff --git a/icuSources/tools/toolutil/xmlparser.cpp b/icuSources/tools/toolutil/xmlparser.cpp index 55688320..134fdcf8 100644 --- a/icuSources/tools/toolutil/xmlparser.cpp +++ b/icuSources/tools/toolutil/xmlparser.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2004-2008, International Business Machines +* Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -563,7 +563,7 @@ UnicodeString UXMLParser::scanContent(UErrorCode &status) { UnicodeString result; if (mXMLCharData.lookingAt(fPos, status)) { - result = mXMLCharData.group(0, status); + result = mXMLCharData.group((int32_t)0, status); // Normalize the new-lines. (Before char ref substitution) mNewLineNormalizer.reset(result); result = mNewLineNormalizer.replaceAll(fOneLF, status); @@ -622,7 +622,7 @@ UXMLParser::replaceCharRefs(UnicodeString &s, UErrorCode &status) { // An unrecognized &entity; Leave it alone. // TODO: check that it really looks like an entity, and is not some // random & in the text. - replacement = mAmps.group(0, status); + replacement = mAmps.group((int32_t)0, status); } mAmps.appendReplacement(result, replacement, status); } @@ -715,8 +715,9 @@ UXMLElement::appendText(UnicodeString &text, UBool recurse) const { int32_t i, count=fChildren.size(); for(i=0; igetDynamicClassID()==UnicodeString::getStaticClassID()) { - text.append(*(const UnicodeString *)node); + const UnicodeString *s=dynamic_cast(node); + if(s!=NULL) { + text.append(*s); } else if(recurse) /* must be a UXMLElement */ { ((const UXMLElement *)node)->appendText(text, recurse); } @@ -766,7 +767,7 @@ const UObject * UXMLElement::getChild(int32_t i, UXMLNodeType &type) const { if(0<=i && igetDynamicClassID()==UXMLElement::getStaticClassID()) { + if(dynamic_cast(node)!=NULL) { type=UXML_NODE_TYPE_ELEMENT; } else { type=UXML_NODE_TYPE_STRING; @@ -787,10 +788,9 @@ UXMLElement::nextChildElement(int32_t &i) const { int32_t count=fChildren.size(); while(igetDynamicClassID()==UXMLElement::getStaticClassID()) { - return (const UXMLElement *)node; + const UXMLElement *elem=dynamic_cast(node); + if(elem!=NULL) { + return elem; } } return NULL; @@ -809,8 +809,8 @@ UXMLElement::getChildElement(const UnicodeString &name) const { int32_t i, count=fChildren.size(); for(i=0; igetDynamicClassID()==UXMLElement::getStaticClassID()) { - const UXMLElement *elem=(const UXMLElement *)node; + const UXMLElement *elem=dynamic_cast(node); + if(elem!=NULL) { if(p==elem->fName) { return elem; }