Java 8 Element - 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 Element class.

This code example shows how to use the following methods: getAttribute, hasAttribute
        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document doc = builder.parse(new InputSource(new StringReader(xml)));
 
        Element rootElement = doc.getDocumentElement();
 
        CardType type      = CardType.class.getEnumConstants()[Integer.parseInt(rootElement.getAttribute("type"))];
        byte[]   id        = Utils.hexStringToByteArray(rootElement.getAttribute("id"));
        Date     scannedAt = rootElement.hasAttribute("scanned_at") ? new Date(Long.valueOf(rootElement.getAttribute("scanned_at"))) : new Date(0);
        switch (type) {
            case MifareDesfire:
                return DesfireCard.fromXml(id, scannedAt, rootElement);
            case CEPAS:
                return CEPASCard.fromXML(id, scannedAt, rootElement);
            case FeliCa:
                return FelicaCard.fromXml(id, scannedAt, rootElement);
            case MifareClassic:
                return ClassicCard.fromXml(id, scannedAt, rootElement);
            default: 
                throw new UnsupportedOperationException("Unsupported card type: " + type);
        } 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getAttribute
This code example shows how to use the following methods: getAttribute, hasAttribute
		return beanDef;
	} 
 
	private RootBeanDefinition getRedirectView(Element element, HttpStatus status, Object source) {
		ConstructorArgumentValues cavs = new ConstructorArgumentValues();
		cavs.addIndexedArgumentValue(0, element.getAttribute("redirect-url"));
		RootBeanDefinition redirectView = new RootBeanDefinition(RedirectView.class, cavs, null);
		redirectView.setSource(source);
		if (status != null) {
			redirectView.getPropertyValues().add("statusCode", status);
		} 
		if (element.hasAttribute("context-relative")) {
			redirectView.getPropertyValues().add("contextRelative", element.getAttribute("context-relative"));
		} 
		if (element.hasAttribute("keep-query-params")) {
			redirectView.getPropertyValues().add("propagateQueryParams", element.getAttribute("keep-query-params"));
		} 
		return redirectView;
	} 
 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getAttribute, hasAttribute
		return true; 
	} 
 
	@Override 
	protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
		if (element.hasAttribute(ADDRESSES) &&
				(element.hasAttribute(HOST_ATTRIBUTE) || element.hasAttribute(PORT_ATTRIBUTE))) {
			parserContext.getReaderContext().error("If the 'addresses' attribute is provided, a connection " +
					"factory can not have 'host' or 'port' attributes.", element);
		} 
		String channelCacheSize = element.getAttribute(CHANNEL_CACHE_SIZE_ATTRIBUTE);
		String connectionCacheSize = element.getAttribute(CONNECTION_CACHE_SIZE_ATTRIBUTE);
		if (StringUtils.hasText(channelCacheSize) && StringUtils.hasText(connectionCacheSize)) {
			parserContext.getReaderContext().error(
					"Cannot have both 'connection-cache-size' and 'channel-cache-size' attributes", element);
		} 
		NamespaceUtils.addConstructorArgParentRefIfAttributeDefined(builder, element, CONNECTION_FACTORY_ATTRIBUTE);
		NamespaceUtils.setValueIfAttributeDefined(builder, element, CHANNEL_CACHE_SIZE_ATTRIBUTE);
		NamespaceUtils.setValueIfAttributeDefined(builder, element, HOST_ATTRIBUTE);
		NamespaceUtils.setValueIfAttributeDefined(builder, element, PORT_ATTRIBUTE);

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getAttribute, hasAttribute
	} 
 
	protected MutablePropertyValues parseCommonContainerProperties(Element containerEle, ParserContext parserContext) {
		MutablePropertyValues properties = new MutablePropertyValues();
 
		String destinationType = containerEle.getAttribute(DESTINATION_TYPE_ATTRIBUTE);
		boolean pubSubDomain = false;
		boolean subscriptionDurable = false;
		boolean subscriptionShared = false;
		if (DESTINATION_TYPE_SHARED_DURABLE_TOPIC.equals(destinationType)) {
			pubSubDomain = true;
			subscriptionDurable = true;
			subscriptionShared = true;
		} 
		else if (DESTINATION_TYPE_SHARED_TOPIC.equals(destinationType)) {
			pubSubDomain = true;
			subscriptionShared = true;
		} 
		else if (DESTINATION_TYPE_DURABLE_TOPIC.equals(destinationType)) {
			pubSubDomain = true;

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Element Questions & Answers:

Other Java 8 Element Examples

56:			for (int i = 0; i < nl.getLength(); i++) {
57:				// creating new HashMap
58:				HashMap<String, String> map = new HashMap<String, String>();
59:				Element e = (Element) nl.item(i);
60:				// adding each child node to HashMap key => value
-
56:			for (int i = 0; i < nl.getLength(); i++) {
57:				// creating new HashMap
58:				HashMapg, String> map = new HashMap<String, String>();
59:				Element e = (Element) nl.item(i);
60:				// adding each child node to HashMap key => value

Read More

44:				HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
45:				Element e = (Element) nl.item(i);
46:				// adding each child node to HashMap key =&gt; value
47:				map.put(KEY_ID, parser.getValue(e, KEY_ID));
48:				map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
-
44:				HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
45:				Element e = (Element) nl.item(i);
46:				// adding each child node to HashMap key =&gt; value
47:				map.put(KEY_ID, parser.getValue(e, KEY_ID));
48:				map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));

Read More

68:						Document doc = this.getDomElement(rss_feed_xml);
69:						NodeList nodeList = doc.getElementsByTagName(TAG_CHANNEL);
70:						Element e = (Element) nodeList.item(0);
71:						
72:						// RSS nodes
-
68:						Document doc = this.getDomElement(rss_feed_xml);
69:						NodeList nodeList = doc.getElementsByTagName(TAG_CHANNEL);
70:						Element e = (Element) nodeList.item(0);
71:						
72:						// RSS nodes
-
219:				DocumentBuilder db = dbf.newDocumentBuilder();
220:	
221:				InputSource is = new InputSource();
222:				is.setCharacterStream(new StringReader(xml));
223:				doc = (Document) db.parse(is);

Read More

See Code Examples for Java 8 Element Methods: