这里面包含了一百多个JAVA源文件

源代码在线查看: e530. getting the value of an entity reference in a dom document.txt

软件大小: 551 K
上传用户: maple_78
关键词: JAVA
下载地址: 免注册下载 普通下载 VIP

相关代码

				The value of an entity reference is kept in the child nodes of the EntityReference node. This example demonstrates an entity reference with three children. 
				Note: By default, a parser expands entity references while constructing the DOM tree. See e516 Preventing Expansion of Entity References While Parsing an XML File to prevent expansion. 
				
				    // Obtain a document; the following method is implemented in
				    // e516 Preventing Expansion of Entity References While Parsing an XML File
				    Document doc = parseXmlFileNoExpandER("infilename.xml", false);
				    
				    // Get the entity reference (see input file)
				    Element root = doc.getDocumentElement();
				    EntityReference eref = (EntityReference)root.getFirstChild();
				    
				    // The first child of the entity reference is comment
				    Comment comment = (Comment)eref.getFirstChild();               // comment
				    
				    // The second child of the entity reference is an element
				    Element elem = (Element)eref.getFirstChild().getNextSibling(); // 
				    
				    // The third child of the entity reference is a text
				    Text text = (Text)eref.getLastChild();                         // text
				
				This is the sample input for the example: 
				    
				    				        				    ]>
				    &entity;
				
							

相关资源