Exemplo n.º 1
0
  private Map<String, TtmlStyle> parseHeader(
      XmlPullParser xmlParser, Map<String, TtmlStyle> globalStyles)
      throws IOException, XmlPullParserException {

    do {
      xmlParser.next();
      if (ParserUtil.isStartTag(xmlParser, TtmlNode.TAG_STYLE)) {
        String parentStyleId = xmlParser.getAttributeValue(null, ATTR_STYLE);
        TtmlStyle style = parseStyleAttributes(xmlParser, new TtmlStyle());
        if (parentStyleId != null) {
          String[] ids = parseStyleIds(parentStyleId);
          for (int i = 0; i < ids.length; i++) {
            style.chain(globalStyles.get(ids[i]));
          }
        }
        if (style.getId() != null) {
          globalStyles.put(style.getId(), style);
        }
      }
    } while (!ParserUtil.isEndTag(xmlParser, TtmlNode.TAG_HEAD));
    return globalStyles;
  }