Java Code Examples for jdk.xml.internal.JdkXmlUtils#getValue()

The following examples show how to use jdk.xml.internal.JdkXmlUtils#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransformerImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    if (_translet != null) {
        _translet.setMessageHandler(new MessageHandler(_errorListener));
    }
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _overrideDefaultParser = _tfactory.overrideDefaultParser();
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_overrideDefaultParser);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    _cdataChunkSize = JdkXmlUtils.getValue(_tfactory.getAttribute(JdkXmlUtils.CDATA_CHUNK_SIZE),
            JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);
    _readerManager.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, _cdataChunkSize);

    _useCatalog = _tfactory.getFeature(XMLConstants.USE_CATALOG);
    if (_useCatalog) {
        _catalogFeatures = (CatalogFeatures)_tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
        String catalogFiles = _catalogFeatures.get(CatalogFeatures.Feature.DEFER);
        if (catalogFiles != null) {
            _readerManager.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
            _readerManager.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
        }
    }
    //_isIncremental = tfactory._incremental;
}
 
Example 2
Source File: XMLReaderManager.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Set property.
 */
public void setProperty(String name, Object value) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        _accessExternalDTD = (String)value;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        _xmlSecurityManager = (XMLSecurityManager)value;
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        _catalogFeatures = (CatalogFeatures)value;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        _cdataChunkSize = JdkXmlUtils.getValue(value, _cdataChunkSize);
    }
}
 
Example 3
Source File: TransformerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected TransformerImpl(Translet translet, Properties outputProperties,
    int indentNumber, TransformerFactoryImpl tfactory)
{
    _translet = (AbstractTranslet) translet;
    _properties = createOutputProperties(outputProperties);
    _propertiesClone = (Properties) _properties.clone();
    _indentNumber = indentNumber;
    _tfactory = tfactory;
    _useServicesMechanism = _tfactory.useServicesMechnism();
    _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
    _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
    _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
    _readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
    _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
    _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
    _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
    _cdataChunkSize = JdkXmlUtils.getValue(_tfactory.getAttribute(JdkXmlUtils.CDATA_CHUNK_SIZE),
            JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);
    _readerManager.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, _cdataChunkSize);

    _useCatalog = _tfactory.getFeature(XMLConstants.USE_CATALOG);
    if (_useCatalog) {
        _catalogFeatures = (CatalogFeatures)_tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
        String catalogFiles = _catalogFeatures.get(CatalogFeatures.Feature.DEFER);
        if (catalogFiles != null) {
            _readerManager.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
            _readerManager.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
        }
    }
    //_isIncremental = tfactory._incremental;
}
 
Example 4
Source File: XMLReaderManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set property.
 */
public void setProperty(String name, Object value) {
    if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
        _accessExternalDTD = (String)value;
    } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
        _xmlSecurityManager = (XMLSecurityManager)value;
    } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
        _catalogFeatures = (CatalogFeatures)value;
    } else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
        _cdataChunkSize = JdkXmlUtils.getValue(value, _cdataChunkSize);
    }
}
 
Example 5
Source File: XMLDocumentFragmentScannerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */

public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    super.reset(componentManager);

    // other settings
    // fDocumentSystemId = null;

    // sax features
    //fAttributes.setNamespaces(fNamespaces);

    // xerces features
    fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
    fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);

    fCreateEntityRefNodes = componentManager.getFeature(CREATE_ENTITY_REF_NODES, fCreateEntityRefNodes);

    Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
    fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
            (ExternalSubsetResolver) resolver : null;

    //attribute
    fReadingAttributes = false;
    //xxx: external entities are supported in Xerces
    // it would be good to define feature for this case
    fSupportExternalEntities = true;
    fReplaceEntityReferences = true;
    fIsCoalesce = false;

    // setup Driver
    setScannerState(SCANNER_STATE_CONTENT);
    setDriver(fContentDriver);

    // JAXP 1.5 features and properties
    XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
            componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
    fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

    fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
    fChunkSize = JdkXmlUtils.getValue(componentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE),
            JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);

    resetCommon();
    //fEntityManager.test();
}
 
Example 6
Source File: XMLDocumentFragmentScannerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void reset(PropertyManager propertyManager){

        super.reset(propertyManager);

        // other settings
        // fDocumentSystemId = null;
        fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE));
        fNotifyBuiltInRefs = false ;

        //fElementStack2.clear();
        //fReplaceEntityReferences = true;
        //fSupportExternalEntities = true;
        Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES);
        fReplaceEntityReferences = bo;
        bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES);
        fSupportExternalEntities = bo;
        Boolean cdata = (Boolean)propertyManager.getProperty(
                Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT) ;
        if(cdata != null)
            fReportCdataEvent = cdata ;
        Boolean coalesce = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_COALESCING) ;
        if(coalesce != null)
            fIsCoalesce = coalesce;
        fReportCdataEvent = fIsCoalesce ? false : (fReportCdataEvent && true) ;
        //if fIsCoalesce is set to true, set the value of fReplaceEntityReferences to true,
        //if fIsCoalesce is set to false, take the value of fReplaceEntityReferences as set by application
        fReplaceEntityReferences = fIsCoalesce ? true : fReplaceEntityReferences;
        // setup Driver
        //we dont need to do this -- nb.
        //setScannerState(SCANNER_STATE_CONTENT);
        //setDriver(fContentDriver);
        //fEntityManager.test();

         // JAXP 1.5 features and properties
        XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
                propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
        fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

        fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
        fChunkSize = JdkXmlUtils.getValue(propertyManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE),
                JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);
        resetCommon();
    }
 
Example 7
Source File: XMLDocumentFragmentScannerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Resets the component. The component can query the component manager
 * about any features and properties that affect the operation of the
 * component.
 *
 * @param componentManager The component manager.
 *
 * @throws SAXException Thrown by component on initialization error.
 *                      For example, if a feature or property is
 *                      required for the operation of the component, the
 *                      component manager may throw a
 *                      SAXNotRecognizedException or a
 *                      SAXNotSupportedException.
 */

public void reset(XMLComponentManager componentManager)
throws XMLConfigurationException {

    super.reset(componentManager);

    // other settings
    // fDocumentSystemId = null;

    // sax features
    //fAttributes.setNamespaces(fNamespaces);

    // xerces features
    fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
    fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
    fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);

    Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
    fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
            (ExternalSubsetResolver) resolver : null;

    //attribute
    fReadingAttributes = false;
    //xxx: external entities are supported in Xerces
    // it would be good to define feature for this case
    fSupportExternalEntities = true;
    fReplaceEntityReferences = true;
    fIsCoalesce = false;

    // setup Driver
    setScannerState(SCANNER_STATE_CONTENT);
    setDriver(fContentDriver);

    // JAXP 1.5 features and properties
    XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
            componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
    fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

    fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
    fChunkSize = JdkXmlUtils.getValue(componentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE),
            JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);

    resetCommon();
    //fEntityManager.test();
}
 
Example 8
Source File: XMLDocumentFragmentScannerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void reset(PropertyManager propertyManager){

        super.reset(propertyManager);

        // other settings
        // fDocumentSystemId = null;
        fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE));
        fNotifyBuiltInRefs = false ;

        //fElementStack2.clear();
        //fReplaceEntityReferences = true;
        //fSupportExternalEntities = true;
        Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES);
        fReplaceEntityReferences = bo;
        bo = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES);
        fSupportExternalEntities = bo;
        Boolean cdata = (Boolean)propertyManager.getProperty(
                Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT) ;
        if(cdata != null)
            fReportCdataEvent = cdata ;
        Boolean coalesce = (Boolean)propertyManager.getProperty(XMLInputFactory.IS_COALESCING) ;
        if(coalesce != null)
            fIsCoalesce = coalesce;
        fReportCdataEvent = fIsCoalesce ? false : (fReportCdataEvent && true) ;
        //if fIsCoalesce is set to true, set the value of fReplaceEntityReferences to true,
        //if fIsCoalesce is set to false, take the value of fReplaceEntityReferences as set by application
        fReplaceEntityReferences = fIsCoalesce ? true : fReplaceEntityReferences;
        // setup Driver
        //we dont need to do this -- nb.
        //setScannerState(SCANNER_STATE_CONTENT);
        //setDriver(fContentDriver);
        //fEntityManager.test();

         // JAXP 1.5 features and properties
        XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
                propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
        fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);

        fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
        fChunkSize = JdkXmlUtils.getValue(propertyManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE),
                JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);
        resetCommon();
    }