Lines Matching refs:parser
481 const std::shared_ptr<XmlPullParser>& parser) :
483 mParser(std::make_shared<XliffXmlPullParser>(parser)) {
489 bool ResourceParser::flattenXmlSubtree(XmlPullParser* parser, std::u16string* outRawString,
497 while (XmlPullParser::isGoodEvent(parser->next())) {
498 const XmlPullParser::Event event = parser->getEvent();
511 outRawString->append(parser->getText());
512 builder.append(parser->getText());
515 if (parser->getElementNamespace().size() > 0) {
516 mLogger.warn(parser->getLineNumber())
518 << parser->getElementName()
520 << parser->getElementNamespace()
523 XmlPullParser::skipCurrentElement(parser);
529 std::u16string spanName = parser->getElementName();
530 const auto endAttrIter = parser->endAttributes();
531 for (auto attrIter = parser->beginAttributes(); attrIter != endAttrIter; ++attrIter) {
539 mLogger.error(parser->getLineNumber())
551 mLogger.warn(parser->getLineNumber())
570 ScopedXmlPullParser parser(mParser.get());
571 if (!parser.getElementNamespace().empty() ||
572 parser.getElementName() != u"resources") {
573 mLogger.error(parser.getLineNumber())
579 if (!parseResources(&parser)) {
593 bool ResourceParser::parseResources(XmlPullParser* parser) {
597 while (XmlPullParser::isGoodEvent(parser->next())) {
598 const XmlPullParser::Event event = parser->getEvent();
600 comment = parser->getComment();
605 if (!util::trimWhitespace(parser->getText()).empty()) {
615 ScopedXmlPullParser childParser(parser);
723 if (parser->getEvent() == XmlPullParser::Event::kBadDocument) {
724 mLogger.error(parser->getLineNumber())
725 << parser->getLastError()
746 std::unique_ptr<Item> ResourceParser::parseXml(XmlPullParser* parser, uint32_t typeMask,
748 const size_t beginXmlLine = parser->getLineNumber();
752 if (!flattenXmlSubtree(parser, &rawValue, &styleString)) {
777 parser->applyPackageAlias(&ref.name.package, mTable->getPackage());
802 bool ResourceParser::parseString(XmlPullParser* parser, const ResourceNameRef& resourceName) {
803 const SourceLine source = mSource.line(parser->getLineNumber());
806 const auto endAttrIter = parser->endAttributes();
807 auto attrIter = parser->findAttribute(u"", u"untranslateable");
812 attrIter = parser->findAttribute(u"", u"product");
820 std::unique_ptr<Item> processedItem = parseXml(parser, android::ResTable_map::TYPE_STRING,
832 bool ResourceParser::parseColor(XmlPullParser* parser, const ResourceNameRef& resourceName) {
833 const SourceLine source = mSource.line(parser->getLineNumber());
835 std::unique_ptr<Item> item = parseXml(parser, android::ResTable_map::TYPE_COLOR, kNoRawString);
843 bool ResourceParser::parsePrimitive(XmlPullParser* parser, const ResourceNameRef& resourceName) {
844 const SourceLine source = mSource.line(parser->getLineNumber());
867 std::unique_ptr<Item> item = parseXml(parser, typeMask, kNoRawString);
880 bool ResourceParser::parsePublic(XmlPullParser* parser, const StringPiece16& name) {
881 const SourceLine source = mSource.line(parser->getLineNumber());
883 parser->endAttributes();
884 const auto typeAttrIter = parser->findAttribute(u"", u"type");
905 const auto idAttrIter = parser->findAttribute(u"", u"id");
956 bool ResourceParser::parseAttr(XmlPullParser* parser, const ResourceNameRef& resourceName) {
957 const SourceLine source = mSource.line(parser->getLineNumber());
959 std::unique_ptr<Attribute> attr = parseAttrImpl(parser, &actualName, false);
966 std::unique_ptr<Attribute> ResourceParser::parseAttrImpl(XmlPullParser* parser,
971 const auto endAttrIter = parser->endAttributes();
972 const auto formatAttrIter = parser->findAttribute(u"", u"format");
976 mLogger.error(parser->getLineNumber())
1000 while (XmlPullParser::isGoodEvent(parser->next())) {
1001 if (parser->getEvent() != XmlPullParser::Event::kStartElement) {
1005 ScopedXmlPullParser childParser(parser);
1063 bool ResourceParser::parseEnumOrFlagItem(XmlPullParser* parser, const StringPiece16& tag,
1065 const auto attrIterEnd = parser->endAttributes();
1066 const auto nameAttrIter = parser->findAttribute(u"", u"name");
1068 mLogger.error(parser->getLineNumber())
1074 const auto valueAttrIter = parser->findAttribute(u"", u"value");
1076 mLogger.error(parser->getLineNumber())
1085 mLogger.error(parser->getLineNumber())
1126 bool ResourceParser::parseUntypedItem(XmlPullParser* parser, Style& style) {
1127 const auto endAttrIter = parser->endAttributes();
1128 const auto nameAttrIter = parser->findAttribute(u"", u"name");
1130 mLogger.error(parser->getLineNumber())
1138 mLogger.error(parser->getLineNumber())
1148 parser->applyPackageAlias(&key.package, mTable->getPackage());
1155 std::unique_ptr<Item> value = parseXml(parser, 0, kAllowRawString);
1164 bool ResourceParser::parseStyle(XmlPullParser* parser, const ResourceNameRef& resourceName) {
1165 const SourceLine source = mSource.line(parser->getLineNumber());
1168 const auto endAttrIter = parser->endAttributes();
1169 const auto parentAttrIter = parser->findAttribute(u"", u"parent");
1179 parser->applyPackageAlias(&style->parent.name.package, mTable->getPackage());
1197 while (XmlPullParser::isGoodEvent(parser->next())) {
1198 if (parser->getEvent() != XmlPullParser::Event::kStartElement) {
1202 ScopedXmlPullParser childParser(parser);
1223 bool ResourceParser::parseArray(XmlPullParser* parser, const ResourceNameRef& resourceName,
1225 const SourceLine source = mSource.line(parser->getLineNumber());
1229 while (XmlPullParser::isGoodEvent(parser->next())) {
1230 if (parser->getEvent() != XmlPullParser::Event::kStartElement) {
1234 ScopedXmlPullParser childParser(parser);
1261 bool ResourceParser::parsePlural(XmlPullParser* parser, const ResourceNameRef& resourceName) {
1262 const SourceLine source = mSource.line(parser->getLineNumber());
1266 while (XmlPullParser::isGoodEvent(parser->next())) {
1267 if (parser->getEvent() != XmlPullParser::Event::kStartElement) {
1271 ScopedXmlPullParser childParser(parser);
1336 bool ResourceParser::parseDeclareStyleable(XmlPullParser* parser,
1338 const SourceLine source = mSource.line(parser->getLineNumber());
1342 while (XmlPullParser::isGoodEvent(parser->next())) {
1343 if (parser->getEvent() != XmlPullParser::Event::kStartElement) {
1347 ScopedXmlPullParser childParser(parser);