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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:canSetParameter
This code example shows how to use the following methods:canSetParameter
				&& domImplementation.hasFeature("Core", "2.0")) {
			DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementation
					.getFeature("LS", "3.0");
			LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
			DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
			if (domConfiguration.canSetParameter("format-pretty-print", Boolean.TRUE)) {
				lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
				LSOutput lsOutput = domImplementationLS.createLSOutput();
				lsOutput.setEncoding("UTF-8");
				StringWriter stringWriter = new StringWriter();
				lsOutput.setCharacterStream(stringWriter);
				lsSerializer.write(doc, lsOutput);
				return stringWriter.toString();
			} else { 
				throw new RuntimeException(
						"DOMConfiguration 'format-pretty-print' parameter isn't settable."); 
			} 
		} else { 
			throw new RuntimeException("DOM 3.0 LS and/or DOM 2.0 Core not supported.");
		} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 DOMConfiguration Methods: