Best code examples for Java 8 Document class (org.w3c.dom.Document)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Document class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 Document examples from Open Source projects
This code example shows how to use the following methods: createElement, createTextNode
27:	Element caution = document.createElement("caution"); 
-
29:	Element para = document.createElement("para"); 
-
31:	para.appendChild(document.createTextNode(String.format("Note: This %s is ", type))); 
32:	Element link = document.createElement("ulink"); 
-
35:	link.appendChild(document.createTextNode("deprecated")); 
36:	para.appendChild(document.createTextNode(" and will be removed in the next major version of Gradle.")); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getDocumentElement
152:	DOMSignContext dsc = new DOMSignContext(privateKey, document.getDocumentElement()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getDocumentElement
79:	if (!this.schemaLocations.containsKey(doc)) { 
80:	if (doc != null && doc.getDocumentElement() != null) { 
-
82:	schemaLocations.initSchemaLocations(doc.getDocumentElement().getAttributeNS( 
-
84:	this.schemaLocations.put(doc, schemaLocations); 
-
87:	return this.schemaLocations.get(doc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode
37:	Element section = document.createElement("section"); 
-
40:	Element title = document.createElement("title"); 
-
42:	title.appendChild(document.createTextNode("Properties added by the ")); 
43:	Element literal = document.createElement("literal"); 
-
45:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
46:	title.appendChild(document.createTextNode(" plugin")); 
-
48:	Element titleabbrev = document.createElement("titleabbrev"); 
-
50:	literal = document.createElement("literal"); 
-
52:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
53:	titleabbrev.appendChild(document.createTextNode(" plugin")); 
-
55:	Element table = document.createElement("table"); 
-
58:	title = document.createElement("title"); 
-
60:	title.appendChild(document.createTextNode("Properties - ")); 
61:	literal = document.createElement("literal"); 
-
63:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
64:	title.appendChild(document.createTextNode(" plugin")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
89:	Element rootElement = xmlDoc.getDocumentElement(); 
-
110:	mUiRootNode.setXmlDocument(xmlDoc); 
-
116:	mUiRootNode.loadFromXmlNode(xmlDoc); 
-
121:	super.xmlModelChanged(xmlDoc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode
37:	Element section = document.createElement("section"); 
-
40:	Element title = document.createElement("title"); 
-
42:	title.appendChild(document.createTextNode("Methods added by the ")); 
43:	Element literal = document.createElement("literal"); 
-
45:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
46:	title.appendChild(document.createTextNode(" plugin")); 
-
48:	Element titleabbrev = document.createElement("titleabbrev"); 
-
50:	literal = document.createElement("literal"); 
-
52:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
53:	titleabbrev.appendChild(document.createTextNode(" plugin")); 
-
55:	Element table = document.createElement("table"); 
-
58:	title = document.createElement("title"); 
-
60:	title.appendChild(document.createTextNode("Methods - ")); 
61:	literal = document.createElement("literal"); 
-
63:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
64:	title.appendChild(document.createTextNode(" plugin")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode
37:	Element section = document.createElement("section"); 
-
40:	Element title = document.createElement("title"); 
-
42:	title.appendChild(document.createTextNode("Script blocks added by the ")); 
43:	Element literal = document.createElement("literal"); 
-
45:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
46:	title.appendChild(document.createTextNode(" plugin")); 
-
48:	Element titleabbrev = document.createElement("titleabbrev"); 
-
50:	literal = document.createElement("literal"); 
-
52:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
53:	titleabbrev.appendChild(document.createTextNode(" plugin")); 
-
55:	Element table = document.createElement("table"); 
-
58:	title = document.createElement("title"); 
-
60:	title.appendChild(document.createTextNode("Script blocks - ")); 
61:	literal = document.createElement("literal"); 
-
63:	literal.appendChild(document.createTextNode(extension.getPluginId())); 
64:	title.appendChild(document.createTextNode(" plugin")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
34:	LOGGER.info("WFS GetCapabilities response:\n" + prettyString(doc)); 
35:	assertEquals("wfs:WFS_Capabilities", doc.getDocumentElement().getNodeName()); 
-
37:	assertXpathCount(1, "//wfs:FeatureType", doc); 
-
39:	featureTypeNames.add(evaluate("//wfs:FeatureType[1]/wfs:Name", doc)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode
82:	Element linkElement = document.createElement("ulink"); 
-
85:	Element classNameElement = document.createElement("classname"); 
86:	classNameElement.appendChild(document.createTextNode(StringUtils.substringAfterLast(className, "."))); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createElementNS, createTextNode
189:	childElement = document.createElementNS(namespace, element); 
-
191:	childElement = document.createElement(element); 
-
198:	childElement.appendChild(document.createTextNode(content.toString())); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createAttributeNS
111:	attribute1 = doc.createAttributeNS( 
-
126:	attribute2 = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: createAttributeNS, createElementNS, createTextNode, appendChild
77:	Element flightsElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:flights"); 
78:	Attr namespace = expected.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:tns"); 
-
81:	expected.appendChild(flightsElement); 
82:	Element flightElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:flight"); 
-
84:	Element numberElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:number"); 
-
86:	Text text = expected.createTextNode("42"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: createElementNS, createTextNode, appendChild
72:	Element flightsElement = document.createElementNS("http://samples.springframework.org/flight", "tns:flights"); 
73:	document.appendChild(flightsElement); 
74:	Element flightElement = document.createElementNS("http://samples.springframework.org/flight", "tns:flight"); 
-
76:	Element numberElement = document.createElementNS("http://samples.springframework.org/flight", "tns:number"); 
-
78:	Text text = document.createTextNode("42"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: createElement
29:	element = doc.createElement( elementName ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode, getDocumentElement, appendChild
211:	assertFalse(DomUtilities.hasElementChildren(document)); 
212:	document.appendChild(document.createElement("A")); 
213:	Element a = document.getDocumentElement(); 
-
215:	a.appendChild(document.createTextNode("foo")); 
-
217:	Element b = document.createElement("B"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: createElementNS, createTextNode
67:	? document.createElementNS(null, qname.getLocalName()) 
68:	: document.createElementNS(ns.getUri(), 
-
71:	e.appendChild(document.createTextNode(value)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement, getElementsByTagName
42:	assertEquals("wcs", dom.getDocumentElement().getLocalName()); 
43:	assertEquals(1, dom.getElementsByTagName("name").getLength()); 
44:	assertXpathEvaluatesTo("true", "/wcs/enabled", dom); 
45:	assertXpathEvaluatesTo("WCS", "/wcs/name", dom); 
46:	assertXpathEvaluatesTo("false", "/wcs/verbose", dom); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, getDocumentElement, cloneNode
71:	if (DomUtil.getFirstNamedChildNode(document.getDocumentElement(), "head") == null) { 
-
73:	document.getDocumentElement().insertBefore( 
74:	document.createElement("head"), 
75:	document.getDocumentElement().getFirstChild()); 
-
79:	if (DomUtil.getFirstNamedChildNode(document.getDocumentElement(), "body") == null) { 
80:	document.getDocumentElement().appendChild( 
81:	document.createElement("body")); 
-
84:	documentCache.addElement(key, document); 
-
88:	Document copy = (Document)document.cloneNode(true); 
89:	HtmlSerializer.copySerializer(document, copy); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getDocumentElement
89:	Element rootElement = xmlDoc.getDocumentElement(); 
-
92:	super.xmlModelChanged(xmlDoc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
34:	LOGGER.info("WMS =GetCapabilities response:\n" + prettyString(doc)); 
35:	assertEquals("WMS_Capabilities", doc.getDocumentElement().getNodeName()); 
36:	assertXpathCount(1,"//wms:Layer/wms:Name[.='gsml:MappedFeature']", doc); 
37:	assertXpathCount(1,"//wms:GetFeatureInfo/wms:Format[.='application/vnd.ogc.gml/3.1.1']", doc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getElementsByTagName
132:	assertEquals(true, doc.getElementsByTagName("sld:UserLayer").getLength() == 0); 
133:	assertEquals(true, doc.getElementsByTagName("sld:NamedLayer").getLength() != 0); 
134:	assertEquals(true, doc.getElementsByTagName("sld:Rule").getLength() != 0); 
135:	assertEquals(true, doc.getElementsByTagName("ogc:Filter").getLength() != 0); 
136:	assertEquals(true, doc.getElementsByTagName("sld:PolygonSymbolizer").getLength() != 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement, getElementsByTagName
137:	assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName()); 
-
139:	NodeList featureMembers = doc.getElementsByTagName("gml:featureMember"); 
-
141:	assertXpathEvaluatesTo("name-f003", "//gs:pgeo_view/gs:name", doc); 
142:	assertXpathEvaluatesTo("1", "count(//gs:pgeo_view)", doc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, appendChild
33:	Element element = document.createElement("project"); //$NON-NLS-1$ 
-
39:	document.appendChild(element); 
40:	return serializeDocument(document); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
38:	assertEquals("map", doc.getDocumentElement().getLocalName()); 
-
40:	assertXpathEvaluatesTo("widget", "/map/name", doc); 
41:	assertXpathEvaluatesTo("12.99", "/map/price", doc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getElementsByTagName
74:	NodeList nodes = xmlDoc.getElementsByTagName("selector"); 
75:	if( nodes != null && nodes.getLength() > 0 ) { return buildStateListDrawable( xmlDoc ); } 
-
77:	nodes = xmlDoc.getElementsByTagName("layer-list"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
180:	docElem = doc.getDocumentElement(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode
33:	Element e = doc.createElement( "Event" ); 
34:	e.appendChild( doc.createElement( "Type" ) ).appendChild( doc.createTextNode( "ChannelCreationEvent" ) ); 
35:	e.appendChild( doc.createElement( "Cause" ) ).appendChild( cause.toXML( doc ) ); 
36:	e.appendChild( doc.createElement( "Channel" ) ).appendChild( channel.toXML( doc ) ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
33:	LOGGER.info("WFS GetFeature&typename=gsml:MappedFeature response:\n" + prettyString(doc)); 
34:	assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName()); 
-
39:	String exceptionText = evaluate("//ows:ExceptionText", doc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createElementNS, createTextNode
167:	return document.createElementNS(qname.getNamespaceURI(), qname.getQualifiedName()); 
-
169:	return document.createElement(name.toString()); 
-
183:	element.appendChild(document.createTextNode(value.toString())); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDocumentElement, getElementsByTagName
44:	assertEquals("wfs", dom.getDocumentElement().getLocalName()); 
45:	assertEquals(1, dom.getElementsByTagName("name").getLength()); 
46:	assertXpathEvaluatesTo("true", "/wfs/enabled", dom); 
47:	assertXpathEvaluatesTo("WFS", "/wfs/name", dom); 
48:	assertXpathEvaluatesTo("COMPLETE", "/wfs/serviceLevel", dom); 
49:	assertXpathEvaluatesTo("1000000", "/wfs/maxFeatures", dom); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getElementsByTagName
37:	+ prettyString(doc)); 
38:	assertXpathCount(1, "//ex:PolymorphicFeature", doc); 
-
40:	Node feature = doc.getElementsByTagName("ex:PolymorphicFeature").item(0); 
-
44:	assertXpathEvaluatesTo("f1", "//ex:PolymorphicFeature/@gml:id", doc); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, getDocumentElement
55:	root = doc.getDocumentElement(); 
56:	root.appendChild(text = doc.createElement("Text")); 
57:	text.appendChild(entry = doc.createElement("TextEntry")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement
269:	Element elroot = doc.createElement("UserProfile"); 
270:	Element el = doc.createElement("Name"); 
-
274:	el = doc.createElement("Password"); 
-
278:	el = doc.createElement("LocalIP"); 
-
282:	el = doc.createElement("LocalPort"); 
-
286:	el = doc.createElement("Transport"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
81:	checkValidationErrors(d); 
-
83:	assertEquals( "wps:ExecuteResponse", d.getDocumentElement().getNodeName() ); 
-
85:	assertXpathExists( "/wps:ExecuteResponse/wps:Status/wps:ProcessSucceeded", d); 
86:	assertXpathExists( 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, appendChild
55:	Element element = document.createElement("directory"); //$NON-NLS-1$ 
-
62:	document.appendChild(element); 
63:	return serializeDocument(document); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createTextNode
33:	Element e = doc.createElement( "Event" ); 
34:	e.appendChild( doc.createElement( "Type" ) ).appendChild( doc.createTextNode( "ChannelDestructionEvent" ) ); 
35:	e.appendChild( doc.createElement( "Cause" ) ).appendChild( cause.toXML( doc ) ); 
36:	e.appendChild( doc.createElement( "Channel" ) ).appendChild( channel.toXML( doc ) ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
30:	assertEquals( "FeatureCollection", dom.getDocumentElement().getLocalName() ); 
31:	assertNotNull( getFirstElementByTagName(dom, "gml:outerBoundaryIs")); 
32:	assertNull( getFirstElementByTagName(dom, "gml:exterior")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement, getElementsByTagName
46:	assertEquals("wms", dom.getDocumentElement().getLocalName()); 
47:	assertEquals(1, dom.getElementsByTagName("name").getLength()); 
48:	assertXpathEvaluatesTo("true", "/wms/enabled", dom); 
49:	assertXpathEvaluatesTo("WMS", "/wms/name", dom); 
50:	assertXpathEvaluatesTo("false", "/wms/watermark/enabled", dom); 
51:	assertXpathEvaluatesTo("Nearest", "/wms/interpolation", dom); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
114:	this.root = (Element) doc.getDocumentElement(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, createElementNS, setXmlStandalone, appendChild
154:	dom.setXmlStandalone(true); // ROTFL 
-
156:	Element fooEl = dom.createElement("foo"); 
157:	dom.appendChild(fooEl); 
-
159:	Element barEl = dom.createElementNS("urn:foo-bar:baz", "bar"); 
-
165:	String xml = XMLUtil.documentToString(dom); 
-
261:	document.setXmlStandalone(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
114:	LOGGER.info("WFS filter GetFeature response:\n" + prettyString(doc)); 
115:	assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName()); 
116:	assertXpathEvaluatesTo("1", "/wfs:FeatureCollection/@numberReturned", doc); 
117:	assertXpathCount(1, "//wml2dr:MeasurementTimeseriesDomainRange", doc); 
118:	assertXpathEvaluatesTo("ID2", "//wml2dr:MeasurementTimeseriesDomainRange/@gml:id", doc); 
119:	assertXpathEvaluatesTo("tpl." + "ID2", 
-
123:	assertXpathEvaluatesTo("16.2", "//wml2dr:MeasurementTimeseriesDomainRange[@gml:id='" 
-
125:	assertXpathEvaluatesTo("degC", "//wml2dr:MeasurementTimeseriesDomainRange[@gml:id='" 
-
127:	assertXpathEvaluatesTo("string", "//wml2dr:MeasurementTimeseriesDomainRange[@gml:id='" 
-
129:	assertXpathEvaluatesTo("http://ns.bgs.ac.uk/thesaurus/lithostratigraphy", 
-
133:	assertXpathEvaluatesTo( 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDocumentElement
74:	Element rootElement = doc.getDocumentElement(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: createElement, appendChild
62:	Element element = document.createElement(ELEMENT_NAME); 
-
65:	document.appendChild(element); 
66:	return serializeDocument(document); 
Full Snippet Info
7
CodeRank
Related Java 8 Document Questions & Answers:
Other Java 8 Document Examples
0:	public Document getDomElement(String xml){
1:			Document doc = null;
2:			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
1:			Document doc = null;
2:			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
3:			try {

Read More

8:	XMLParser parser = new XMLParser();
9:	String xml = parser.getXmlFromUrl(URL); // getting XML
10:	Document doc = parser.getDomElement(xml); // getting DOM element
11:	
12:	NodeList nl = doc.getElementsByTagName(KEY_ITEM);

Read More

66:					// parse the xml
67:					try {
68:						Document doc = this.getDomElement(rss_feed_xml);
69:						NodeList nodeList = doc.getElementsByTagName(TAG_CHANNEL);
70:						Element e = (Element) nodeList.item(0);
-
168:					org.jsoup.select.Elements links1 = doc
169:							.select("link[type=application/atom+xml]");
170:					if(links1.size() > 0){
171:						rss_url = links1.get(0).attr("href").toString();	
172:					}
-
169:							.select("link[type=application/atom+xml]");
170:					if(links1.size() > 0){
171:						rss_url = links1.get(0).attr("href").toString();	
172:					}
173:				}
-
177:			}
178:	
179:			// returing RSS url
180:			return rss_url;
181:		}

Read More

See Code Examples for Java 8 Document Methods: