ZRef<ZYadR> sYadR(ZRef<ZML::StrimmerU> iStrimmerU) { sSkipText(iStrimmerU->GetStrim()); if (iStrimmerU->GetStrim().Current() != ZML::eToken_Exhausted) return new YadMapR(iStrimmerU); return null; }
static ZRef<ZYadR> spMakeYadR_XMLPList(ZRef<ZML::StrimmerU> iStrimmerU) { ZML::StrimU& theR = iStrimmerU->GetStrim(); sSkipText(theR); if (theR.Current() == ZML::eToken_TagEmpty) { if (theR.Name() == "dict") { return new ZYadMapR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EmptyTag); } else if (theR.Name() == "array") { return new ZYadSeqR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EmptyTag); } else if (theR.Name() == "data") { return new ZYadStreamerR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EmptyTag); } else if (theR.Name() == "string") { return new ZYadStrimmerR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EmptyTag); } } else if (theR.Current() == ZML::eToken_TagBegin) { if (theR.Name() == "dict") { theR.Advance(); return new ZYadMapR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EndTag); } else if (theR.Name() == "array") { theR.Advance(); return new ZYadSeqR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EndTag); } else if (theR.Name() == "data") { theR.Advance(); return new ZYadStreamerR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EndTag); } else if (theR.Name() == "string") { theR.Advance(); return new ZYadStrimmerR_XMLPList(iStrimmerU, ZYadR_XMLPlist::eRead_EndTag); } } ZAny theVal; if (spTryRead_Any(theR, theVal)) return sMake_YadAtomR_Any(theVal); return null; }
ZRef<ZYadR> ZYad_XMLPList::sYadR(ZRef<ZML::StrimmerU> iStrimmerU) { if (not iStrimmerU) return null; ZML::StrimU& theR = iStrimmerU->GetStrim(); for (;;) { sSkipText(theR); if (theR.Current() != ZML::eToken_TagBegin || theR.Name() != "plist") break; theR.Advance(); } return spMakeYadR_XMLPList(iStrimmerU); }
ZRef<ZYadR> YadMapR::ReadInc(Name& oName) { if (fIter != fAttrs.end()) { oName = fIter->first; ZRef<ZYadR> result = ZooLib::sYadR(fIter->second); ++fIter; return result; } if (!fStrimmerU) return null; ZML::StrimU& theR = fStrimmerU->GetStrim(); // We have read the begin, and have returned // any attributes on that begin. sSkipText(theR); if (fOuterName.empty()) { if (theR.Current() == ZML::eToken_Exhausted) return null; } else if (sTryRead_End(theR, fOuterName)) { return null; } if (theR.Current() == ZML::eToken_TagEmpty) { oName = theR.Name(); ZRef<ZYadR> result = new YadMapR(theR.Attrs()); theR.Advance(); return result; } if (theR.Current() != ZML::eToken_TagBegin) spThrowParseException("Expected begin tag"); ZML::Attrs_t theAttrs = theR.Attrs(); const string theName = theR.Name(); theR.Advance(); oName = theName; const string8 theText = theR.ReadAll8(); sSkipText(theR); if (theR.Current() == ZML::eToken_TagEnd) { if (theR.Name() != theName) spThrowParseException("Expected end tag '" + theName + "'"); if (theAttrs.empty()) { theR.Advance(); return ZooLib::sYadR(theText); } else if (!theText.empty()) { theAttrs.push_back(pair<string, string>("!text", theText)); } } return new YadMapR(fStrimmerU, theName, theAttrs); }