Add warnings for W3C HTML or CSS errors in xml format.
    w3type is either "W3C HTML" or "W3C CSS".
489744
def check_w3_errors (url_data, xml, w3type):
    """"""
    dom = parseString(xml)
    for error in dom.getElementsByTagName('m:error'):
        warnmsg = _("%(w3type)s validation error at line %(line)s col %(column)s: %(msg)s")
        attrs = {
            "w3type": w3type,
            "line": getXmlText(error, "m:line"),
            "column": getXmlText(error, "m:col"),
            "msg": getXmlText(error, "m:message"),
        }
        url_data.add_warning(warnmsg % attrs)
899338
private void addAppLevelCSSExample() {
		String htmlClass = "my_local_class";
		add(new WHeading(HeadingLevel.H2, "App defined widths"));
		add(new ExplanatoryText("This example shows the use of a htmlClass and app-specific CSS (in this case inline)"
				+ " to style the columns including responsive widths"
				+ " which kick in at 1000px and 900px"));

		WRow row = new WRow();
		row.setHtmlClass(htmlClass);
		add(row);

		WColumn col1 = new WColumn();
		String col1HtmlClass = "my_col1";
		col1.setHtmlClass(col1HtmlClass);
		col1.add(new ExplanatoryText("This is some text content in the first column."));
		row.add(col1);

		WColumn col2 = new WColumn();
		String col2HtmlClass = "my_col2";
		col2.setHtmlClass(col2HtmlClass);
		col2.add(new ExplanatoryText("Some content in column 2."));
		row.add(col2);

		WColumn col3 = new WColumn();
		col3.add(new ExplanatoryText("Some content in column 3."));
		row.add(col3);

		String columnClass = ".wc-column";
		String rowSelector = "." + htmlClass;
		String columnSelector =  rowSelector + " > " + columnClass; // .column is the local name of WColumn's XML element and is part of the client side API.
		String css = columnSelector + " {width: 20%; background-color: #f0f0f0; padding: 0.5em;}"
				+ columnSelector + " + " + columnClass + " {margin-left: 0.5em}"
 				+ columnSelector + "." + col2.getHtmlClass() + " {width: 60%;}"
				+ "@media only screen and (max-width: 1000px) {"  //when the screen goes below 1000px wide
				+ rowSelector + " {display: block;}"
				+ columnSelector + " {display: inline-block; box-sizing: border-box;}"
				+ columnSelector + " + " + columnClass + " {margin-left: 0}"
				+ columnSelector + "." + col1.getHtmlClass() + " {display: block; width: 100%; margin-bottom: 0.5em;} "
				+ columnSelector + " ~ " + columnClass + " {width: calc(50% - 0.25em); background-color: #f0f000}"
				+ "." + col2.getHtmlClass() + " {margin-right: 0.25em}"
				+ "." + col2.getHtmlClass() + " + " + columnClass + " {margin-left: 0.25em;}"
				+ "}\n@media only screen and (max-width: 900px) {"  //when the screen goes below 900px wide;
				+ columnSelector + " {width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; background-color: #ff0 !important;}" //the importants are becauseI am lazy
				+ "." + col2.getHtmlClass() + " {margin-bottom: 0.5em;}\n}";

		WText cssText = new WText("<style type='text/css'>" + css + "</style>");
		cssText.setEncodeText(false);
		add(cssText);
	}
1072273
private void checkFileType() {

        if ((m_fileInput != null) && (m_replaceInfo != null) && (m_fileWidget != null)) {
            CmsFileInfo file = m_fileInput.getFiles()[0];
            if (!m_replaceInfo.getSitepath().endsWith(file.getFileSuffix())) {
                Widget warningImage = FontOpenCms.WARNING.getWidget(
                    20,
                    I_CmsConstantsBundle.INSTANCE.css().colorWarning());
                warningImage.setTitle(Messages.get().key(Messages.GUI_REPLACE_WRONG_FILE_EXTENSION_0));
                warningImage.addStyleName(
                    org.opencms.gwt.client.ui.css.I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().permaVisible());
                m_fileWidget.addButton(warningImage);
            }
        }
    }
39116
public static function browserSupportsDHTMLType()
    {
        if ( self::$browserType === null )
        {
            self::$browserType = false;
            $userAgent = eZSys::serverVariable( 'HTTP_USER_AGENT' );
            // Opera 9.6+
            if ( strpos( $userAgent, 'Presto' ) !== false &&
                 preg_match('/Presto\/([0-9\.]+)/i', $userAgent, $browserInfo ) )
            {
                if ( $browserInfo[1] >= 2.1 )
                    self::$browserType = 'Presto';
            }
            // IE 8.0+
            else if ( strpos( $userAgent, 'Trident' ) !== false &&
                      preg_match('/Trident\/([0-9\.]+)/i', $userAgent, $browserInfo ) )
            {
                if ( $browserInfo[1] >= 4.0 )
                    self::$browserType = 'Trident';
            }
            // IE 6 & 7
            else if ( strpos( $userAgent, 'MSIE' ) !== false &&
                      preg_match('/MSIE[ \/]([0-9\.]+)/i', $userAgent, $browserInfo ) )
            {
                if ( $browserInfo[1] >= 6.0 )
                    self::$browserType = 'Trident';
            }
            // Firefox 3+
            else if ( strpos( $userAgent, 'Gecko' ) !== false &&
                      preg_match('/rv:([0-9\.]+)/i', $userAgent, $browserInfo ) )
            {
                if ( $browserInfo[1] >= 1.9 )
                    self::$browserType = 'Gecko';
            }
            // Safari 4+ (and Chrome)
            else if ( strpos( $userAgent, 'WebKit' ) !== false &&
                      strpos( $userAgent, 'Mobile' ) === false &&
                      strpos( $userAgent, 'Android' ) === false &&
                      strpos( $userAgent, 'iPad' ) === false &&
                      strpos( $userAgent, 'iPhone' ) === false &&
                      strpos( $userAgent, 'iPod' ) === false &&
                      preg_match('/WebKit\/([0-9\.]+)/i', $userAgent, $browserInfo ) )
            {
                if ( $browserInfo[1] >= 528.16 )
                    self::$browserType = 'WebKit';
            }
            // iOS 5+
            else if ( strpos( $userAgent, 'AppleWebKit' ) !== false &&
                      strpos( $userAgent, 'Mobile' ) !== false &&
                      preg_match('/AppleWebKit\/([0-9\.]+)/i', $userAgent, $browserInfo ) )
            {
                if ( $browserInfo[1] >= 534.46 )
                    self::$browserType = 'MobileWebKit';
            }
            if ( self::$browserType === false )
                eZDebug::writeNotice( 'Browser not supported: ' . $userAgent, __METHOD__ );
        }
        return self::$browserType;
    }
907232
public final void setType(final NotifyType type) {
        setType((type != null) ? type.getCssName() : NotifyType.INFO.getCssName());
    }
1043753
public void addType(I_CmsXmlSchemaType type) throws CmsXmlException {

        // check if the type to add actually exists in the type manager
        CmsXmlContentTypeManager typeManager = OpenCms.getXmlContentTypeManager();
        if (type.isSimpleType() && (typeManager.getContentType(type.getTypeName()) == null)) {
            throw new CmsXmlException(Messages.get().container(Messages.ERR_UNREGISTERED_TYPE_1, type.getTypeName()));
        }

        // add the type to the internal type sequence and lookup table
        m_typeSequence.add(type);
        m_types.put(type.getName(), type);

        // store reference to the content definition in the type
        type.setContentDefinition(this);
    }
136178
protected void isCommentWellFormed(String data) {
        if (data == null || (data.length() == 0)) {
            return;
        }

        char[] dataarray = data.toCharArray();
        int datalength = dataarray.length;

        // version of the document is XML 1.1
        if (fIsXMLVersion11) {
            // we need to check all chracters as per production rules of XML11
            int i = 0;
            while (i < datalength) {
                char c = dataarray[i++];
                if (XML11Char.isXML11Invalid(c)) {
                    // check if this is a supplemental character
                    if (XMLChar.isHighSurrogate(c) && i < datalength) {
                        char c2 = dataarray[i++];
                        if (XMLChar.isLowSurrogate(c2)
                            && XMLChar.isSupplemental(
                                XMLChar.supplemental(c, c2))) {
                            continue;
                        }
                    }
                    String msg =
                        Utils.messages.createMessage(
                            MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT,
                            new Object[] { new Character(c)});

                    if (fErrorHandler != null) {
                        fErrorHandler.handleError(
                            new DOMErrorImpl(
                                DOMError.SEVERITY_FATAL_ERROR,
                                msg,
                                MsgKey.ER_WF_INVALID_CHARACTER,
                                null,
                                null,
                                null));
                    }
                } else if (c == '-' && i < datalength && dataarray[i] == '-') {
                    String msg =
                        Utils.messages.createMessage(
                            MsgKey.ER_WF_DASH_IN_COMMENT,
                            null);

                    if (fErrorHandler != null) {
                        fErrorHandler.handleError(
                            new DOMErrorImpl(
                                DOMError.SEVERITY_FATAL_ERROR,
                                msg,
                                MsgKey.ER_WF_INVALID_CHARACTER,
                                null,
                                null,
                                null));
                    }
                }
            }
        } // version of the document is XML 1.0
        else {
            // we need to check all chracters as per production rules of XML 1.0
            int i = 0;
            while (i < datalength) {
                char c = dataarray[i++];
                if (XMLChar.isInvalid(c)) {
                    // check if this is a supplemental character
                    if (XMLChar.isHighSurrogate(c) && i < datalength) {
                        char c2 = dataarray[i++];
                        if (XMLChar.isLowSurrogate(c2)
                            && XMLChar.isSupplemental(
                                XMLChar.supplemental(c, c2))) {
                            continue;
                        }
                    }
                    String msg =
                        Utils.messages.createMessage(
                            MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT,
                            new Object[] { new Character(c)});

                    if (fErrorHandler != null) {
                        fErrorHandler.handleError(
                            new DOMErrorImpl(
                                DOMError.SEVERITY_FATAL_ERROR,
                                msg,
                                MsgKey.ER_WF_INVALID_CHARACTER,
                                null,
                                null,
                                null));
                    }
                } else if (c == '-' && i < datalength && dataarray[i] == '-') {
                    String msg =
                        Utils.messages.createMessage(
                            MsgKey.ER_WF_DASH_IN_COMMENT,
                            null);

                    if (fErrorHandler != null) {
                        fErrorHandler.handleError(
                            new DOMErrorImpl(
                                DOMError.SEVERITY_FATAL_ERROR,
                                msg,
                                MsgKey.ER_WF_INVALID_CHARACTER,
                                null,
                                null,
                                null));
                    }
                }
            }
        }
        return;
    }
1174591
def warning(request, message, extra_tags='', fail_silently=False):
    """"""
    add_message(request, constants.WARNING, message, extra_tags=extra_tags,
                fail_silently=fail_silently)
947096
public void addTypeType(String version, TypesType typesType, MessageProcessInfo recMessageProcessInfo)
    {
        if (schemaFactory == null)
            schemaFactory = new org.w3._2001.xmlschema.ObjectFactory();
        // Create the types (import the OTA specs)
        MessageInfo recMessageInfo = this.getMessageIn(recMessageProcessInfo);
        if (recMessageInfo != null)
        {
            String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
            if (this.isNewType(name))
            {
                this.addSchema(version, typesType, recMessageInfo);
            }
        }
        recMessageInfo = this.getMessageOut(recMessageProcessInfo);
        if (recMessageInfo != null)
        {
            String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
            if (this.isNewType(name))
            {
                this.addSchema(version, typesType, recMessageInfo);
            }
        }
    }
116176
@Nonnull
  private EHTMLElementType _checkHTML ()
  {
    final ICommonsList <String> aTags = new CommonsLinkedList<> ();
    final StringBuilder aSB = new StringBuilder ();
    int nPos = m_nLeading;
    if (m_sValue.charAt (m_nLeading + 1) == '!')
    {
      if (_readXMLComment (this, m_nLeading) > 0)
        return EHTMLElementType.COMMENT;
    }
    nPos = MarkdownHelper.readXMLElement (aSB, m_sValue, m_nLeading, false);
    if (nPos > -1)
    {
      String sElement = aSB.toString ();
      String sTag = MarkdownHelper.getXMLTag (sElement);
      if (!MarkdownHTML.isHtmlBlockElement (sTag))
        return EHTMLElementType.NONE;
      if (EHTMLElement.getFromTagNameOrNull (sTag).mayBeSelfClosed ())
      {
        m_aXmlEndLine = this;
        return EHTMLElementType.TAG;
      }
      aTags.add (sTag);
      Line aLine = this;
      while (aLine != null)
      {
        while (nPos < aLine.m_sValue.length () && aLine.m_sValue.charAt (nPos) != '<')
          nPos++;

        if (nPos >= aLine.m_sValue.length ())
        {
          aLine = aLine.m_aNext;
          nPos = 0;
        }
        else
        {
          aSB.setLength (0);
          final int nNewPos = MarkdownHelper.readXMLElement (aSB, aLine.m_sValue, nPos, false);
          if (nNewPos > 0)
          {
            sElement = aSB.toString ();
            sTag = MarkdownHelper.getXMLTag (sElement);
            if (MarkdownHTML.isHtmlBlockElement (sTag) && !EHTMLElement.getFromTagNameOrNull (sTag).mayBeSelfClosed ())
            {
              if (sElement.charAt (1) == '/')
              {
                if (!aTags.getLast ().equals (sTag))
                  return EHTMLElementType.NONE;
                aTags.removeLast ();
              }
              else
              {
                aTags.add (sTag);
              }
            }
            if (aTags.isEmpty ())
            {
              m_aXmlEndLine = aLine;
              break;
            }
            nPos = nNewPos;
          }
          else
          {
            nPos++;
          }
        }
      }
      if (aTags.isEmpty ())
        return EHTMLElementType.TAG;
    }
    return EHTMLElementType.NONE;
  }
466986
function addType(typeName, type) {
	if (types[typeName]) {
		throw new Error("Type already registered '" + typeName + "'");
	}
	types[typeName] = type;
}
1342865
def add_request_type_view(request):
    '''  '''
    form = RequestTypeForm(request.POST or None)
    if form.is_valid():
        rtype = form.save()
        messages.add_message(request, messages.SUCCESS,
                             MESSAGES['REQUEST_TYPE_ADDED'].format(typeName=rtype.name))
        return HttpResponseRedirect(reverse('managers:manage_request_types'))
    return render_to_response('edit_request_type.html', {
        'page_name': "Admin - Add Request Type",
        'request_types': RequestType.objects.all(),
        'form': form,
        }, context_instance=RequestContext(request))
594863
protected void isElementWellFormed(Node node) {
        boolean isNameWF = false;
        if ((fFeatures & NAMESPACES) != 0) {
            isNameWF =
                isValidQName(
                    node.getPrefix(),
                    node.getLocalName(),
                    fIsXMLVersion11);
        } else {
            isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11);
        }

        if (!isNameWF) {
            String msg =
                Utils.messages.createMessage(
                    MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                    new Object[] { "Element", node.getNodeName()});

            if (fErrorHandler != null) {
                fErrorHandler.handleError(
                    new DOMErrorImpl(
                        DOMError.SEVERITY_FATAL_ERROR,
                        msg,
                        MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                        null,
                        null,
                        null));
            }
        }
    }
169146
function maybe_type() {
  skip_horiz_white();
  if (look(/\{/)) {
    var tdf = typedef();
    current_tag["type"] = tdf["type"];
    current_tag["optional"] = tdf["optional"] ? true : false;
  }
}
311897
def set_html5_doctype(self):
        
        doctype = b'<!DOCTYPE html>\n'
        content = doctype_re.subn(doctype, self.response.content, 1)[0]
        self.response.content = content
679491
def _add_type_node(self, node, label):
        """"""
        child = node.add_child(name=label)
        child.add_feature(TYPE_NODE_TAG, True)
        return child
564872
def check_html_warnings(html, parser=None):
    
    if parser is None:
        parser = bs4.BeautifulSoup(html, 'html.parser')

    # Check warnings
    warnings = parser.find_all('div', {'class': 'service_msg_warning'})
    if warnings:
        raise VkPageWarningsError('; '.join([w.get_text() for w in warnings]))
    return True