org.w3c.dom.TypeInfo#com.sun.org.apache.xerces.internal.impl.Constants源码实例Demo

下面列出了org.w3c.dom.TypeInfo#com.sun.org.apache.xerces.internal.impl.Constants 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk8u-backup   文件: XSSimpleTypeDecl.java
private short getPrimitiveDV(short validationDV){

        if (validationDV == DV_ID || validationDV == DV_IDREF || validationDV == DV_ENTITY){
            return DV_STRING;
        }
        else if (validationDV == DV_INTEGER) {
            return DV_DECIMAL;
        }
        else if (Constants.SCHEMA_1_1_SUPPORT && (validationDV == DV_YEARMONTHDURATION || validationDV == DV_DAYTIMEDURATION)) {
            return DV_DURATION;
        }
        else {
            return validationDV;
        }

    }
 
源代码2 项目: openjdk-jdk9   文件: DOMResultAugmentor.java
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    final Node currentElement = fDOMValidatorHelper.getCurrentElement();
    // Write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl) currentElement).setType(type);
        }
    }
}
 
源代码3 项目: Bytecoder   文件: XMLSchemaLoader.java
/**
 * This method is called either from XMLGrammarLoader.loadGrammar or from XMLSchemaValidator.
 * Note: in either case, the EntityManager (or EntityResolvers) are not going to be invoked
 * to resolve the location of the schema in XSDDescription
 * @param desc
 * @param source
 * @param locationPairs
 * @return An XML Schema grammar
 * @throws IOException
 * @throws XNIException
 */
SchemaGrammar loadSchema(XSDDescription desc, XMLInputSource source,
        Map<String, LocationArray> locationPairs) throws IOException, XNIException {

    // this should only be done once per invocation of this object;
    // unless application alters JAXPSource in the mean time.
    if(!fJAXPProcessed) {
        processJAXPSchemaSource(locationPairs);
    }

    if (desc.isExternal() && !source.isCreatedByResolver()) {
        String accessError = SecuritySupport.checkAccess(desc.getExpandedSystemId(), faccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
        if (accessError != null) {
            throw new XNIException(fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
                    "schema_reference.access",
                    new Object[] { SecuritySupport.sanitizePath(desc.getExpandedSystemId()), accessError }, XMLErrorReporter.SEVERITY_ERROR));
        }
    }
    SchemaGrammar grammar = fSchemaHandler.parseSchema(source, desc, locationPairs);

    return grammar;
}
 
源代码4 项目: Bytecoder   文件: AbstractSAXParser.java
/**
 * This method notifies of the start of an entity. The DTD has the
 * pseudo-name of "[dtd]" parameter entity names start with '%'; and
 * general entity names are just the entity name.
 * <p>
 * <strong>Note:</strong> Since the document is an entity, the handler
 * will be notified of the start of the document entity by calling the
 * startEntity method with the entity name "[xml]" <em>before</em> calling
 * the startDocument method. When exposing entity boundaries through the
 * SAX API, the document entity is never reported, however.
 * <p>
 * <strong>Note:</strong> This method is not called for entity references
 * appearing as part of attribute values.
 *
 * @param name     The name of the entity.
 * @param identifier The resource identifier.
 * @param encoding The auto-detected IANA encoding name of the entity
 *                 stream. This value will be null in those situations
 *                 where the entity encoding is not auto-detected (e.g.
 *                 internal parameter entities).
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startGeneralEntity(String name, XMLResourceIdentifier identifier,
                               String encoding, Augmentations augs)
    throws XNIException {

    try {
        // Only report startEntity if this entity was actually read.
        if (augs != null && Boolean.TRUE.equals(augs.getItem(Constants.ENTITY_SKIPPED))) {
            // report skipped entity to content handler
            if (fContentHandler != null) {
                fContentHandler.skippedEntity(name);
            }
        }
        else {
            // SAX2 extension
            if (fLexicalHandler != null) {
                fLexicalHandler.startEntity(name);
            }
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
/**
 * This method notifies of the start of parameter entity. The DTD has the
 * pseudo-name of "[dtd]" parameter entity names start with '%'; and
 * general entity names are just the entity name.
 * <p>
 * <strong>Note:</strong> Since the document is an entity, the handler
 * will be notified of the start of the document entity by calling the
 * startEntity method with the entity name "[xml]" <em>before</em> calling
 * the startDocument method. When exposing entity boundaries through the
 * SAX API, the document entity is never reported, however.
 * <p>
 * <strong>Note:</strong> This method is not called for entity references
 * appearing as part of attribute values.
 *
 * @param name     The name of the parameter entity.
 * @param identifier The resource identifier.
 * @param encoding The auto-detected IANA encoding name of the entity
 *                 stream. This value will be null in those situations
 *                 where the entity encoding is not auto-detected (e.g.
 *                 internal parameter entities).
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startParameterEntity(String name,
                                 XMLResourceIdentifier identifier,
                                 String encoding, Augmentations augs)
    throws XNIException {

    try {
        // Only report startEntity if this entity was actually read.
        if (augs != null && Boolean.TRUE.equals(augs.getItem(Constants.ENTITY_SKIPPED))) {
            // report skipped entity to content handler
            if (fContentHandler != null) {
                fContentHandler.skippedEntity(name);
            }
        }
        else {
            // SAX2 extension
            if (fLexicalHandler != null && fLexicalHandlerParameterEntities) {
                fLexicalHandler.startEntity(name);
            }
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
源代码6 项目: jdk8u60   文件: CMNodeFactory.java
/**
 * Sets the value of a property. This method is called by the component
 * manager any time after reset when a property changes value.
 * <p>
 * <strong>Note:</strong> Components should silently ignore properties
 * that do not affect the operation of the component.
 *
 * @param propertyId The property identifier.
 * @param value      The value of the property.
 *
 * @throws SAXNotRecognizedException The component should not throw
 *                                   this exception.
 * @throws SAXNotSupportedException The component should not throw
 *                                  this exception.
 */
public void setProperty(String propertyId, Object value)
    throws XMLConfigurationException {

    // Xerces properties
    if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
            final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();

        if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
            propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
            fSecurityManager = (XMLSecurityManager)value;
            maxNodeLimit = (fSecurityManager != null) ?
                    fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY : 0 ;
            return;
        }
        if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() &&
            propertyId.endsWith(Constants.ERROR_REPORTER_PROPERTY)) {
            fErrorReporter = (XMLErrorReporter)value;
            return;
        }
    }

}
 
源代码7 项目: openjdk-8-source   文件: CMNodeFactory.java
/**
 * Sets the value of a property. This method is called by the component
 * manager any time after reset when a property changes value.
 * <p>
 * <strong>Note:</strong> Components should silently ignore properties
 * that do not affect the operation of the component.
 *
 * @param propertyId The property identifier.
 * @param value      The value of the property.
 *
 * @throws SAXNotRecognizedException The component should not throw
 *                                   this exception.
 * @throws SAXNotSupportedException The component should not throw
 *                                  this exception.
 */
public void setProperty(String propertyId, Object value)
    throws XMLConfigurationException {

    // Xerces properties
    if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
            final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();

        if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
            propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
            fSecurityManager = (XMLSecurityManager)value;
            maxNodeLimit = (fSecurityManager != null) ?
                    fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY : 0 ;
            return;
        }
        if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() &&
            propertyId.endsWith(Constants.ERROR_REPORTER_PROPERTY)) {
            fErrorReporter = (XMLErrorReporter)value;
            return;
        }
    }

}
 
源代码8 项目: jdk8u60   文件: DOMParserImpl.java
/**
 * Constructs a DOM Builder using the standard parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config, String schemaType) {
    this (config);
    if (schemaType != null) {
        if (schemaType.equals (Constants.NS_DTD)) {
            //Schema validation is false by default and hence there is no
            //need to set it to false here.  Also, schema validation is
            //not a recognized feature for DTDConfiguration's and so
            //setting this feature here would result in a Configuration
            //Exception.
            fConfiguration.setProperty (
            Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
            Constants.NS_DTD);
            fSchemaType = Constants.NS_DTD;
        }
        else if (schemaType.equals (Constants.NS_XMLSCHEMA)) {
            // XML Schem validation
            fConfiguration.setProperty (
            Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
            Constants.NS_XMLSCHEMA);
        }
    }

}
 
源代码9 项目: openjdk-8   文件: DOMResultBuilder.java
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    // write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl)fCurrentNode).setType(type);
        }
    }

    // adjust current node reference
    if (fCurrentNode == fFragmentRoot) {
        fCurrentNode = null;
        fFragmentRoot = null;
        return;
    }
    fCurrentNode = fCurrentNode.getParentNode();
}
 
源代码10 项目: openjdk-8   文件: XMLInputFactoryImpl.java
/** Allows the user to set specific feature/property on the underlying implementation. The underlying implementation
 * is not required to support every setting of every property in the specification and may use IllegalArgumentException
 * to signal that an unsupported property may not be set with the specified value.
 * @param name The name of the property (may not be null)
 * @param value The value of the property
 * @throws java.lang.IllegalArgumentException if the property is not supported
 */
public void setProperty(java.lang.String name, Object value) throws java.lang.IllegalArgumentException {

    if(name == null || value == null || !fPropertyManager.containsProperty(name) ){
        throw new IllegalArgumentException("Property "+name+" is not supported");
    }
    if(name == Constants.REUSE_INSTANCE || name.equals(Constants.REUSE_INSTANCE)){
        fReuseInstance = ((Boolean)value).booleanValue();
        if(DEBUG)System.out.println("fReuseInstance is set to " + fReuseInstance);
    }else{//for any other property set the flag
        //REVISIT: Even in this case instance can be reused, by passing PropertyManager
        fPropertyChanged = true;
    }
    fPropertyManager.setProperty(name,value);
}
 
源代码11 项目: openjdk-jdk9   文件: ShortHandPointer.java
/**
 * Returns the schema-determined-ID.
 *
 *
 * @param attributes
 * @param index
 * @return A String containing the schema-determined ID.
 * @throws XNIException
 */
public String getSchemaDeterminedID(XMLAttributes attributes, int index)
throws XNIException {
    Augmentations augs = attributes.getAugmentations(index);
    AttributePSVI attrPSVI = (AttributePSVI) augs
    .getItem(Constants.ATTRIBUTE_PSVI);

    if (attrPSVI != null) {
        // An element or attribute information item is a schema-determined
        // ID if and only if one of the following is true:]

        // 1. It has a [member type definition] or [type definition] property
        // whose value in turn has [name] equal to ID and [target namespace]
        // equal to http://www.w3.org/2001/XMLSchema;

        // 2. It has a [base type definition] whose value has that [name] and [target namespace];

        // 3. It has a [base type definition] whose value has a [base type definition]
        // whose value has that [name] and [target namespace], and so on following
        // the [base type definition] property recursively;

        XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition();
        if (typeDef != null) {
            typeDef = attrPSVI.getTypeDefinition();
        }

        //
        if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) {
            return attrPSVI.getSchemaNormalizedValue();
        }

        // 4 & 5 NA
    }

    return null;
}
 
源代码12 项目: openjdk-8   文件: XMLSchemaFactory.java
private void propagateFeatures(AbstractXMLSchema schema) {
    schema.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, fSecurityManager != null);
    schema.setFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM, fUseServicesMechanism);
    String[] features = fXMLSchemaLoader.getRecognizedFeatures();
    for (int i = 0; i < features.length; ++i) {
        boolean state = fXMLSchemaLoader.getFeature(features[i]);
        schema.setFeature(features[i], state);
    }
}
 
源代码13 项目: hottub   文件: StreamValidatorHelper.java
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));
    fConfiguration = new SoftReference(config);
    return config;
}
 
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
源代码15 项目: jdk1.8-source-analysis   文件: ShortHandPointer.java
/**
 * Returns the schema-determined-ID.
 *
 *
 * @param attributes
 * @param index
 * @return A String containing the schema-determined ID.
 * @throws XNIException
 */
public String getSchemaDeterminedID(XMLAttributes attributes, int index)
throws XNIException {
    Augmentations augs = attributes.getAugmentations(index);
    AttributePSVI attrPSVI = (AttributePSVI) augs
    .getItem(Constants.ATTRIBUTE_PSVI);

    if (attrPSVI != null) {
        // An element or attribute information item is a schema-determined
        // ID if and only if one of the following is true:]

        // 1. It has a [member type definition] or [type definition] property
        // whose value in turn has [name] equal to ID and [target namespace]
        // equal to http://www.w3.org/2001/XMLSchema;

        // 2. It has a [base type definition] whose value has that [name] and [target namespace];

        // 3. It has a [base type definition] whose value has a [base type definition]
        // whose value has that [name] and [target namespace], and so on following
        // the [base type definition] property recursively;

        XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition();
        if (typeDef != null) {
            typeDef = attrPSVI.getTypeDefinition();
        }

        //
        if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) {
            return attrPSVI.getSchemaNormalizedValue();
        }

        // 4 & 5 NA
    }

    return null;
}
 
源代码16 项目: hottub   文件: BasicParserConfiguration.java
/**
 * Check a property. If the property is known and supported, this method
 * simply returns. Otherwise, the appropriate exception is thrown.
 *
 * @param propertyId The unique identifier (URI) of the property
 *                   being set.
 * @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
 *            requested feature is not known or supported.
 */
protected PropertyState checkProperty(String propertyId)
    throws XMLConfigurationException {

    // special cases
    if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
        final int suffixLength = propertyId.length() - Constants.SAX_PROPERTY_PREFIX.length();

        //
        // http://xml.org/sax/properties/xml-string
        // Value type: String
        // Access: read-only
        //   Get the literal string of characters associated with the
        //   current event.  If the parser recognises and supports this
        //   property but is not currently parsing text, it should return
        //   null (this is a good way to check for availability before the
        //   parse begins).
        //
        if (suffixLength == Constants.XML_STRING_PROPERTY.length() &&
            propertyId.endsWith(Constants.XML_STRING_PROPERTY)) {
            // REVISIT - we should probably ask xml-dev for a precise
            // definition of what this is actually supposed to return, and
            // in exactly which circumstances.
            return PropertyState.NOT_SUPPORTED;
        }
    }

    // check property
    return super.checkProperty(propertyId);

}
 
源代码17 项目: hottub   文件: ValidatorHandlerImpl.java
AttributePSVI getAttributePSVI(int index) {
    if (fAttributes != null) {
        Augmentations augs = fAttributes.getAugmentations(index);
        if (augs != null) {
            return (AttributePSVI) augs.getItem(Constants.ATTRIBUTE_PSVI);
        }
    }
    return null;
}
 
源代码18 项目: Bytecoder   文件: ValidatorHandlerImpl.java
AttributePSVI getAttributePSVIByName(String uri, String localname) {
    if (fAttributes != null) {
        Augmentations augs = fAttributes.getAugmentations(uri, localname);
        if (augs != null) {
            return (AttributePSVI) augs.getItem(Constants.ATTRIBUTE_PSVI);
        }
    }
    return null;
}
 
源代码19 项目: hottub   文件: XMLInputFactoryImpl.java
/** Allows the user to set specific feature/property on the underlying implementation. The underlying implementation
 * is not required to support every setting of every property in the specification and may use IllegalArgumentException
 * to signal that an unsupported property may not be set with the specified value.
 * @param name The name of the property (may not be null)
 * @param value The value of the property
 * @throws java.lang.IllegalArgumentException if the property is not supported
 */
public void setProperty(java.lang.String name, Object value) throws java.lang.IllegalArgumentException {

    if(name == null || value == null || !fPropertyManager.containsProperty(name) ){
        throw new IllegalArgumentException("Property "+name+" is not supported");
    }
    if(name == Constants.REUSE_INSTANCE || name.equals(Constants.REUSE_INSTANCE)){
        fReuseInstance = ((Boolean)value).booleanValue();
        if(DEBUG)System.out.println("fReuseInstance is set to " + fReuseInstance);
    }else{//for any other property set the flag
        //REVISIT: Even in this case instance can be reused, by passing PropertyManager
        fPropertyChanged = true;
    }
    fPropertyManager.setProperty(name,value);
}
 
源代码20 项目: hottub   文件: DOMParserImpl.java
/**
 * Constructs a DOM Builder using the specified symbol table and
 * grammar pool.
 */
public DOMParserImpl (SymbolTable symbolTable, XMLGrammarPool grammarPool) {
    this (new XIncludeAwareParserConfiguration());
    fConfiguration.setProperty (
    Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY,
    symbolTable);
    fConfiguration.setProperty (
    Constants.XERCES_PROPERTY_PREFIX
    + Constants.XMLGRAMMAR_POOL_PROPERTY,
    grammarPool);
}
 
源代码21 项目: jdk8u-jdk   文件: XOMParserTest.java
JDK15XML1_0Parser() throws org.xml.sax.SAXException {

            super(new DTDConfiguration());
            // workaround for Java 1.5 beta 2 bugs
            com.sun.org.apache.xerces.internal.util.SecurityManager manager =
                    new com.sun.org.apache.xerces.internal.util.SecurityManager();
            setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY, manager);

        }
 
源代码22 项目: openjdk-8   文件: DOMNormalizer.java
/**
* The end of an element.
*
* @param element The name of the element.
* @param augs    Additional information that may include infoset augmentations
*
* @exception XNIException
*                   Thrown by handler to signal an error.
*/
   public void endElement(QName element, Augmentations augs) throws XNIException {
           if (DEBUG_EVENTS) {
                   System.out.println("==>endElement: " + element);
           }

   if(augs != null) {
           ElementPSVI elementPSVI = (ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI);
           if (elementPSVI != null) {
                   ElementImpl elementNode = (ElementImpl) fCurrentNode;
                   if (fPSVI) {
                           ((PSVIElementNSImpl) fCurrentNode).setPSVI(elementPSVI);
                   }
                   // include element default content (if one is available)
                   String normalizedValue = elementPSVI.getSchemaNormalizedValue();
                   if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) {
               if (normalizedValue !=null)
                               elementNode.setTextContent(normalizedValue);
                   }
                   else {
                           // NOTE: this is a hack: it is possible that DOM had an empty element
                           // and validator sent default value using characters(), which we don't
                           // implement. Thus, here we attempt to add the default value.
                           String text = elementNode.getTextContent();
                           if (text.length() == 0) {
                                   // default content could be provided
                   if (normalizedValue !=null)
                       elementNode.setTextContent(normalizedValue);
                           }
                   }
           }
   }
   }
 
源代码23 项目: openjdk-8   文件: XMLDocumentParser.java
/**
 * Constructs a document parser using the specified symbol table and
 * grammar pool.
 */
public XMLDocumentParser(SymbolTable symbolTable,
                         XMLGrammarPool grammarPool) {
    super(new XIncludeAwareParserConfiguration());
    fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.SYMBOL_TABLE_PROPERTY, symbolTable);
    fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.XMLGRAMMAR_POOL_PROPERTY, grammarPool);
}
 
源代码24 项目: openjdk-jdk9   文件: DTDGrammarUtil.java
public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    fDTDGrammar = null;
    fInElementContent = false;
    fCurrentElementIndex = -1;
    fCurrentContentSpecType = -1;
    fNamespaces = componentManager.getFeature(NAMESPACES, true);
    fSymbolTable = (SymbolTable) componentManager.getProperty(
            Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY);
    fElementDepth = -1;
}
 
SchemaGrammar parseXMLSchema(XMLInputSource is)
            throws IOException {
    XMLEntityResolver resolver = getEntityResolver();
    if(resolver != null) {
        fSchemaLoader.setEntityResolver(resolver);
    }
    if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
        fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
    }
    fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);

    String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
    String propName = propPrefix + Constants.SCHEMA_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
    fSchemaLoader.setProperty(propName, getProperty(propName));
    fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));

    // Should check whether the grammar with this namespace is already in
    // the grammar resolver. But since we don't know the target namespace
    // of the document here, we leave such check to XSDHandler
    SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
    // by default, hand it off to the grammar pool
    if (grammar != null) {
        fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
                                  new Grammar[]{grammar});
    }

    return grammar;

}
 
源代码26 项目: hottub   文件: AbstractSAXParser.java
public boolean isDeclared(int index) {
    if (index < 0 || index >= fAttributes.getLength()) {
        throw new ArrayIndexOutOfBoundsException(index);
    }
    return Boolean.TRUE.equals(
        fAttributes.getAugmentations(index).getItem(
        Constants.ATTRIBUTE_DECLARED));
}
 
源代码27 项目: hottub   文件: ValidatorHandlerImpl.java
/** Fills in the XMLAttributes object. */
private void fillXMLAttributes2(Attributes2 att) {
    fAttributes.removeAllAttributes();
    final int len = att.getLength();
    for (int i = 0; i < len; ++i) {
        fillXMLAttribute(att, i);
        fAttributes.setSpecified(i, att.isSpecified(i));
        if (att.isDeclared(i)) {
            fAttributes.getAugmentations(i).putItem(Constants.ATTRIBUTE_DECLARED, Boolean.TRUE);
        }
    }
}
 
源代码28 项目: openjdk-8-source   文件: XMLSchemaLoader.java
public Object getParameter(String name) throws DOMException {

        if (name.equals(Constants.DOM_ERROR_HANDLER)){
            return (fErrorHandler != null) ? fErrorHandler.getErrorHandler() : null;
        }
        else if (name.equals(Constants.DOM_RESOURCE_RESOLVER)) {
            return (fResourceResolver != null) ? fResourceResolver.getEntityResolver() : null;
        }

        try {
            boolean feature = getFeature(name);
            return (feature) ? Boolean.TRUE : Boolean.FALSE;
        } catch (Exception e) {
            Object property;
            try {
                property = getProperty(name);
                return property;
            } catch (Exception ex) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "FEATURE_NOT_SUPPORTED",
                            new Object[] { name });
                throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
            }
        }
    }
 
源代码29 项目: TencentKona-8   文件: ShortHandPointer.java
/**
 * Returns the schema-determined-ID.
 *
 *
 * @param attributes
 * @param index
 * @return A String containing the schema-determined ID.
 * @throws XNIException
 */
public String getSchemaDeterminedID(XMLAttributes attributes, int index)
throws XNIException {
    Augmentations augs = attributes.getAugmentations(index);
    AttributePSVI attrPSVI = (AttributePSVI) augs
    .getItem(Constants.ATTRIBUTE_PSVI);

    if (attrPSVI != null) {
        // An element or attribute information item is a schema-determined
        // ID if and only if one of the following is true:]

        // 1. It has a [member type definition] or [type definition] property
        // whose value in turn has [name] equal to ID and [target namespace]
        // equal to http://www.w3.org/2001/XMLSchema;

        // 2. It has a [base type definition] whose value has that [name] and [target namespace];

        // 3. It has a [base type definition] whose value has a [base type definition]
        // whose value has that [name] and [target namespace], and so on following
        // the [base type definition] property recursively;

        XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition();
        if (typeDef != null) {
            typeDef = attrPSVI.getTypeDefinition();
        }

        //
        if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) {
            return attrPSVI.getSchemaNormalizedValue();
        }

        // 4 & 5 NA
    }

    return null;
}
 
AttributePSVI getAttributePSVI(int index) {
    if (fAttributes != null) {
        Augmentations augs = fAttributes.getAugmentations(index);
        if (augs != null) {
            return (AttributePSVI) augs.getItem(Constants.ATTRIBUTE_PSVI);
        }
    }
    return null;
}