Parse XML to restore the else-if and else inputs.
@param {!Element} xmlElement XML storage element.
@this Blockly.Block
506979
function(xmlElement) {
    this.elseifCount_ = parseInt(xmlElement.getAttribute('elseif'), 10) || 0;
    this.elseCount_ = parseInt(xmlElement.getAttribute('else'), 10) || 0;
    this.updateShape_();
  }
502334
public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes atts) throws SAXException {
        addCdata();

        final Map<String, String> attributes = new NamespaceAwareHashMap();
        final Map<String, String> attributeNamespaces = new HashMap<String, String>();

        for (int i = atts.getLength() - 1; i != -1; i--) {
            if (atts.getURI(i).length() == 0) {
                attributes.put(atts.getQName(i), atts.getValue(i));
            } else {
                String key = new QName(atts.getURI(i), atts.getLocalName(i)).toString();
                attributes.put(key, atts.getValue(i));
                attributeNamespaces.put(key, atts.getURI(i));
            }
        }

        final Node newElement;

        if (namespaceURI.length() == 0) {
            newElement = new Node(currentNode, qName, attributes, attributeNamespaces, namespaceURI);
        } else {
            newElement = new Node(currentNode, localName, attributes, attributeNamespaces, namespaceURI);
        }

        if (currentNode != null) {
            currentNode.addChild(newElement);
        }

        stack.push(currentNode);
        currentNode = newElement;
    }
1018395
function xmlParse(xml) {
  var regex_empty = /\/$/;

  var regex_tagname;
  var regex_attribute;
  if (xml.match(/^<\?xml/)) {
    // When an XML document begins with an XML declaration
    // VersionInfo must appear.
    if (xml.search(new RegExp(XML10_VERSION_INFO)) == 5) {
      regex_tagname = XML10_TAGNAME_REGEXP;
      regex_attribute = XML10_ATTRIBUTE_REGEXP;
    } else if (xml.search(new RegExp(XML11_VERSION_INFO)) == 5) {
      regex_tagname = XML11_TAGNAME_REGEXP;
      regex_attribute = XML11_ATTRIBUTE_REGEXP;
    } else {
      // VersionInfo is missing, or unknown version number.
      // TODO : Fallback to XML 1.0 or XML 1.1, or just return null?
      alert('VersionInfo is missing, or unknown version number.');
    }
  } else {
    // When an XML declaration is missing it's an XML 1.0 document.
    regex_tagname = XML10_TAGNAME_REGEXP;
    regex_attribute = XML10_ATTRIBUTE_REGEXP;
  }

  var xmldoc = new XDocument();
  var root = xmldoc;

  // For the record: in Safari, we would create native DOM nodes, but
  // in Opera that is not possible, because the DOM only allows HTML
  // element nodes to be created, so we have to do our own DOM nodes.

  // xmldoc = document.implementation.createDocument('','',null);
  // root = xmldoc; // .createDocumentFragment();
  // NOTE(mesch): using the DocumentFragment instead of the Document
  // crashes my Safari 1.2.4 (v125.12).
  var stack = [];

  var parent = root;
  stack.push(parent);

  // The token that delimits a section that contains markup as
  // content: CDATA or comments.
  var slurp = '';

  var x = stringSplit(xml, '<');
  for (var i = 1; i < x.length; ++i) {
    var xx = stringSplit(x[i], '>');
    var tag = xx[0];
    var text = xmlResolveEntities(xx[1] || '');

    if (slurp) {
      // In a "slurp" section (CDATA or comment): only check for the
      // end of the section, otherwise append the whole text.
      var end = x[i].indexOf(slurp);
      if (end != -1) {
        var data = x[i].substring(0, end);
        parent.nodeValue += '<' + data;
        stack.pop();
        parent = stack[stack.length-1];
        text = x[i].substring(end + slurp.length);
        slurp = '';
      } else {
        parent.nodeValue += '<' + x[i];
        text = null;
      }

    } else if (tag.indexOf('![CDATA[') == 0) {
      var start = '![CDATA['.length;
      var end = x[i].indexOf(']]>');
      if (end != -1) {
        var data = x[i].substring(start, end);
        var node = domCreateCDATASection(xmldoc, data);
        domAppendChild(parent, node);
      } else {
        var data = x[i].substring(start);
        text = null;
        var node = domCreateCDATASection(xmldoc, data);
        domAppendChild(parent, node);
        parent = node;
        stack.push(node);
        slurp = ']]>';
      }

    } else if (tag.indexOf('!--') == 0) {
      var start = '!--'.length;
      var end = x[i].indexOf('-->');
      if (end != -1) {
        var data = x[i].substring(start, end);
        var node = domCreateComment(xmldoc, data);
        domAppendChild(parent, node);
      } else {
        var data = x[i].substring(start);
        text = null;
        var node = domCreateComment(xmldoc, data);
        domAppendChild(parent, node);
        parent = node;
        stack.push(node);
        slurp = '-->';
      }

    } else if (tag.charAt(0) == '/') {
      stack.pop();
      parent = stack[stack.length-1];

    } else if (tag.charAt(0) == '?') {
      // Ignore XML declaration and processing instructions
    } else if (tag.charAt(0) == '!') {
      // Ignore notation and comments
    } else {
      var empty = tag.match(regex_empty);
      var tagname = regex_tagname.exec(tag)[1];
      var node = domCreateElement(xmldoc, tagname);

      var att;
      while (att = regex_attribute.exec(tag)) {
        var val = xmlResolveEntities(att[5] || att[7] || '');
        domSetAttribute(node, att[1], val);
      }

      domAppendChild(parent, node);
      if (!empty) {
        parent = node;
        stack.push(node);
      }
    }

    if (text && parent != root) {
      domAppendChild(parent, domCreateTextNode(xmldoc, text));
    }
  }

  return root;
}
1136997
protected boolean shouldSkipChildren (Element jspElement) throws JspCoreException {
         if (!shouldSkipChildrenForThisVisitor()) {
              return false;
         }
         
         String uri = jspElement.getNamespaceURI();
         String name = jspElement.getLocalName();
         NodeList children;
         
         // First, see if this is a <jsp:body> tag.
         
         if (uri.equalsIgnoreCase (Constants.JSP_NAMESPACE) && name.equalsIgnoreCase (Constants.JSP_BODY_TYPE)) {
              // It is, so we need to skip processing children if the parent tag is
              // tagdependent.
              
              return isNodeTagDependent (jspElement.getParentNode());
         }
         
         // Otherwise, this is a custom tag.  We have three cases:
         
         if (!isElementTagDependent (jspElement)) {
              // Case 1: not a tagdependent tag, so return.
              
              return false;
         }
         
         // Now, we know this is a tagdependent tag.  Look at the children.
         
         children = jspElement.getChildNodes();
         
         if (children.getLength() == 0) {
              // Case 2: there are no children, so there's no harm in allowing processing to continue.
              
              return false;
         }
         
         for (int i = 0; i < children.getLength(); ++i) {
              Node node = children.item (i);
              
              if (node.getNodeType() == Node.ELEMENT_NODE) {
                   Element element = (Element) node;
                   String elemURI = element.getNamespaceURI();
                   
                   if (elemURI.equalsIgnoreCase (Constants.JSP_NAMESPACE)) {
                        String elemName = element.getLocalName();
                        
                        if (elemName.equalsIgnoreCase (Constants.JSP_ATTRIBUTE_TYPE) ||
                             elemName.equalsIgnoreCase (Constants.JSP_BODY_TYPE)) {
                             // Case 3: the first child is <jsp:attribute> or <jsp:body>, so we
                             // have to process children.
                             
                             return false;
                        }
                        
                        else {
                             // Default case: the first child is not <jsp:attribute> or <jsp:body>,
                             // so we have an implicit body defined.  Skip processing.
                             
                             return true;
                        }
                   }
              }
         }
         
         // Not likely we'd make it here...
              
         return false;
    }
51260
function parseAd(adElement) {
  var childNodes = adElement.childNodes;

  for (var adTypeElementKey in childNodes) {
    var adTypeElement = childNodes[adTypeElementKey];

    if (['Wrapper', 'InLine'].indexOf(adTypeElement.nodeName) === -1) {
      continue;
    }

    parserUtils.copyNodeAttribute('id', adElement, adTypeElement);
    parserUtils.copyNodeAttribute('sequence', adElement, adTypeElement);

    if (adTypeElement.nodeName === 'Wrapper') {
      return parseWrapper(adTypeElement);
    } else if (adTypeElement.nodeName === 'InLine') {
      return parseInLine(adTypeElement);
    }
  }
}
791667
@Override
    public void startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException {

        if (skipElementUntil != null) {
            elementStack.push(skippableElement);
            return;
        }

        boolean mixedContent = detectMixedContent();

        if (builder.xsiTypeSupport && attributes.getValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
            String type = attributes.getValue("http://www.w3.org/2001/XMLSchema-instance", "type");

            if (type.contains(":")) {
                String[] split = type.split(":");
                namespace = prefixUriMap.get(split[0]);
                localName = split[1];
            } else {
                localName = type;
            }
        }

        Element<ResourceType, Datatype> element = new Element<>(this, builder);
        element.index = index++;

        namespace = calculateNamespace(namespace);

        element.setType(namespace + localName);

        if (builder.skipElementMap != null && builder.skipElementMap.containsKey(element.getType())) {
            skipElementUntil = element;
            elementStack.push(element);
            return;
        }


        Element<ResourceType, Datatype> parent = null;

        if (!elementStack.isEmpty()) {
            parent = elementStack.peek();
            if (builder.addIndex) {
                element.elementIndex = parent.indexMap.plusPlus(element.getType());
            }
            parent.hasChild.add(element);
            if(builder.useHashmapForChildren){
                parent.hasChildMap.put(element.getType(), element);
            }
            if (mixedContent) {
                parent.addMixedContent(element);
            }

        }

        element.parent = parent;

        renameElement(namespace, localName, element);

        if (builder.forcedMixedContentMap != null &&
            builder.forcedMixedContentMap.containsKey(element.getType())) {

            element.containsMixedContent = true;
        }


        if (builder.compositeIdMap != null) {

            CompositeId compositeId = builder.compositeIdMap.get(element.getType());
            if (compositeId == null) {
                calculateNodeId(element);
            } else {
                element.compositeId = compositeId.simpleClone();
                if(element.compositeId.elementIndex){
                    element.compositeId.reolveElementIndex(XmlToRdfVocabulary.index, element.index);
                    element.compositeId.reolveElementIndex(XmlToRdfVocabulary.elementIndex, element.elementIndex);
                }

            }

        } else {
            calculateNodeId(element);
        }

        handleAttributes(namespace, attributes, element);

        if (builder.useElementAsPredicateMap != null && builder.useElementAsPredicateMap.containsKey(element.getType())) {
            element.useElementAsPredicate = true;
        }

        builder.doComplexTransformElementAtStartOfElement(element);


        elementStack.push(element);

    }
544773
function parseInLine(inLineElement) {
  var childNodes = inLineElement.childNodes;
  var ad = new Ad();
  ad.id = inLineElement.getAttribute('id') || null;
  ad.sequence = inLineElement.getAttribute('sequence') || null;

  for (var nodeKey in childNodes) {
    var node = childNodes[nodeKey];

    switch (node.nodeName) {
      case 'Error':
        ad.errorURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Impression':
        ad.impressionURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Creatives':
        parserUtils.childrenByName(node, 'Creative').forEach(function (creativeElement) {
          var creativeAttributes = {
            id: creativeElement.getAttribute('id') || null,
            adId: parseCreativeAdIdAttribute(creativeElement),
            sequence: creativeElement.getAttribute('sequence') || null,
            apiFramework: creativeElement.getAttribute('apiFramework') || null
          };

          for (var creativeTypeElementKey in creativeElement.childNodes) {
            var creativeTypeElement = creativeElement.childNodes[creativeTypeElementKey];
            var parsedCreative = void 0;

            switch (creativeTypeElement.nodeName) {
              case 'Linear':
                parsedCreative = parseCreativeLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'NonLinearAds':
                parsedCreative = parseCreativeNonLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'CompanionAds':
                parsedCreative = parseCreativeCompanion(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
            }
          }
        });
        break;

      case 'Extensions':
        parseExtensions(ad.extensions, parserUtils.childrenByName(node, 'Extension'));
        break;

      case 'AdSystem':
        ad.system = {
          value: parserUtils.parseNodeText(node),
          version: node.getAttribute('version') || null
        };
        break;

      case 'AdTitle':
        ad.title = parserUtils.parseNodeText(node);
        break;

      case 'Description':
        ad.description = parserUtils.parseNodeText(node);
        break;

      case 'Advertiser':
        ad.advertiser = parserUtils.parseNodeText(node);
        break;

      case 'Pricing':
        ad.pricing = {
          value: parserUtils.parseNodeText(node),
          model: node.getAttribute('model') || null,
          currency: node.getAttribute('currency') || null
        };
        break;

      case 'Survey':
        ad.survey = parserUtils.parseNodeText(node);
        break;
    }
  }

  return ad;
}
1326513
function parse(elementOrHtml, config) {
    wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get();

    var context       = config.context || elementOrHtml.ownerDocument || document,
        fragment      = context.createDocumentFragment(),
        isString      = typeof(elementOrHtml) === "string",
        clearInternals = false,
        element,
        newNode,
        firstChild;

    if (config.clearInternals === true) {
      clearInternals = true;
    }

    if (isString) {
      element = wysihtml5.dom.getAsDom(elementOrHtml, context);
    } else {
      element = elementOrHtml;
    }

    if (currentRules.selectors) {
      _applySelectorRules(element, currentRules.selectors);
    }

    while (element.firstChild) {
      firstChild = element.firstChild;
      newNode = _convert(firstChild, config.cleanUp, clearInternals, config.uneditableClass);
      if (newNode) {
        fragment.appendChild(newNode);
      }
      if (firstChild !== newNode) {
        element.removeChild(firstChild);
      }
    }

    if (config.unjoinNbsps) {
      // replace joined non-breakable spaces with unjoined
      var txtnodes = wysihtml5.dom.getTextNodes(fragment);
      for (var n = txtnodes.length; n--;) {
        txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 ");
      }
    }

    // Clear element contents
    element.innerHTML = "";

    // Insert new DOM tree
    element.appendChild(fragment);

    return isString ? wysihtml5.quirks.getCorrectInnerHTML(element) : element;
  }
130536
public static void ensureChildElement(DomXmlElement parentElement, DomXmlElement childElement) {
    Node parent = childElement.unwrap().getParentNode();
    if (parent == null || !parentElement.unwrap().isEqualNode(parent)) {
      throw LOG.elementIsNotChildOfThisElement(childElement, parentElement);
    }
  }
1211913
function parseComponentBlockParams(element, program) {
      var l = element.attributes.length;
      var attrNames = [];

      for (var i = 0; i < l; i++) {
        attrNames.push(element.attributes[i].name);
      }

      var asIndex = attrNames.indexOf('as');

      if (asIndex !== -1 && l > asIndex && attrNames[asIndex + 1].charAt(0) === '|') {
        // Some basic validation, since we're doing the parsing ourselves
        var paramsString = attrNames.slice(asIndex).join(' ');
        if (paramsString.charAt(paramsString.length - 1) !== '|' || paramsString.match(/\|/g).length !== 2) {
          throw new Error('Invalid block parameters syntax: \'' + paramsString + '\'');
        }

        var params = [];
        for (i = asIndex + 1; i < l; i++) {
          var param = attrNames[i].replace(/\|/g, '');
          if (param !== '') {
            if (ID_INVERSE_PATTERN.test(param)) {
              throw new Error('Invalid identifier for block parameters: \'' + param + '\' in \'' + paramsString + '\'');
            }
            params.push(param);
          }
        }

        if (params.length === 0) {
          throw new Error('Cannot use zero block parameters: \'' + paramsString + '\'');
        }

        element.attributes = element.attributes.slice(0, asIndex);
        program.blockParams = params;
      }
    }
663635
@Override
  protected ImmutableList<String> parseElements(String xml) {
    Optional<XmlElement> child = XmlConverter.getChildOpt(xml, "query", "backlinks");
    ImmutableList.Builder<String> titleCollection = ImmutableList.builder();
    if (child.isPresent()) {
      List<XmlElement> backlinks = child.get().getChildren("bl");
      for (XmlElement backlink : backlinks) {
        titleCollection.add(backlink.getAttributeValue("title"));
      }
    }
    return titleCollection.build();
  }
1167794
function isElementAllowed(element) {
  const allowed = ALLOWED_ELEMENTS[element.namespaceURI];
  if (!allowed) {
    return false;
  }

  return allowed.indexOf(element.tagName.toLowerCase()) !== -1;
}
1306026
function(xmlElement) {
    // Note: Until January 2013 this block did not have mutations,
    // so 'statement' defaults to false and 'at' defaults to true.
    var isStatement = (xmlElement.getAttribute('statement') == 'true');
    this.updateStatement_(isStatement);
    var isAt = (xmlElement.getAttribute('at') != 'false');
    this.updateAt_(isAt);
  }
23846
function parseStringSync (xml) {
  var doc = new DOMParser().parseFromString(xml);
  var plist;
  if (doc.documentElement.nodeName !== 'plist') {
    throw new Error('malformed document. First element should be <plist>');
  }
  plist = parsePlistXML(doc.documentElement);

  // if the plist is an array with 1 element, pull it out of the array
  if (plist.length == 1) {
    plist = plist[0];
  }
  return plist;
}
624846
function _isLineBreakOrBlockElement(element) {
      if (_isLineBreak(element)) {
        return true;
      }

      if (wysihtml5.dom.getStyle("display").from(element) === "block") {
        return true;
      }

      return false;
    }
768419
function (data) {
            // already a xml
            if (data.documentElement) {
                return data;
            }
            var xml;
            try {
                // Standard
                if (win.DOMParser) {
                    xml = new DOMParser().parseFromString(data, 'text/xml');
                } else {
                    // IE
                    /*global ActiveXObject*/
                    xml = new ActiveXObject('Microsoft.XMLDOM');
                    xml.async = false;
                    xml.loadXML(data);
                }
            } catch (e) {
                logger.error('parseXML error :');
                logger.error(e);
                xml = undef;
            }
            if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) {
                util.error('Invalid XML: ' + data);
            }
            return xml;
        }
938955
@SuppressWarnings("unchecked")
    private <T> T parseElement(Element element, Class<T> cls) {
        T value;
        if (element == null) {
            value = null;
        } else if (MwsObject.class.isAssignableFrom(cls)) {
            value = MwsUtl.newInstance(cls);
            Element holdElement = currentElement;
            Node holdChild = currentChild;
            setCurrentElement(element);
            ((MwsObject) value).readFragmentFrom(this);
            currentElement = holdElement;
            currentChild = holdChild;
        } else if (cls == Object.class) {
            value = (T)element;
        } else {
            String v = getElementText(element);
            value = parseString(v, cls);
        }
        return value;
    }