nu.xom.Element.getFirstChildElement()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中nu.xom.Element.getFirstChildElement()方法的一些代码示例,展示了Element.getFirstChildElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getFirstChildElement()方法的具体详情如下:
包路径:nu.xom.Element
类名称:Element
方法名:getFirstChildElement

Element.getFirstChildElement介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

Element textElem = docElem.getFirstChildElement("TEXT");
StringBuilder text = new StringBuilder();
int offset = 0;

代码示例来源:origin: wiztools/rest-client

protected Request xml2Request(final Document doc)
    throws MalformedURLException, XMLException {
  // get the rootNode
  Element rootNode = doc.getRootElement();
  if (!"rest-client".equals(rootNode.getQualifiedName())) {
    throw new XMLException("Root node is not <rest-client>");
  }
  // checking correct rest version
  final String rcVersion = rootNode.getAttributeValue("version");
  try {
    Versions.versionValidCheck(rcVersion);
  }
  catch(Versions.VersionValidationException ex) {
    throw new XMLException(ex);
  }
  
  readVersion = rcVersion;
  // if more than two request element is present then throw the exception 
  if (rootNode.getChildElements().size() != 1) {
    throw new XMLException("There can be only one child node for root node: <request>");
  }
  // minimum one request element is present in xml 
  if (rootNode.getFirstChildElement("request") == null) {
    throw new XMLException("The child node of <rest-client> should be <request>");
  }
  Element requestNode = rootNode.getFirstChildElement("request");
  
  return getRequestBean(requestNode);
}

代码示例来源:origin: wiztools/rest-client

if (rootNode.getFirstChildElement("response") == null) {
  throw new XMLException("The child node of <rest-client> should be <response>");
responseNode = rootNode.getFirstChildElement("response");
for (int i = 0; i < responseNode.getChildElements().size(); i++) {
  tNode = responseNode.getChildElements().get(i);

代码示例来源:origin: BruceEckel/OnJava8-Examples

public APerson(Element person) {
 first = person
  .getFirstChildElement("first").getValue();
 last = person
  .getFirstChildElement("last").getValue();
}
@Override

代码示例来源:origin: org.concordion/concordion

public Element getFirstChildElement(String name) {
  nu.xom.Element body = xomElement.getFirstChildElement(name);
  if (body == null) {
    return null;
  }
  return new Element(body);
}

代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom

private static
@Nullable
Element getElement(
 final Element element,
 final String name)
{
 return element.getFirstChildElement(name, SXML.XML_URI.toString());
}

代码示例来源:origin: net.sf.opendse/opendse-optimization

protected ResultElement getResultElement(nu.xom.Element eResult) throws IOException {
  nu.xom.Element eObjectives = eResult.getFirstChildElement("objectives");
  Collection<ObjectiveElement> objectiveElements = (eObjectives != null) ? getObjectiveElements(eObjectives)
      : new ArrayList<ObjectiveElement>();
  nu.xom.Element eSpecification = eResult.getFirstChildElement("specification");
  Specification spec = null;
  if (eSpecification != null) {
    SpecificationReader reader = new SpecificationReader();
    spec = reader.toSpecification(eSpecification);
  }
  return new ResultElement(objectiveElements, spec);
}

代码示例来源:origin: concordion/concordion

private void removeIrrelevantStylesheet(Element rootElement) {
  Element head = rootElement.getFirstChildElement("head");
  Element style = head.getFirstChildElement("style");
  head.removeChild(style);
}

代码示例来源:origin: concordion/concordion

@Override
public void beforeParsing(Document document) {
  Element head = document.getRootElement().getFirstChildElement("head");
  
  removeExistingStyling(head);
  removeExistingScripts(head);
}

代码示例来源:origin: org.concordion/concordion

@Override
public void beforeParsing(Document document) {
  Element head = document.getRootElement().getFirstChildElement("head");
  
  removeExistingStyling(head);
  removeExistingScripts(head);
}

代码示例来源:origin: concordion/concordion

/**
 * Adds Content-Type metadata to the document.
 */
public void beforeParsing(Document document) {
  Element html = document.getRootElement();
  Element head = html.getFirstChildElement("head");
  Check.notNull(head, "<head> section is missing from document");
  if (!hasContentTypeMetadata(head)) {
    addContentTypeMetadata(head);
  }
}

代码示例来源:origin: org.concordion/concordion

/**
 * Adds Content-Type metadata to the document.
 */
public void beforeParsing(Document document) {
  Element html = document.getRootElement();
  Element head = html.getFirstChildElement("head");
  Check.notNull(head, "<head> section is missing from document");
  if (!hasContentTypeMetadata(head)) {
    addContentTypeMetadata(head);
  }
}

代码示例来源:origin: com.internetitem/create-reactor-core

public static void appendModules(Element root, String namespace, List<String> modules) {
  Element modulesElement = root.getFirstChildElement("modules", namespace);
  if (modulesElement == null) {
    modulesElement = new Element("modules", namespace);
    root.appendChild(modulesElement);
  }
  for (String module : modules) {
    Element moduleElement = new Element("module", namespace);
    moduleElement.appendChild(module);
    modulesElement.appendChild(moduleElement);
  }
}

代码示例来源:origin: org.concordion/concordion

public void beforeParsing(Document document) {
    Element html = document.getRootElement();
    Element head = html.getFirstChildElement("head");
    Check.notNull(head, "<head> section is missing from document");
    Element script = new Element("script");
    script.addAttribute(new Attribute("type", "text/javascript") );
    script.appendChild(javaScript);
    head.insertChild(script, 0);
  }
}

代码示例来源:origin: org.concordion/concordion

public void beforeParsing(Document document) {
  nu.xom.Element html = document.getRootElement();
  nu.xom.Element head = html.getFirstChildElement("head");
  Check.notNull(head, "<head> section is missing from document");
  script = new nu.xom.Element("script");
  script.addAttribute(new Attribute("type", "text/javascript"));
  
  // Fix for Issue #26: Strict XHTML DTD requires an explicit end tag for <script> element
  // Thanks to Matthias Schwegler for reporting and supplying a fix for this.
  script.appendChild("");
  
  head.appendChild(script);
}

代码示例来源:origin: concordion/concordion

private void removeIrrelevantFooter(Element rootElement) {
    Element body = rootElement.getFirstChildElement("body");
    body.removeChild(rootElement.query("//div[@class='footer']").get(0));
  }
}

代码示例来源:origin: concordion/concordion

private void removeIrrelevantFooter(Element rootElement) {
    Element body = rootElement.getFirstChildElement("body");
    body.removeChild(rootElement.query("//div[@class='footer']").get(0));
  }
}

代码示例来源:origin: concordion/concordion

public void beforeParsing(Document document) {
    Element html = document.getRootElement();
    Element head = html.getFirstChildElement("head");
    Check.notNull(head, "<head> section is missing from document");
    Element script = new Element("script");
    script.addAttribute(new Attribute("type", "text/javascript") );
    script.appendChild(javaScript);
    head.insertChild(script, 0);
  }
}

代码示例来源:origin: concordion/concordion

public void beforeParsing(Document document) {
  nu.xom.Element html = document.getRootElement();
  nu.xom.Element head = html.getFirstChildElement("head");
  Check.notNull(head, "<head> section is missing from document");
  link = new nu.xom.Element("link");
  link.addAttribute(new Attribute("type", "text/css"));
  link.addAttribute(new Attribute("rel", "stylesheet"));
  head.appendChild(link);
}

代码示例来源:origin: org.concordion/concordion

public void beforeParsing(Document document) {
  nu.xom.Element html = document.getRootElement();
  nu.xom.Element head = html.getFirstChildElement("head");
  Check.notNull(head, "<head> section is missing from document");
  link = new nu.xom.Element("link");
  link.addAttribute(new Attribute("type", "text/css"));
  link.addAttribute(new Attribute("rel", "stylesheet"));
  head.appendChild(link);
}

相关文章