Code examples for Document

Codota analyzed 7,668,838 open source code samples to find the most common, credible and clear examples.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
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
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
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
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
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
152:	DOMSignContext dsc = new DOMSignContext(privateKey, document.getDocumentElement()); 
Full Snippet Info
8
CodeRank
71:	// Note that no doctype is injected for fragments 
-
73:	getResourceAsStream("org/apache/shindig/gadgets/parse/nekohtml/test-headnobody.html")); 
74:	String expected = IOUtils.toString(this.getClass().getClassLoader(). 
75:	getResourceAsStream( 
-
79:	} 
80:	 
81:	private void parseAndCompareBalanced(String content, String expected, GadgetHtmlParser parser) 
-
84:	expected = StringUtils.replace(expected, EOL, "\n"); 
85:	assertEquals(expected, HtmlSerializer.serialize(document)); 
-
88:	 
Full Snippet Info
7
CodeRank
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
71:	@Test 
-
73:	Document document = mhc.getDocument(); 
74:	 
75:	// First child should be text node per other tests. Modify it. 
-
79:	 
80:	// Do it again 
81:	document.getFirstChild().getFirstChild().setTextContent("BAR CONTENT"); 
-
84:	 
-
88:	} 
89:	 
Full Snippet Info
7
CodeRank
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
89:	Element rootElement = xmlDoc.getDocumentElement(); 
-
110:	mUiRootNode.setXmlDocument(xmlDoc); 
-
116:	mUiRootNode.loadFromXmlNode(xmlDoc); 
-
121:	super.xmlModelChanged(xmlDoc); 
Full Snippet Info
7
CodeRank
65:	Node mailElt = doc.createElement("mail"); 
66:	doc.appendChild(mailElt); 
-
69:	Node statusElt = doc.createElement("status"); 
-
73:	Node subjectElt = doc.createElement("subject"); 
-
77:	Node contentElt = doc.createElement("content"); 
-
81:	Node accountRefElt = doc.createElement("accountRef"); 
Full Snippet Info
7
CodeRank
136:	Element root = doc.createElementNS("ns1", "root"); 
137:	doc.appendChild(root); 
-
139:	Element ns1Tag = doc.createElementNS("ns1", "ns1Tag"); 
-
142:	Element ns2Tag = doc.createElementNS("ns2", "ns2Tag"); 
-
145:	Element beansTag = doc.createElementNS("http://www.springframework.org/schema/beans", "beans"); 
-
148:	Element noNsTag = doc.createElement("noNsTag"); 
Full Snippet Info
7
CodeRank
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
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
42:	XPathWrapper wrapper = new XPathWrapper(doc); 
-
71:	void parseNestedContentWithNoCloseForBrAndHr(GadgetHtmlParser htmlParser) throws Exception { 
-
73:	XPathWrapper wrapper = new XPathWrapper(doc); 
74:	assertEquals("x and y and z", wrapper.getValue("/html/body/div")); 
75:	assertEquals(1, wrapper.getNodeList("/html/body/div/br").getLength()); 
-
79:	// TODO: figure out to what extent it makes sense to test "invalid" 
80:	// HTML, semi-structured HTML, and comment parsing 
81:	 
-
84:	private void assertNullOrEmpty(NodeList l) { 
-
88:	 
Full Snippet Info
7
CodeRank
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
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
189:	childElement = document.createElementNS(namespace, element); 
-
191:	childElement = document.createElement(element); 
-
198:	childElement.appendChild(document.createTextNode(content.toString())); 
Full Snippet Info
7
CodeRank
71:	* repeated serialization and deserialization. 
-
73:	*/ 
74:	public String getContent() { 
75:	if (content == null) { 
-
79:	contentSource = null; 
80:	} else if (document != null) { 
81:	content = HtmlSerializer.serialize(document); 
-
84:	return content; 
-
88:	* Sets the object's content as a raw String. Note, this operation 
89:	* may clears the document if the content has changed 
-
129:	document.setUserData(MUTABLE_CONTENT_LISTENER, this, null); 
Full Snippet Info
7
CodeRank