本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
示例9: parseXml
import com.google.gwt.xml.client.Document; //导入方法依赖的package包/类
private Element parseXml(String content) {
Document parse = XMLParser.parse(content);
return parse.getDocumentElement();
}