当前位置: 首页>>代码示例>>Java>>正文


Java Document.getDocumentElement方法代码示例

本文整理汇总了Java中com.google.gwt.xml.client.Document.getDocumentElement方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getDocumentElement方法的具体用法?Java Document.getDocumentElement怎么用?Java Document.getDocumentElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.xml.client.Document的用法示例。


在下文中一共展示了Document.getDocumentElement方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
public void process(SearchContext context, Document document, SearchResult result) {

        Element root = document.getDocumentElement();

        Element responseHeaderElement = getLstChild(root, "responseHeader");
        Element paramsElement = getLstChild(responseHeaderElement, "params");
        Element resultElement = getSingleChild(root, "result");

        int numFound = getIntegerAttribute(resultElement, "numFound");
        int start = getIntegerAttribute(resultElement, "start");
        int rows = Integer.parseInt(getStringChild(paramsElement, "rows"));

        Page<Hit> hits = new Page<Hit>(start / rows, rows, numFound);
        for (Element docElement : children(resultElement)) {
            Hit hit = new Hit();
            for (Element fieldElement : children(docElement)) {
                String fieldName = fieldElement.getAttribute("name");
                String value = convertToString(fieldElement);
                hit.put(fieldName, value);
            }
            hits.addItem(hit);
        }

        result.setPart(Page.class, hits);
    }
 
开发者ID:cominvent,项目名称:solr-explorer,代码行数:26,代码来源:HitsResultProcessor.java

示例2: getStyleValue

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
private Map<String, String> getStyleValue(String attribute) {
    String xml = "<root><" + attribute + " class=\"" + attribute + "\"/></root>";
    Document document = xmlParser.parse(xml);
    Element documentElement = document.getDocumentElement();
    Element firstChild = (Element) documentElement.getFirstChild();
    return styleSocket.getStyles(firstChild);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:StyleSocketAttributeHelper.java

示例3: transform

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
public static FormReader transform(Document aDocument, String aModuleName, JavaScriptObject aModel) throws Exception {
	Element layoutElement = aModuleName != null ? JsUi.findLayoutElementByBundleName(aDocument.getDocumentElement(), aModuleName) : aDocument.getDocumentElement();
	if (layoutElement != null) {
		FormReader factory = new FormReader(layoutElement, aModel);
		factory.parse();
		return factory;
	} else {
		return null;
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:11,代码来源:XmlDom2Form.java

示例4: transform

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
public static Model transform(Document aDocument, String aModuleName, JavaScriptObject aTarget) throws Exception {
	try {
		Element modelElement = aModuleName != null ? findModelElementByBundleName(aDocument.getDocumentElement(), aModuleName) : aDocument.getDocumentElement();
		if (modelElement != null) {
			XmlDom2Model transformer = new XmlDom2Model(modelElement, aTarget);
			Model model = new Model(AppClient.getInstance());
			model.accept(transformer);
			return model;
		} else
			return null;
	} catch (Exception ex) {
		Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex);
		throw ex;
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:16,代码来源:XmlDom2Model.java

示例5: createElement

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
/**
 * Creates a element with the given tagname and namespace.
 * @param tagname The tagname of the new element.
 * @param namespace The namespace of the new element.
 * @return The newly created element.
 */
public static Element createElement(String tagname, String namespace) {
	StringBuilder builder = new StringBuilder();
	builder.append("<")
		   .append(tagname)
		   .append(" xmlns='")
		   .append(namespace)
		   .append("' />");
	Document doc = XMLParser.parse(builder.toString());
	return doc.getDocumentElement();
}
 
开发者ID:MirrorIP,项目名称:activity-recommendation-app,代码行数:17,代码来源:Parser.java

示例6: parseXMLStringToElement

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
/**
 * Parses an xml-string to an element.
 * @param docXML The xml-string.
 * @return The new element.
 */
public static Element parseXMLStringToElement(String docXML) {
	try {
		Document doc = XMLParser.parse(docXML);
		return doc.getDocumentElement();
	} catch (Exception e) {
		return null;
	}
}
 
开发者ID:MirrorIP,项目名称:activity-recommendation-app,代码行数:14,代码来源:Parser.java

示例7: getNode

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
private Node getNode(String content) {
    String nodeString = startTagString + content + endTagString;
    Document parse = xmlParser.parse(nodeString);
    return parse.getDocumentElement();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:6,代码来源:SourceListViewItemContentFactory.java

示例8: createChildElement

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
private Element createChildElement(int childIndex) {
    ChildData child = children.get(childIndex);
    String xml = child.xml();
    Document document = XMLParser.parse(xml);
    return document.getDocumentElement();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:7,代码来源:LabellingInteractionBeanMockParser.java

示例9: parseXml

import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
private Element parseXml(String content) {
    Document parse = XMLParser.parse(content);
    return parse.getDocumentElement();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:5,代码来源:FormattedTextPredicateTest.java


注:本文中的com.google.gwt.xml.client.Document.getDocumentElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。