Validate a full subtree when
          xmlRelaxNGValidatePushElement() returned 0 and the content
           of the node has been expanded.
483141
def relaxNGValidateFullElement(self, ctxt, elem):
        
        if ctxt is None: ctxt__o = None
        else: ctxt__o = ctxt._o
        if elem is None: elem__o = None
        else: elem__o = elem._o
        ret = libxml2mod.xmlRelaxNGValidateFullElement(ctxt__o, self._o, elem__o)
        return ret
503915
public int resolveAndValidateElement()
        throws XMLStreamException
    {
        if (mDepth == 0) { // just a simple sanity check
            throw new IllegalStateException("Calling validate() on empty stack.");
        }
        AttributeCollector ac = mAttrCollector;

        // Any namespace declarations?
        {
            int nsCount = ac.getNsCount();
            if (nsCount > 0) {
                /* let's first invalidate old (possibly) shared ns ctxt too,
                 * if we had one; new one can be created at a later point
                 */
                mLastNsContext = null;

                boolean internNsUris = mConfig.willInternNsURIs();
                for (int i = 0; i < nsCount; ++i) {
                    Attribute ns = ac.resolveNamespaceDecl(i, internNsUris);
                    String nsUri = ns.mNamespaceURI;
                    // note: for namespaces, prefix is stored as local name
                    String prefix = ns.mLocalName;

                    /* 18-Jul-2004, TSa: Need to check that 'xml' and 'xmlns'
                     *   prefixes are not re-defined (and 'xmlns' not even
                     *   defined to its correct ns).
                     */
                    if (prefix == "xmlns") {
                        // xmlns can never be declared, even to its correct URI
                        mReporter.throwParseError(ErrorConsts.ERR_NS_REDECL_XMLNS);
                    } else if (prefix == "xml") {
                        // whereas xml is ok, as long as it's same URI:
                        if (!nsUri.equals(XMLConstants.XML_NS_URI)) {
                            mReporter.throwParseError(ErrorConsts.ERR_NS_REDECL_XML,
                                                      nsUri, null);
                        }
                        /* 09-Feb-2006, TSa: Hmmh. Now, should this explicit
                         *   xml declaration be visible to the app? SAX API
                         *   seem to ignore it.
                         */
                        //mNamespaces.addStrings(prefix, nsUri);
                    } else { // ok, valid prefix, so far
                        /* 17-Mar-2006, TSa: Unbinding default NS needs to
                         *    result in null being added:
                         */
                        if (nsUri == null || nsUri.length() == 0) {
                            nsUri = XmlConsts.DEFAULT_NAMESPACE_URI;
                        }
                        // The default ns binding needs special handling:
                        if (prefix == null) {
                            mCurrElement.mDefaultNsURI = nsUri;
                        }

                        /* But then let's ensure that URIs matching xml
                         * and xmlns are not being bound to anything else
                         */
                        if (internNsUris) { // identity comparison is ok:
                            if (nsUri == XMLConstants.XML_NS_URI) {
                                mReporter.throwParseError(ErrorConsts.ERR_NS_REDECL_XML_URI, prefix, null);
                            } else if (nsUri == XMLConstants.XMLNS_ATTRIBUTE_NS_URI) {
                                mReporter.throwParseError(ErrorConsts.ERR_NS_REDECL_XMLNS_URI);
                            }
                        } else { // need to check equals()
                            if (nsUri.equals(XMLConstants.XML_NS_URI)) {
                                mReporter.throwParseError(ErrorConsts.ERR_NS_REDECL_XML_URI, prefix, null);
                            } else if (nsUri.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
                                mReporter.throwParseError(ErrorConsts.ERR_NS_REDECL_XMLNS_URI);
                            }
                        }
                        /* and at any rate, binding needs to be added, to
                         * be visible to the app (including def ns):
                         */
                        mNamespaces.addStrings(prefix, nsUri);
                    }
                }
            }
        }

        /* 20-Feb-2006, TSa: Any attribute defaults for namespace declaration
         *   pseudo-attributes?
         */
        if (mMayHaveNsDefaults) {
            mNsDefaultProvider.checkNsDefaults(this);
        }

        // Then, let's set element's namespace, if any:
        String prefix = mCurrElement.mPrefix;
        String ns;

        if (prefix == null) { // use default NS, if any
            ns = mCurrElement.mDefaultNsURI;
        } else if (prefix == "xml") {
            ns = XMLConstants.XML_NS_URI;
        } else {
            // Need to find namespace with the prefix:
            ns = mNamespaces.findLastFromMap(prefix);
            /* 07-Sep-2007, TSa: "no namespace" should now be indicated
             *   by an empty string, however, due to historical reasons
             *   let's be bit defensive and allow nulls for the same too
             */
            if (ns == null || ns.length() == 0) {
                mReporter.throwParseError(ErrorConsts.ERR_NS_UNDECLARED, prefix, null);
            }
        }
        mCurrElement.mNamespaceURI = ns;

        // And finally, resolve attributes' namespaces too:
        int xmlidIx = ac.resolveNamespaces(mReporter, mNamespaces);
        mIdAttrIndex = xmlidIx;

        XMLValidator vld = mValidator;
        /* If we have no validator(s), nothing more to do,
         * except perhaps little bit of Xml:id handling:
         */
        if (vld == null) { // no validator in use
            if (xmlidIx >= 0) { // need to normalize xml:id, still?
                ac.normalizeSpacesInValue(xmlidIx);
            }
            return XMLValidator.CONTENT_ALLOW_ANY_TEXT;
        }

        // Otherwise need to call relevant validation methods.

        /* First, a call to check if the element itself may be acceptable
         * within structure:
         */
        vld.validateElementStart
            (mCurrElement.mLocalName, mCurrElement.mNamespaceURI, mCurrElement.mPrefix);

        // Then attributes, if any:
        int attrLen = ac.getCount();
        if (attrLen > 0) {
            for (int i = 0; i < attrLen; ++i) {
                ac.validateAttribute(i, mValidator);
            }
        }

        /* And finally let's wrap things up to see what textual content
         * is allowed as child content, if any:
         */
        return mValidator.validateElementAndAttributes();
    }
956600
public void checkValidatorCalled() {
        if (!execute.isSuppressValidatorCallCheck() && certainlyNotBeValidatorCalled()) {
            execute.getFormMeta().filter(meta -> isValidatorAnnotated(meta)).ifPresent(meta -> {
                throwLonelyValidatorAnnotationException(meta); // #hope see fields in nested element
            });
        }
    }
174443
public void validate(ElemTemplateElement elem, StylesheetHandler handler)
    throws SAXException
  {
    String msg = "";
    while (elem != null)
    { 
      //System.out.println("elem " + elem);
      if (elem instanceof ElemExsltFuncResult 
          && elem.getNextSiblingElem() != null 
          && !(elem.getNextSiblingElem() instanceof ElemFallback))
      {
        msg = "func:result has an illegal following sibling (only xsl:fallback allowed)";
        handler.error(msg, new SAXException(msg));
      }
      
      if((elem instanceof ElemApplyImport
	 || elem instanceof ElemApplyTemplates
	 || elem instanceof ElemAttribute
	 || elem instanceof ElemCallTemplate
	 || elem instanceof ElemComment
	 || elem instanceof ElemCopy
	 || elem instanceof ElemCopyOf
	 || elem instanceof ElemElement
	 || elem instanceof ElemLiteralResult
	 || elem instanceof ElemNumber
	 || elem instanceof ElemPI
	 || elem instanceof ElemText
	 || elem instanceof ElemTextLiteral
	 || elem instanceof ElemValueOf)
	&& !(ancestorIsOk(elem)))
      {
        msg ="misplaced literal result in a func:function container.";
        handler.error(msg, new SAXException(msg));
      }
      ElemTemplateElement nextElem = elem.getFirstChildElem();
      while (nextElem == null)
      {
        nextElem = elem.getNextSiblingElem();
        if (nextElem == null)
          elem = elem.getParentElem();
        if (elem == null || elem instanceof ElemExsltFunction)
          return; // ok
      }  
      elem = nextElem;
    }
  }
1371888
@Override
    public void validateElementStart(String localName, String uri, String prefix)
        throws XMLStreamException
    {
        // Ok, can we find the element definition?
        mTmpKey.reset(prefix, localName);
        DTDElement elem = mElemSpecs.get(mTmpKey);
        // whether it's found or not, let's add a stack frame:
        int elemCount = mElemCount++;
        if (elemCount >= mElems.length) {
            mElems = (DTDElement[]) DataUtil.growArrayBy50Pct(mElems);
        }

        mElems[elemCount] = mCurrElem = elem;
        mAttrCount = 0;
        mIdAttrIndex = -2; // -2 as a "don't know yet" marker

        /* but if not found, can not obtain any type information. Not
         * a validation problem though, since we are doing none...
         * Oh, also, unlike with real validation, not having actual element
         * information is ok; can still have attributes!
         */
        if (elem == null) { // || !elem.isDefined())
            mCurrAttrDefs = NO_ATTRS;
            mHasAttrDefaults = false;
            mCurrDefaultAttrs = null;
            mHasNormalizableAttrs = false;
            return;
        }

        // If element found, does it have any attributes?
        mCurrAttrDefs = elem.getAttributes();
        if (mCurrAttrDefs == null) {
            mCurrAttrDefs = NO_ATTRS;
            mHasAttrDefaults = false;
            mCurrDefaultAttrs = null;
            mHasNormalizableAttrs = false;
            return;
        }

        // Any normalization needed?
        mHasNormalizableAttrs = mNormAttrs || elem.attrsNeedValidation();

        // Any default values?
        mHasAttrDefaults = elem.hasAttrDefaultValues();
        if (mHasAttrDefaults) {
            /* Special count also contains ones with #REQUIRED value, but
             * that's a minor sub-optimality...
             */
            int specCount = elem.getSpecialCount();
            BitSet bs = mTmpDefaultAttrs;
            if (bs == null) {
                mTmpDefaultAttrs = bs = new BitSet(specCount);
            } else {
                bs.clear();
            }
            mCurrDefaultAttrs = bs;
        } else {
            mCurrDefaultAttrs = null;
        }
    }
1118061
public final void validate() {
    this.accept(new TreeVisitor() {
      @Override
      public boolean preVisit(TreeNode node) {
        node.validateInner();
        return true;
      }
    });
  }
1113344
private XpathMessageValidationContext getXPathMessageValidationContext(Element messageElement, XmlMessageValidationContext parentContext) {
        XpathMessageValidationContext context = new XpathMessageValidationContext();
        
        parseXPathValidationElements(messageElement, context);

        context.setControlNamespaces(parentContext.getControlNamespaces());
        context.setNamespaces(parentContext.getNamespaces());
        context.setIgnoreExpressions(parentContext.getIgnoreExpressions());
        context.setSchema(parentContext.getSchema());
        context.setSchemaRepository(parentContext.getSchemaRepository());
        context.setSchemaValidation(parentContext.isSchemaValidationEnabled());
        context.setDTDResource(parentContext.getDTDResource());

        return context;
    }
633198
private void validateVeLogNode(VeLogNode node) {
    if (node.getVeDataExpression().getRoot().getType().getKind() != Kind.VE_DATA) {
      reporter.report(
          node.getVeDataExpression().getSourceLocation(),
          INVALID_VE,
          node.getVeDataExpression().getRoot().getType());
    }
    if (node.getLogonlyExpression() != null) {
      // check to see if it is in a msg node.  logonly is disallowed in msg nodes because we don't
      // have an implementation strategy.
      if (isInMsgNode(node)) {
        reporter.report(node.getLogonlyExpression().getSourceLocation(), LOGONLY_DISALLOWED_IN_MSG);
      }
      SoyType type = node.getLogonlyExpression().getType();
      if (type.getKind() != Kind.BOOL) {
        reporter.report(
            node.getLogonlyExpression().getSourceLocation(),
            WRONG_TYPE,
            BoolType.getInstance(),
            type);
      }
    }
  }
603178
def relaxNGNewValidCtxt(self):
        
        ret = libxml2mod.xmlRelaxNGNewValidCtxt(self._o)
        if ret is None:raise treeError('xmlRelaxNGNewValidCtxt() failed')
        __tmp = relaxNgValidCtxt(_obj=ret)
        __tmp.schema = self
        return __tmp
783560
private void validateXmlHeaderFragment(String receivedHeaderData, String controlHeaderData,
            XmlMessageValidationContext validationContext, TestContext context) {
        log.debug("Start XML header data validation ...");

        Document received = XMLUtils.parseMessagePayload(receivedHeaderData);
        Document source = XMLUtils.parseMessagePayload(controlHeaderData);

        XMLUtils.stripWhitespaceNodes(received);
        XMLUtils.stripWhitespaceNodes(source);

        if (log.isDebugEnabled()) {
            log.debug("Received header data:\n" + XMLUtils.serialize(received));
            log.debug("Control header data:\n" + XMLUtils.serialize(source));
        }

        validateXmlTree(received, source, validationContext, 
                namespaceContextBuilder.buildContext(new DefaultMessage(receivedHeaderData), validationContext.getNamespaces()),
                context);
    }
929186
protected void validateFull(
        CmsUUID structureId,
        Map<String, String> sitePaths,
        final AsyncCallback<Map<String, String>> errorCallback) {

        validateAliases(structureId, sitePaths, errorCallback);
    }
912375
def relaxNGValidatePopElement(self, doc, elem):
        
        if doc is None: doc__o = None
        else: doc__o = doc._o
        if elem is None: elem__o = None
        else: elem__o = elem._o
        ret = libxml2mod.xmlRelaxNGValidatePopElement(self._o, doc__o, elem__o)
        return ret
480932
private void validateBeforeStart() {
        LibraryUtils.checkArgumentNotNull(config, "Configuration is null.");
        config.validate();

        LibraryUtils.checkArgumentNotNull(sourceFilter, "sourceFilter is null.");
        LibraryUtils.checkArgumentNotNull(eventFilter, "eventFilter is null.");
        LibraryUtils.checkArgumentNotNull(eventsProcessor, "eventsProcessor is null.");
        LibraryUtils.checkArgumentNotNull(progressReporter, "progressReporter is null.");
        LibraryUtils.checkArgumentNotNull(exceptionHandler, "exceptionHandler is null.");

        LibraryUtils.checkArgumentNotNull(scheduledThreadPool, "scheduledThreadPool is null.");
        LibraryUtils.checkArgumentNotNull(mainThreadPool, "mainThreadPool is null.");
        LibraryUtils.checkArgumentNotNull(readerFactory, "readerFactory is null.");
    }
668480
public void validateText(XMLValidator vld, boolean lastSegment)
        throws XMLStreamException
    {
        // Shared buffer? Let's just pass that
        if (mInputStart >= 0) {
            vld.validateText(mInputBuffer, mInputStart, mInputStart + mInputLen, lastSegment);
        } else {
            /* Otherwise, can either create a combine buffer, or construct
             * a String. While former could be more efficient, let's do latter
             * for now since current validator implementations work better
             * with Strings.
             */
            vld.validateText(contentsAsString(), lastSegment);
        }
    }
552536
protected void checkExpandedCustomNodes() {

		TreeItemIdNode custom = getCustomTree();
		if (custom == null) {
			return;
		}

		// Get the expanded rows
		Set<String> expanded = getExpandedRows();

		// Process Top Level
		for (TreeItemIdNode node : custom.getChildren()) {
			processCheckExpandedCustomNodes(node, expanded);
		}
	}
222724
private void validate() {
        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("namespace cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("set cannot be null");
        }
        if (portList.isEmpty()) {
            if(port>0){
                port(port);
            }else{
                throw new IllegalArgumentException("port cannot be null");
            }

        }
        if (host.size() != portList.size()) {
            throw new IllegalArgumentException("Host and ports cardinality must be the same");
        }

    }
526116
@Override
    protected void onValidation(final String contactNode, final String defaultPort)
    {
        if (contactNode != null)
        {
            // allow configuration as comma-separated list of host:port
            // addresses without the default port
            boolean allAddressesHaveHostAndPort = true;

            for (String node : contactNode.split(Constants.COMMA))
            {
                if (StringUtils.countMatches(node, Constants.COLON) == 1)
                {
                    // node is given with hostname and port
                    // count == 1 is to exclude IPv6 addresses
                    if (StringUtils.isNumeric(node.split(Constants.COLON)[1]))
                    {
                        continue;
                    }
                }

                allAddressesHaveHostAndPort = false;
                break;
            }

            if (allAddressesHaveHostAndPort)
            {
                return;
            }
        }

        // fall back to the generic validation which requires the default port
        // to be set
        super.onValidation(contactNode, defaultPort);
    }