Method called to resolve element and attribute namespaces (in
namespace-aware mode), and do optional validation using pluggable
validator object.

@return Text content validation state that should be effective
for the fully resolved element context
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();
    }
488898
private void doDocumentTypeDefinition(Node received, Node source,
            XmlMessageValidationContext validationContext,
            NamespaceContext namespaceContext, TestContext context) {

        Assert.isTrue(source instanceof DocumentType, "Missing document type definition in expected xml fragment");

        DocumentType receivedDTD = (DocumentType) received;
        DocumentType sourceDTD = (DocumentType) source;

        if (log.isDebugEnabled()) {
            log.debug("Validating document type definition: " +
                    receivedDTD.getPublicId() + " (" + receivedDTD.getSystemId() + ")");
        }

        if (!StringUtils.hasText(sourceDTD.getPublicId())) {
            Assert.isNull(receivedDTD.getPublicId(),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type public id not equal",
                    sourceDTD.getPublicId(), receivedDTD.getPublicId()));
        } else if (sourceDTD.getPublicId().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
            if (log.isDebugEnabled()) {
                log.debug("Document type public id: '" + receivedDTD.getPublicId() +
                        "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'");
            }
        } else {
            Assert.isTrue(StringUtils.hasText(receivedDTD.getPublicId()) &&
                    receivedDTD.getPublicId().equals(sourceDTD.getPublicId()),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type public id not equal",
                    sourceDTD.getPublicId(), receivedDTD.getPublicId()));
        }

        if (!StringUtils.hasText(sourceDTD.getSystemId())) {
            Assert.isNull(receivedDTD.getSystemId(),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type system id not equal",
                    sourceDTD.getSystemId(), receivedDTD.getSystemId()));
        } else if (sourceDTD.getSystemId().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
            if (log.isDebugEnabled()) {
                log.debug("Document type system id: '" + receivedDTD.getSystemId() +
                        "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'");
            }
        } else {
            Assert.isTrue(StringUtils.hasText(receivedDTD.getSystemId()) &&
                    receivedDTD.getSystemId().equals(sourceDTD.getSystemId()),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type system id not equal",
                    sourceDTD.getSystemId(), receivedDTD.getSystemId()));
        }

        validateXmlTree(received.getNextSibling(),
                source.getNextSibling(), validationContext, namespaceContext, context);
    }
438121
def validate(type, plugin, attributes, attribute_namespace = [])
      attributes.each do |attribute|
        if attribute.children?
          validate(type, plugin, attribute.children, attribute_namespace.clone.push(attribute.name))
        elsif attribute.required? && attribute.value.nil?
          registry.logger.fatal I18n.t(
            "lita.config.missing_required_#{type}_attribute",
            type => plugin.namespace,
            attribute: full_attribute_name(attribute_namespace, attribute.name)
          )
          abort
        end
      end
    end
1224418
private function validateAnnotations()
    {
        //Count annotations in the annotation namespace, ignore annotations not in our namespace
        $count = 0;
        foreach($this->annotations as $a)
        {
            //If you find the namespace in the class name, add to count
            if(strrpos(get_class($a), self::ANNOTATION_NAMESPACE) !== false)
            {
                $count++;
            }
        }

        switch($count)
        {
            //0 annotations, just ignore
            case 0:

                return;

            //1 Annotation, it can't be index.
            case 1:

                if($this->getAnnotationIndex(self::INDEX) < 0)
                {
                    //It's not index, return.
                    return;
                }

                throw new Exception("@Index cannot be the only annotation on {$this->name} in {$this->property->getDeclaringClass()->getName()}.");

            //2 Annotations, they have to be index and property.
            case 2:

                if( ($this->getAnnotationIndex(self::PROPERTY) >= 0) && ($this->getAnnotationIndex(self::INDEX) >= 0))
                {
                    //They are index and property, return
                    return;
                }

                break;
        }

        //It didn't fall into any of the categories, must be invalid
        throw new Exception("Invalid annotation combination on {$this->name} in {$this->property->getDeclaringClass()->getName()}.");
    }
973795
private void validateAttributes() {
    if (content == null) {
      throw new NullContentException("RendererBuilder needs content to create Renderer instances");
    }

    if (parent == null) {
      throw new NullParentException("RendererBuilder needs a parent to inflate Renderer instances");
    }

    if (layoutInflater == null) {
      throw new NullLayoutInflaterException(
          "RendererBuilder needs a LayoutInflater to inflate Renderer instances");
    }
  }
676047
public function validate()
	{
		// Process each element.
		$instance_taxonomy = $this->getInstanceTaxonomy();
		$types = $instance_taxonomy->context->types;
		// Create a collection of prefixes from this document and the backing schema(s)
		// BMS 2018-08-22 Added the array_filter() call so that taxonomies without a prefix do not cause a log notice
		// $prefixes = array_flip( array_map( function( $taxonomy ) { return $taxonomy->getPrefix(); }, $instance_taxonomy->getImportedSchemas() ) );
		$prefixes = array_flip( array_filter( array_map( function( $taxonomy ) { return $taxonomy->getPrefix(); }, $instance_taxonomy->getImportedSchemas() ) ) );

		$prefixes = $this->instance_namespaces + $prefixes + array( STANDARD_PREFIX_XBRLI => XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] );

		if ( is_null( $types ) )
		{
			throw new \ErrorException( 'Unable to validate the instance because there are no types' );
		}

		// Begin by checking the element in the xbrli namespace are valid
		$xml = $this->getInstanceXml();

		if ( strcasecmp( $xml->getName(), STANDARD_PREFIX_XBRL ) !== 0 )
		{
			$this->log()->instance_validation( "4.1", "The instance document root element is not 'xbrl'.", array() );
			return false;
		}

		$rootElement = $types->getElement( STANDARD_PREFIX_XBRL, STANDARD_PREFIX_XBRLI );

		// The requirements for the <xbrl> root node are described in the schema type.  In summary:
		// 1) There *must* be a schemaref element and it *must* precede all other nodes
		// 2) There *may* be linkrbaseRef, roleRef, an arcroleRefs (in this order)
		// 3) There will be zero or more elements belonging to xbrli:item, xbrli:tuple, xbrli:context, xbrli:unit or link:footnoteLink substitution groups

		// The root element *must* have a schemaRef element and at least one each of a fact, unit and context

		if ( ! count( $this->instance_xml->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK ] )->schemaRef ) )
		{
			$this->log()->instance_validation( "4.2", "There must be at least one schemaRef element in the instance document", array() );
		}
		else
		{
			// The schemaRef MUST have an 'href' attribute and 'type' attribute
			foreach ( $this->instance_xml->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK ] )->schemaRef as $schemaRefKey => $schemaRef )
			{
				$attributes = $schemaRef->attributes( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK ] );

				if ( ! property_exists( $attributes, 'type' ) )
				{
					$this->log()->instance_validation( "4.2.1", "There must be a type attribute on the schemaRef element ", array() );
				}
				else if ( (string) $attributes->type != 'simple' )
				{
					$this->log()->instance_validation( "4.2.1", "The value of the type attribute on the schemaRef element must be 'simple'", array() );
				}

				if ( ! property_exists( $attributes, 'href' ) )
				{
					$this->log()->instance_validation( "4.2.2", "There must be an href attribute on the schemaRef element ", array() );
				}
			}
		}

		$numericTypes = false;
		foreach ( $this->getElements()->getItemTypes() as $key => $typeName )
		{
			// Look up the type in the types list to see if it is numeric
			$qName = qname( $typeName, $prefixes );
			if ( $types->isNumeric( $qName ) )
			{
				$numericTypes = true;
				break;
			}
		}

		if ( count( $this->elements ) > 0 && ( ! count( $this->contexts ) ) )
		{
			$this->log()->instance_validation( "4.6.1", "If there are facts defined there must also be at least one context defined", array() );
		}

		if ( $numericTypes && ! count( $this->units ) )
		{
			$this->log()->instance_validation( "4.6.2", "If there are numeric facts defined (pure, shares, monetary items, etc.) there must also be at least one unit defined", array() );
		}

		// Next check that the contexts are valid
		$contexts = $this->getContexts();

		// if is instant make sure the date exists and is valid
		// if is start/end make sure both dates exist, are valid and the end > start
		// check segment or scenario
		//   check the children do not use namespaceUri http://xbrl.org/2006/xbrldi
		//   check the children are themselves not concepts

		foreach ( $this->contexts as $id => $context )
		{
			/* ---------------------------------------------------------
			 * Validate the ID
			 * ---------------------------------------------------------
			 */
			if ( empty( $id ) ) // Should never happen here because these should be filtered when the context is read
			{
				$this->log()->instance_validation( "4.7.1", "All contexts must have a valid id", array() );
			}

			/* ---------------------------------------------------------
			 * Validate the period
			 * ---------------------------------------------------------
			 */
			$period = $context['period'];

			if ( ! isset( $period['startDate'] ) )
			{
				$this->log()->instance_validation( "4.7.2", "A start date must be defined", array( 'context' => $id ) );
			}

			if ( ! isset( $period['startDate'] ) )
			{
				$this->log()->instance_validation( "4.7.2", "An end date must be defined", array( 'context' => $id ) );
			}

			if ( ! isset( $period['startDate'] ) || ! isset( $period['startDate'] ) ) continue;

			// Check the start dates and the end dates are valid
			$validDate = function( $date )
			{
				// Could be 'forever'
				if ( $date == 'forever' ) return true;

				// Next try using a full ISO8601 formatted date
				$result = DateTime::createFromFormat( DATE_ATOM, $date );
				if ( $result ) return true;

				// Next try using an ISO8601 formatted date but without the time zone
				$result = DateTime::createFromFormat( "Y-m-d\TH:i:s", $date );
				if ( $result ) return true;

				// Now try just the date
				$result = DateTime::createFromFormat( "Y-m-d", $date );
				if ( $result ) return true;

				return false;
			};

			if ( ! $validDate( $period['startDate'] ) )
			{
				$this->log()->instance_validation( "4.7.2", "The start date must be a valid ISO 8601 date",
					array(
						'context' => $id,
						'date' => "{$period['startDate']}",
					)
				);
			}

			if ( ! $validDate( $period['endDate'] ) )
			{
				$this->log()->instance_validation( "4.7.2", "The end date must be a valid ISO 8601 date",
					array(
						'context' => $id,
						'date' => "{$period['endDate']}",
					)
				);
			}

			if ( $period['type'] == 'instant' )
			{
				// Both the dates must be the same
				if ( $period['startDate'] != $period['endDate'] )
				{
					$this->log()->instance_validation( "4.7.2", "In an 'instant' context the start date and end dates must be the same",
						array(
							'context' => $id,
							'startdate' => "{$period['startDate']}",
							'enddate' => "{$period['endDate']}",
						)
					);
				}
			}
			else if ( $period['type'] == 'forever' )
			{
				// Both the dates must be the same
				if ( $period['startDate'] != $period['endDate'] )
				{
					$this->log()->instance_validation( "4.7.2", "In an 'forever' context the start date and end dates must be the same",
						array(
							'context' => $id,
							'startdate' => "{$period['startDate']}",
							'enddate' => "{$period['endDate']}",
						)
					);
				}
			}
			else
			{
				// For duration context the end date must be greater than the start date
				$startDate = $period['startDate'];
				if ( ! strpos( $startDate, 'T' ) ) $startDate .= "T00:00:00Z";

				$endDate = $period['endDate'];
				if ( ! strpos( $endDate, 'T' ) ) $endDate .= "T23:59:59Z";

				$diff = DateTime::createFromFormat( DATE_ATOM, $endDate )->getTimestamp() - DateTime::createFromFormat( DATE_ATOM, $startDate )->getTimestamp();
				if ( $diff <= 0 )
				{
					$this->log()->instance_validation( "4.7.2", "In a 'duration' context the start date must precede the end date", array( 'context' => $id ) );
				}
			}

			/* ---------------------------------------------------------
			 * Validate the entity
			 * ---------------------------------------------------------
			 */

			if ( ! isset( $context['entity'] ) )
			{
				$this->log()->instance_validation( "4.7.3", "An entity element MUST exist in a context", array( 'context' => $id ) );
				continue;
			}

			$entity = $context['entity'];

			if ( ! isset( $entity['identifier'] ) )
			{
				$this->log()->instance_validation( "4.7.3.1", "An entity element in a context MUST contain an identifier", array( 'context' => $id ) );
			}
			else
			{
				$identifier = $entity['identifier'];

				if ( ! isset( $identifier['scheme'] ) )
				{
					$this->log()->instance_validation( "4.7.3.1", "An identifier element in a context MUST include a 'scheme' attribute to identify the namespace", array( 'context' => $id ) );
				}

				if ( ! isset( $identifier['value'] ) )
				{
					$this->log()->instance_validation( "4.7.3.1", "An identifier element in a context MUST include a value", array( 'context' => $id ) );
				}
			}

			/* ---------------------------------------------------------
			 * Validate the segments
			 * ---------------------------------------------------------
			 */

			$validationTypes = array(
				'explicitMember' => 'validateExplicitMembers',
				'member' => 'validateNonDimensionMembers',
				'other' => 'validateOtherComponentTypes',
				'typedMember' => 'validateTypedMembers',
			);

			// A block of data the functions can pass to themselves for cross-function testing
			$data = null;

			if ( isset( $entity[ XBRL_Constants::$xbrliSegment ] ) )
			{
				foreach ( $validationTypes as $segmentType => $functionName )
				{
					// A block of data the functions can pass to themselves for cross-function testing
					// $data = null;

					if ( $segmentType == 'other' )
					{
						$this->validateOtherComponentTypes( $entity[ XBRL_Constants::$xbrliSegment ], $id, $types,  XBRL_Constants::$xbrliSegment, $data );
						continue;
					}

					if ( ! isset( $entity[ XBRL_Constants::$xbrliSegment ][ $segmentType ] ) ) continue;

					$segments = $entity[  XBRL_Constants::$xbrliSegment ][ $segmentType ];

					foreach ( $segments as $segment )
					{
						$this->$functionName( $segment, $id, $types,  XBRL_Constants::$xbrliSegment, $data );
					}

				}
			}

			/* ---------------------------------------------------------
			 * Validate the scenarios
			 * ---------------------------------------------------------
			 */

			// Shouldn't this be just like validating segments?

			if ( isset( $context[ XBRL_Constants::$xbrliScenario ] ) )
			{

				foreach ( $validationTypes as $scenarioType => $functionName )
				{
					// A block of data the functions can pass to themselves for cross-function testing
					// $data = null;

					if ( $scenarioType == 'other' )
					{
						$this->validateOtherComponentTypes( $context[ XBRL_Constants::$xbrliScenario ], $id, $types,  XBRL_Constants::$xbrliScenario, $data );
						continue;
					}

					if ( ! isset( $context[ XBRL_Constants::$xbrliScenario ][ $scenarioType ] ) ) continue;

					$scenarios = $context[ XBRL_Constants::$xbrliScenario ][ $scenarioType ];

					foreach ( $scenarios as $scenario )
					{
						$this->$functionName( $scenario, $id, $types,  XBRL_Constants::$xbrliScenario, $data );
					}
				}
			}

			// Need to check there are no dimensions spread across

		}

		/* ---------------------------------------------------------
		 * Validate the units
		 * ---------------------------------------------------------
		 */

		foreach ( $this->units as $id => $unit )
		{
			/* ---------------------------------------------------------
			 * Validate the ID
			 * ---------------------------------------------------------
			 */
			if ( empty( $id ) ) // Should never happen here because these should be filtered when the context is read
			{
				$this->log()->instance_validation( "4.8.1", "All units must have a valid id", array() );
			}

			// A unit definition can be a single measure in which case the unit is a simple string.
			if ( is_string( $unit ) )
			{
				$this->validateMeasure( $unit, $id, $types );
				continue;
			}

			// Otherwise its an array of components which may be two or more
			// measures or a numerator followed by a denominator

			if ( isset( $unit['measures'] ) && isset( $unit['divide'] ) )
			{
				$this->log()->instance_validation( "4.8.1", "Both a 'measure' and a 'divide' provided.  Should provide one or the other", array( 'unit' => $id ) );
			}

			if ( isset( $unit['measures'] ) )
			{
				$measures = $unit['measures'];
				foreach ( $measures as $measure )
				{
					$this->validateMeasure( $measure, $id, $types );
				}
			}

			if ( isset( $unit['divide'] ) )
			{
				$this->validateDivide( $unit['divide'], $id, $types );
			}
		}

		/* ---------------------------------------------------------
		 * Validate the facts
		 * ---------------------------------------------------------
		 */

		$this->validateFacts( $this->elements, 'xbrl', $types, $prefixes );

		/* ---------------------------------------------------------
		 * Validate footnotes
		 * ---------------------------------------------------------
		 */

		if ( isset( $this->footnotes['arcs'] ) )
		{
			// Build a list of elements with ids
			$ids = array_reduce( $this->elements, function( $ids, $element ) {
				$ids += array_reduce( $element, function( $ids, $fact ) {
					if ( isset( $fact['id'] ) ) $ids[ $fact['id'] ] = $fact;
					return $ids;
				}, array() );
				return $ids;
			}, array() );

			foreach ( $this->footnotes['arcs'] as $id => $labels )
			{
				$fragment = parse_url( $id, PHP_URL_FRAGMENT );
				// Look for an element with this id
				if ( isset( $ids[ $fragment ] ) ) continue;

				$target = "The id does not exist";
				// Look to see if the id is for a context, unit or element
				if ( $this->getContext( $fragment ) )
				{
					$target = "The id references a context";
				}
				else if ( $this->getUnit( $fragment ) )
				{
					$target = "The id references a unit";
				}
				else if ( $this->getElements( $fragment ) )
				{
					$target = "The id references a fact probably in a different extended link";
				}

				$labels = array_reduce( $labels, function( $carry, $item )
				{
					$carry = array_merge( $carry, isset( $item['footnote'] ) ? $item['footnote'] : array() );
					return $carry;
				}, array() );

				$this->log()->instance_validation( "4.11.1.1", "The footnote fact does not exist.",
					array(
						'id' => $fragment,
						'footnotes' => implode( ", ", $labels ),
						'target' => $target,
					)
				);
			}
		}

		/* ---------------------------------------------------------
		 * Validate require elements
		 * ---------------------------------------------------------
		 */

		$this->validateRequiresElementArcs( $types );

		/* ---------------------------------------------------------
		 * Validate essence alias
		 * ---------------------------------------------------------
		 */

		$this->validateEssenceAliasArcs( $types );

		/* ---------------------------------------------------------
		 * Validate calculations
		 * ---------------------------------------------------------
		 */

		$this->validateCalculations( $types );

		/* ---------------------------------------------------------
		 * Validate GeneralSpecial
		 * ---------------------------------------------------------
		 */

		$this->validateGeneralSpecial( $types );

		/* ---------------------------------------------------------
		 * Validate non-dimensional
		 * ---------------------------------------------------------
		 */

		$this->validateNonDimensionalArcRoles( $types, $this->getInstanceTaxonomy() );

		return ! $this->log()->hasInstanceValidationWarning();
	}
791829
public NamespaceMappings getNamespaceMappings()
    {
        NamespaceMappings mappings = null;
        if (m_handler != null)
        {
            mappings = m_handler.getNamespaceMappings();
        }
        return mappings;
    }
986489
public Enumeration<String> getElements() {
        AttributeNameEnumeration elements = new AttributeNameEnumeration();
        elements.addElement(ID);
        elements.addElement(QUALIFIERS);

        return elements.elements();
    }
263578
static String validatePrefix(String prefix, boolean namespaceAware, String namespaceURI) {
        if (!namespaceAware) {
            throw new DOMException(DOMException.NAMESPACE_ERR, prefix);
        }

        if (prefix != null) {
            if (namespaceURI == null
                    || !DocumentImpl.isXMLIdentifier(prefix)
                    || "xml".equals(prefix) && !"http://www.w3.org/XML/1998/namespace".equals(namespaceURI)
                    || "xmlns".equals(prefix) && !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) {
                throw new DOMException(DOMException.NAMESPACE_ERR, prefix);
            }
        }

        return prefix;
    }
954308
private void validate() {
        if (isValid != null) {
            return;
        }

        ParsingValidator v =
            new ParsingValidator(useSchema ? Languages.W3C_XML_SCHEMA_NS_URI
                                 : Languages.XML_DTD_NS_URI);
        List<Source> schemaSourceList = new ArrayList<Source>();
        if (systemId != null) {
            schemaSourceList.add(new StreamSource(systemId));
        }
        addSchemaSources(schemaSource, schemaSourceList);
        v.setSchemaSources(schemaSourceList.toArray(new Source[0]));

        try {
            ValidationResult r =
                v.validateInstance(new SAXSource(validationInputSource));
            isValid = r.isValid() ? Boolean.TRUE : Boolean.FALSE;
            for (ValidationProblem p : r.getProblems()) {
                validationProblem(p);
            }
        } catch (org.xmlunit.ConfigurationException e) {
            throw new ConfigurationException(e.getCause());
        } catch (org.xmlunit.XMLUnitException e) {
            throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
        }

        if (usingDoctypeReader && isValid == Boolean.FALSE) {
            try {
                messages.append("\nContent was: ")
                    .append(getOriginalContent(validationInputSource));
            } catch (IOException e) {
                // silent but deadly?
            }
        }
    }
1042990
public void resolvePrefixTables() throws TransformerException
  {

    super.resolvePrefixTables();

    StylesheetRoot stylesheet = getStylesheetRoot();

    if ((null != m_namespace) && (m_namespace.length() > 0))
    {
      NamespaceAlias nsa = stylesheet.getNamespaceAliasComposed(m_namespace);

      if (null != nsa)
      {
        m_namespace = nsa.getResultNamespace();

        // String resultPrefix = nsa.getResultPrefix();
        String resultPrefix = nsa.getStylesheetPrefix();  // As per xsl WG, Mike Kay

        if ((null != resultPrefix) && (resultPrefix.length() > 0))
          m_rawName = resultPrefix + ":" + m_localName;
        else
          m_rawName = m_localName;
      }
    }

    if (null != m_avts)
    {
      int n = m_avts.size();

      for (int i = 0; i < n; i++)
      {
        AVT avt = (AVT) m_avts.get(i);

        // Should this stuff be a method on AVT?
        String ns = avt.getURI();

        if ((null != ns) && (ns.length() > 0))
        {
          NamespaceAlias nsa =
            stylesheet.getNamespaceAliasComposed(m_namespace); // %REVIEW% ns?

          if (null != nsa)
          {
            String namespace = nsa.getResultNamespace();

            // String resultPrefix = nsa.getResultPrefix();
            String resultPrefix = nsa.getStylesheetPrefix();  // As per XSL WG
            String rawName = avt.getName();

            if ((null != resultPrefix) && (resultPrefix.length() > 0))
              rawName = resultPrefix + ":" + rawName;

            avt.setURI(namespace);
            avt.setRawName(rawName);
          }
        }
      }
    }
  }
1119341
private JsonMessageValidationContext getJsonMessageValidationContext(Element messageElement) {
        JsonMessageValidationContext context = new JsonMessageValidationContext();

        if (messageElement != null) {
            Set<String> ignoreExpressions = new HashSet<String>();
            List<?> ignoreElements = DomUtils.getChildElementsByTagName(messageElement, "ignore");
            for (Iterator<?> iter = ignoreElements.iterator(); iter.hasNext(); ) {
                Element ignoreValue = (Element) iter.next();
                ignoreExpressions.add(ignoreValue.getAttribute("path"));
            }
            context.setIgnoreExpressions(ignoreExpressions);

            addSchemaInformationToValidationContext(messageElement, context);
        }

        return context;
    }
344141
public String getValidationDescription() {
		final JvmOperation feature = getOperation();
		String message = null;
		if (!getDeclaredTypeParameters().isEmpty()) {
			message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_0,
					getFeatureTypeParametersAsString(true),
					feature.getSimpleName(),
					getFeatureParameterTypesAsString(),
					feature.getDeclaringType().getSimpleName());
		} else {
			message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_1,
					feature.getSimpleName(),
					getFeatureParameterTypesAsString(),
					feature.getDeclaringType().getSimpleName());
		}
		return message;
	}
1374036
public String content() {
		String s = (String) annotationAttributes.get(CONTENT);
		if (s == null)
			s = "";
		return s;
	}
69959
protected void validate(WebElement element, SeleniumBrowser browser, TestContext context) {
        validateElementProperty("tag-name", tagName, element.getTagName(), context);
        validateElementProperty("text", text, element.getText(), context);

        Assert.isTrue(displayed == element.isDisplayed(), String.format("Selenium web element validation failed, " +
                "property 'displayed' expected '%s', but was '%s'", displayed, element.isDisplayed()));
        Assert.isTrue(enabled == element.isEnabled(), String.format("Selenium web element validation failed, " +
                "property 'enabled' expected '%s', but was '%s'", enabled, element.isEnabled()));

        for (Map.Entry<String, String> attributeEntry : attributes.entrySet()) {
            validateElementProperty(String.format("attribute '%s'", attributeEntry.getKey()), attributeEntry.getValue(), element.getAttribute(attributeEntry.getKey()), context);
        }

        for (Map.Entry<String, String> styleEntry : styles.entrySet()) {
            validateElementProperty(String.format("css style '%s'", styleEntry.getKey()), styleEntry.getValue(), element.getCssValue(styleEntry.getKey()), context);
        }
    }
677487
function() {
    var aen=this.attEltNodes;
    if (!aen) {
      return null;
    }
    var attElts=[], cta=this.ctlAttributes;
    for (var i=0,sz=aen.length; sz>i;i++) {
      aen[i].registerAttElements(attElts);
    }
    // check that all elements are valid (i.e. have valid names)
    var nm, elt, ok, elts=[], cte=this.ctlElements? this.ctlElements : [];
    for (var i=0,sz=attElts.length; sz>i; i++) {
      elt=attElts[i];
      nm=elt.name;
      ok=true;
      if (cta && cta[nm]) {
        // valid tpl attribute
        if (!this.tplAttributes) {
          this.tplAttributes={};
        }
        this.tplAttributes[nm]=elt;
        ok = false;
      } else {
        if (!nm) {
          log.error(this+" Invalid attribute element (unnamed)");
          ok=false;
        } else if (!cte[nm]) {
          log.error(this+" Invalid attribute element: @"+nm);
          ok=false;
        }
      }
      if (ok) {
        elts.push(elt);
      }
    }
    if (elts.length===0) {
      elts=null;
    }
    this.childElements=elts;
    return elts;
  }
75840
protected void validateMessageContent(Message receivedMessage, Message controlMessage, XmlMessageValidationContext validationContext,
            TestContext context) {
        if (controlMessage == null || controlMessage.getPayload() == null) {
            log.debug("Skip message payload validation as no control message was defined");
            return;
        }

        if (!(controlMessage.getPayload() instanceof String)) {
            throw new IllegalArgumentException(
                    "DomXmlMessageValidator does only support message payload of type String, " +
                    "but was " + controlMessage.getPayload().getClass());
        }

        String controlMessagePayload = controlMessage.getPayload(String.class);

        if (receivedMessage.getPayload() == null || !StringUtils.hasText(receivedMessage.getPayload(String.class))) {
            Assert.isTrue(!StringUtils.hasText(controlMessagePayload),
                    "Unable to validate message payload - received message payload was empty, control message payload is not");
            return;
        } else if (!StringUtils.hasText(controlMessagePayload)) {
            return;
        }

        log.debug("Start XML tree validation ...");

        Document received = XMLUtils.parseMessagePayload(receivedMessage.getPayload(String.class));
        Document source = XMLUtils.parseMessagePayload(controlMessagePayload);

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

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

        validateXmlTree(received, source, validationContext, namespaceContextBuilder.buildContext(
                receivedMessage, validationContext.getNamespaces()), context);
    }