Java 8 DOMConfiguration - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DOMConfiguration class.

This code example shows how to use the following methods:canSetParameter, getParameter, setParameter
        assertSupported("comments", false); 
        assertSupported("comments", true); 
    } 
 
    public void testDatatypeNormalization() { 
        assertEquals(false, domConfiguration.getParameter("datatype-normalization"));
        assertSupported("datatype-normalization", false); 
        assertSupported("datatype-normalization", true); 
 
        // setting this parameter to true should set validate to true... 
        domConfiguration.setParameter("validate", false);
        domConfiguration.setParameter("datatype-normalization", true);
        assertEquals(true, domConfiguration.getParameter("validate"));
 
        // ...but the negative case isn't so 
        domConfiguration.setParameter("datatype-normalization", false);
        assertEquals(true, domConfiguration.getParameter("validate"));
    } 
 
    public void testElementContentWhitespace() { 

8
CodeRank
This code example shows how to use the following methods:setParameter
            Document doc = builder.parseURI(argv[0]);
 
            // set error handler on the Document 
            config = doc.getDomConfig();
             
            config.setParameter("error-handler", errorHandler);
 
            // set validation feature 
            config.setParameter("validate", Boolean.TRUE);
            config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema");
            //config.setParameter("schema-type","http://www.w3.org/TR/REC-xml"); 
            config.setParameter("schema-location","data/personal.xsd");
             
            // remove comments from the document 
            config.setParameter("comments", Boolean.FALSE);
 
            System.out.println("Normalizing document... ");
            doc.normalizeDocument();
 
 
6
CodeRank
This code example shows how to use the following methods:canSetParameter, setParameter
assertEquals(message, false, domConfiguration.canSetParameter("well-formed", null));
    } 
 
    public void testTypeMismatch() { 
        assertEquals(false, domConfiguration.canSetParameter("well-formed", "true"));
        try { 
            domConfiguration.setParameter("well-formed", "true");
            fail();
        } catch (DOMException e) {
        } 
 
        assertEquals(false, domConfiguration.canSetParameter("well-formed", new Object()));
        try { 
            domConfiguration.setParameter("well-formed", new Object());
            fail();
        } catch (DOMException e) {
        } 
    } 
 
6
CodeRank
This code example shows how to use the following methods:setParameter
            Document doc = builder.parseURI(argv[0]);
 
            // set error handler on the Document 
            config = doc.getDomConfig();
             
            config.setParameter("error-handler", errorHandler);
 
            // set validation feature 
            config.setParameter("validate", Boolean.TRUE);
            config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema");
            //config.setParameter("schema-type","http://www.w3.org/TR/REC-xml"); 
            config.setParameter("schema-location","data/personal.xsd");
             
            // remove comments from the document 
            config.setParameter("comments", Boolean.FALSE);
 
            System.out.println("Normalizing document... ");
            doc.normalizeDocument();
 
 
6
CodeRank
This code example shows how to use the following methods:canSetParameter
This code example shows how to use the following methods:canSetParameter
This code example shows how to use the following methods:setParameter
	 
			domImpl = new DOMImplementationImpl();
	 
			serializer = domImpl.createLSSerializer();
			DOMConfiguration config = serializer.getDomConfig();
			config.setParameter("comments", Boolean.valueOf(true));
		} catch (Exception e) {
			Log.e(TAG, "Failed to initialize", e);
			throw new DigSigException(e);
		} 
	} 
 
	private void doSign(Intent intent) {
		int selected = intent.getIntExtra(Sign.Params.IDENTITY, -1);
		if (selected==-1) {
			return; 
		} 
		Intent bcIntent = new Intent();
 
		X509Certificate cert = secureStorage.getCertificate(selected);
4
CodeRank
This code example shows how to use the following methods:setParameter
			domRegistry = DOMImplementationRegistry.newInstance();
			domImpl = (DOMImplementationLS) domRegistry.getDOMImplementation("LS");
			serializer = domImpl.createLSSerializer();
			domConfig = serializer.getDomConfig();
			 
			domConfig.setParameter("comments", new Boolean(true));			
		} catch (Exception e) {			
			LOG.error("Initialization failed", e);
		} 
	} 
	 
	public static Document parseDocument(InputStream is) throws DigsigException {
		 
		Document doc = null;
		 
		try { 
			docBuilder = dbf.newDocumentBuilder();
			doc = docBuilder.parse(is);
		} catch (Exception e) {			
			throw new DigsigException(e);
4
CodeRank
This code example shows how to use the following methods:canSetParameter
This code example shows how to use the following methods:setParameter
			domRegistry = DOMImplementationRegistry.newInstance();
			domImpl = (DOMImplementationLS) domRegistry.getDOMImplementation("LS");
			serializer = domImpl.createLSSerializer();
			domConfig = serializer.getDomConfig();
			 
			domConfig.setParameter("comments", new Boolean(true));			
		} catch (Exception e) {			
			LOG.error("Initialization failed", e);
		} 
	} 
	 
	public static Document parseDocument(InputStream is) throws DigsigException {
		 
		Document doc = null;
		 
		try { 
			docBuilder = dbf.newDocumentBuilder();
			doc = docBuilder.parse(is);
		} catch (Exception e) {			
			throw new DigsigException(e);
4
CodeRank
See Code Examples for Java 8 DOMConfiguration Methods: