com.thoughtworks.xstream.io.xml.xppdom.XppDom.getChild()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(141)

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

XppDom.getChild介绍

暂无

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

protected Object getChild(int index) {
  return currentElement.getChild(index);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

代码示例来源:origin: senbox-org/snap-desktop

void setDisplayParameters(final XppDom presentationXML) {
  for (XppDom params : presentationXML.getChildren()) {
    final String id = params.getAttribute("id");
    if (id != null && id.equals(node.getId())) {
      displayParameters = params;
      final XppDom dpElem = displayParameters.getChild("displayPosition");
      if (dpElem != null) {
        displayPosition.x = (int) Float.parseFloat(dpElem.getAttribute("x"));
        displayPosition.y = (int) Float.parseFloat(dpElem.getAttribute("y"));
      }
      return;
    }
  }
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

final XppDom child1 = dom1.getChild(i);
final XppDom child2 = dom2.getChild(i);
final String child = child1.getName();
if (!names.containsKey(child)) {

代码示例来源:origin: x-stream/xstream

@Override
protected Object getChild(final int index) {
  return currentElement.getChild(index);
}

代码示例来源:origin: senbox-org/snap-desktop

void AssignDisplayParameters(final XppDom presentationXML) {
  XppDom nodeElem = null;
  for (XppDom elem : presentationXML.getChildren()) {
    final String id = elem.getAttribute("id");
    if (id != null && id.equals(node.getId())) {
      nodeElem = elem;
      break;
    }
  }
  if (nodeElem == null) {
    presentationXML.addChild(displayParameters);
  }
  XppDom dpElem = displayParameters.getChild("displayPosition");
  if (dpElem == null) {
    dpElem = new XppDom("displayPosition");
    displayParameters.addChild(dpElem);
  }
  dpElem.setAttribute("y", String.valueOf(displayPosition.getY()));
  dpElem.setAttribute("x", String.valueOf(displayPosition.getX()));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

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

protected Object getChild(int index) {
  return currentElement.getChild(index);
}

代码示例来源:origin: x-stream/xstream

@Override
public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

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

protected Object getChild(int index) {
  return currentElement.getChild(index);
}

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

public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

protected Object getChild(int index) {
  return currentElement.getChild(index);
}

代码示例来源:origin: com.haulmont.thirdparty/xstream

public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

代码示例来源:origin: com.haulmont.thirdparty/xstream

protected Object getChild(int index) {
  return currentElement.getChild(index);
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

protected Object getChild(int index) {
  return currentElement.getChild(index);
}

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

public String peekNextChild() {
  if (currentElement.getChildCount() == 0) {
    return null;
  }
  return decodeNode(currentElement.getChild(0).getName());
}

代码示例来源:origin: senbox-org/snap-desktop

private void setParamsToConfiguration(final XppDom config) {
  if (paramMap == null) return;
  final Set<String> keys = paramMap.keySet();                     // The set of keys in the map.
  for (String key : keys) {
    final Object value = paramMap.get(key);             // Get the value for that key.
    if (value == null) continue;
    XppDom xml = config.getChild(key);
    if (xml == null) {
      xml = new XppDom(key);
      config.addChild(xml);
    }
    xml.setValue(value.toString());
  }
}

代码示例来源:origin: bcdev/beam

public void testReadFromXMLWithAppData() throws Exception {
  String expectedXML =
      "<graph id=\"myOneNodeGraph\">\n" +
          "  <version>1.0</version>\n" +
          "  <node id=\"node1\">\n" +
          "    <operator>Op1</operator>\n" +
          "    <sources/>\n" +
          "  </node>\n" +
          " <applicationData id=\"foo\">\n" +
          "    <font>Big</font>\n" +
          "    <colour>red</colour>\n" +
          " </applicationData>\n" +
          " <applicationData id=\"bar\">\n" +
          "    <textmode>true</textmode>\n" +
          " </applicationData>\n" +
          "</graph>";
  StringReader reader = new StringReader(expectedXML);
  Graph graph = GraphIO.read(reader);
  XppDom fooData = graph.getApplicationData("foo");
  assertNotNull(fooData);
  assertEquals(2, fooData.getChildCount());
  assertEquals("Big", fooData.getChild("font").getValue());
  assertEquals("red", fooData.getChild("colour").getValue());
  XppDom barData = graph.getApplicationData("bar");
  assertNotNull(barData);
  assertEquals(1, barData.getChildCount());
  assertEquals("true", barData.getChild("textmode").getValue());
}

代码示例来源:origin: senbox-org/snap-desktop

@Test
  public void testEscapingXmlParameters() throws Exception {
    DefaultDomElement domElement = new DefaultDomElement("parameter");
    String unescapedString = "12 < 13 && 56 > 42 & \"true\" + 'a name'";
    String escapedString = "12 &lt; 13 &amp;&amp; 56 &gt; 42 &amp; &quot;true&quot; + &apos;a name&apos;";

    domElement.addChild(new DefaultDomElement("expression", unescapedString));
    DefaultDomElement withAttribute = new DefaultDomElement("withAttribute");
    withAttribute.setAttribute("attrib", unescapedString);
    domElement.addChild(withAttribute);

    OperatorMenu.escapeXmlElements(domElement);

    assertEquals(escapedString, domElement.getChild("expression").getValue());
    assertEquals(escapedString, domElement.getChild("withAttribute").getAttribute("attrib"));

    String xmlString = domElement.toXml();
    XppDom readDomElement = OperatorMenu.createDom(xmlString);

    assertEquals(unescapedString, readDomElement.getChild("expression").getValue());
    assertEquals(unescapedString, readDomElement.getChild("withAttribute").getAttribute("attrib"));
  }
}

相关文章