org.dom4j.Branch.addElement()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(146)

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

Branch.addElement介绍

[英]Adds a new Element node with the given name to this branch and returns a reference to the new node.
[中]将具有给定名称的新Element节点添加到此分支,并返回对新节点的引用。

代码示例

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

@Override
public void startTag(String tagName) {
  Branch top = stack.getLast();
  Element element = top.addElement(tagName);
  stack.addLast(element);
}

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

@Override
public void openTag(String tagName) {
  Branch top = stack.getLast();
  Element element = top.addElement(tagName);
  stack.addLast(element);
}

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

@Override
public void openTag(String tagName, XMLAttributeList attributeList) {
  Branch top = stack.getLast();
  Element element = top.addElement(tagName);
  stack.addLast(element);
  for (Iterator<XMLAttributeList.NameValuePair> i = attributeList.iterator(); i.hasNext();) {
    XMLAttributeList.NameValuePair pair = i.next();
    element.addAttribute(pair.getName(), pair.getValue());
  }
}

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

Element element = current.addElement(qName);

代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl

private Element addElement(Branch parent, String elementName) {
 return useNamespace ? parent.addElement(elementName, JPDL_NAMESPACE)
  : parent.addElement(elementName);
}

代码示例来源:origin: com.github.albfernandez/jbpm-jpdl

private Element addElement(Branch parent, String elementName) {
 return useNamespace ? parent.addElement(elementName, JPDL_NAMESPACE)
  : parent.addElement(elementName);
}

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

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: com.google.code.findbugs/findbugs

@Override
public void startTag(String tagName) {
  Branch top = stack.getLast();
  Element element = top.addElement(tagName);
  stack.addLast(element);
}

代码示例来源:origin: com.google.code.findbugs/findbugs

@Override
public void openTag(String tagName) {
  Branch top = stack.getLast();
  Element element = top.addElement(tagName);
  stack.addLast(element);
}

代码示例来源:origin: com.google.code.findbugs/findbugs

@Override
public void openTag(String tagName, XMLAttributeList attributeList) {
  Branch top = stack.getLast();
  Element element = top.addElement(tagName);
  stack.addLast(element);
  for (Iterator<XMLAttributeList.NameValuePair> i = attributeList.iterator(); i.hasNext();) {
    XMLAttributeList.NameValuePair pair = i.next();
    element.addAttribute(pair.getName(), pair.getValue());
  }
}

代码示例来源:origin: micromata/projectforge

private void writeValue(final Branch branch, final Object obj, final String key, final String sValue, final boolean asAttribute,
  final boolean asCDATA)
{
 if (sValue == null) {
  return;
 }
 if (asAttribute == true) {
  addAttribute((Element) branch, obj, key, sValue);
 } else if (asCDATA == true) {
  branch.addElement(key).add(new DefaultCDATA(sValue));
 } else {
  branch.addElement(key).setText(sValue);
 }
}

代码示例来源:origin: com.googlecode.cernunnos/cernunnos

public Object evaluate(TaskRequest req, TaskResponse res) {
  Branch rslt = new DocumentFactory().createDocument();
  if (name != null) {
    rslt = rslt.addElement((String) name.evaluate(req, res));
  }
  return rslt;
  
}

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

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: maven/dom4j

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: org.jenkins-ci.dom4j/dom4j

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: theonedev/onedev

private void unmarshallElement(HierarchicalStreamReader reader, Branch branch) {
    Element element = branch.addElement(reader.getNodeName());
    for (int i=0; i<reader.getAttributeCount(); i++) {
      String attributeName = reader.getAttributeName(i);
      String attributeValue = reader.getAttribute(i);
      element.addAttribute(attributeName, attributeValue);
    }
    if (StringUtils.isNotBlank(reader.getValue()))
      element.setText(reader.getValue().trim());
    while (reader.hasMoreChildren()) {
      reader.moveDown();
      unmarshallElement(reader, element);
      reader.moveUp();
    }
  }
}

代码示例来源:origin: org.dom4j/com.springsource.org.dom4j

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

代码示例来源:origin: apache/servicemix-bundles

public void startElement(String namespaceURI, String localName,
    String qualifiedName, Attributes attributes) throws SAXException {
  if (mergeAdjacentText && textInTextBuffer) {
    completeCurrentTextNode();
  }
  QName qName = namespaceStack.getQName(namespaceURI, localName,
      qualifiedName);
  Branch branch = currentElement;
  if (branch == null) {
    branch = getDocument();
  }
  Element element = branch.addElement(qName);
  // add all declared namespaces
  addDeclaredNamespaces(element);
  // now lets add all attribute values
  addAttributes(element, attributes);
  elementStack.pushElement(element);
  currentElement = element;
  entity = null; // fixes bug527062
  if (elementHandler != null) {
    elementHandler.onStart(elementStack);
  }
}

相关文章