gpt4 book ai didi

org.sweble.wikitext.parser.nodes.WtXmlElement类的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 15:35:05 24 4
gpt4 key购买 nike

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

WtXmlElement介绍

暂无

代码示例

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

public void visit(WtXmlElement n)
{
  p.print('<');
  p.print(n.getName());
  dispatch(n.getXmlAttributes());
  p.print(n.hasBody() ? ">" : " />");
  if (n.hasBody())
  {
    dispatch(n.getBody());
    p.print("</");
    p.print(n.getName());
    p.print('>');
  }
}

代码示例来源:origin: marcusklang/wikiforia

public void visit(WtXmlElement e)
{
  if (e.getName().equalsIgnoreCase("br") || e.getName().equalsIgnoreCase("gallery") || e.getName().equalsIgnoreCase("imagemap"))
  {
  }
  else
  {
    iterate(e.getBody());
  }
}

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

@Override
protected Object getValue(int index)
{
  switch (index - getSuperPropertyCount())
  {
    case 0:
      return WtXmlElement.this.getName();
    default:
      return super.getValue(index);
  }
}

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

@Override
  protected Object setValue(int index, Object value)
  {
    switch (index - getSuperPropertyCount())
    {
      case 0:
      {
        String old = WtXmlElement.this.getName();
        WtXmlElement.this.setName((String) value);
        return old;
      }
      default:
        return super.setValue(index, value);
    }
  }
};

代码示例来源:origin: org.sweble.wom3/sweble-wom3-swc-adapter

private Wom3ElementNode womFromXmlElement(WtXmlElement n, String womName)
{
  Wom3ElementNode womElement = genPushWom(womName);
  {
    appendRtd(womElement, n, 0);
    dispatchAppend(womElement, n.getXmlAttributes());
    appendRtd(womElement, n, 1);
    if (n.hasBody())
      processChildrenNoPush(n.getBody(), womElement);
    appendRtd(womElement, n, 2);
  }
  return pop(womElement);
}

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

public final boolean hasBody()
{
  return getBody() != WtBody.NO_BODY;
}

代码示例来源:origin: org.sweble.wikitext/swc-engine

@Override
  public <T extends WtXmlElement> T addCssClass(T elem, String cssClass)
  {
    if (elem.getXmlAttributes().isEmpty())
      elem.setXmlAttributes(attrs(list()));

    for (WtNode attr : elem.getXmlAttributes())
    {
      if (attr == null || !(attr instanceof WtXmlAttribute))
        continue;

      WtXmlAttribute a = (WtXmlAttribute) attr;
      if (!a.getName().equals("class"))
        continue;

      if (!a.hasValue())
        a.setValue(value(list()));
      a.getValue().add(text(" " + cssClass));
    }

    return elem;
  }
}

代码示例来源:origin: org.sweble.wom3/sweble-wom3-swc-adapter

public Wom3ElementNode visit(WtXmlElement n)
{
  String lowercaseName = n.getName().toLowerCase();
  HtmlElement elementType = xhtmlElems.get(lowercaseName);
  if (elementType != null)
  {
    return convertXmlElementToNative(n, elementType);
  }
  else
  {
    return convertGenericXmlElement(n);
  }
}

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

private void setElementBody(
    ElementType elementType,
    int nodeType,
    WtNamedXmlElement template,
    WtXmlElement element)
{
  switch (elementType)
  {
    case AREA:
    case BR:
    case IMG:
    case HR:
    case COL:
      if (nodeType != NT_XML_EMPTY_TAG)
        tb.error((WtNode) template, "12.2.4 Element should be an empty tag!");
      // Doesn't need body
      break;
    default:
      if ((nodeType == NT_XML_EMPTY_TAG)
          || (nodeType == NT_XML_ELEMENT && !((WtXmlElement) template).hasBody()))
        tb.error((WtNode) template, "12.2.4 Element should not be an empty tag!");
      if (nodeType != NT_XML_EMPTY_TAG)
        element.setBody(createEmptyBody());
      break;
  }
}

代码示例来源:origin: sweble/sweble-wikitext

private void copyStartTagRtd(
    boolean suppressRtd,
    WtXmlElement newElement,
    WtRtData rtd)
{
  if ((!suppressRtd && (rtd != null)))
    newElement.setRtd(
        rtd.getField(0),
        RtData.SEP,
        rtd.getField(1),
        RtData.SEP);
}

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

static boolean isSameFormattingElement(WtNode e0, WtNode e1)
{
  if (e0 == e1)
    return true;
  ElementType t0 = getNodeType(e0);
  ElementType t1 = getNodeType(e1);
  if (t0 != t1)
    return false;
  if (e0.getNodeType() == WtNode.NT_XML_ELEMENT)
  {
    WtNodeList a0 = ((WtXmlElement) e0).getXmlAttributes();
    if (e1.getNodeType() == WtNode.NT_XML_ELEMENT)
    {
      return isSameAttributes(
          a0, ((WtXmlElement) e1).getXmlAttributes());
    }
    else if (a0 != null && !a0.isEmpty())
      return false;
  }
  else
  {
    if (e1.getNodeType() == WtNode.NT_XML_ELEMENT)
    {
      WtNodeList a1 = ((WtXmlElement) e1).getXmlAttributes();
      if (a1 != null && !a1.isEmpty())
        return false;
    }
  }
  return true;
}

代码示例来源:origin: marcusklang/wikiforia

public void visit(WtXmlElement e)
{
  if (e.getName().equalsIgnoreCase("br") || e.getName().equalsIgnoreCase("gallery") || e.getName().equalsIgnoreCase("imagemap"))
  {
  }
  else
  {
    iterate(e.getBody());
  }
}

代码示例来源:origin: sweble/sweble-wikitext

private Wom3ElementNode womFromXmlElement(WtXmlElement n, String womName)
{
  Wom3ElementNode womElement = genPushWom(womName);
  {
    appendRtd(womElement, n, 0);
    dispatchAppend(womElement, n.getXmlAttributes());
    appendRtd(womElement, n, 1);
    if (n.hasBody())
      processChildrenNoPush(n.getBody(), womElement);
    appendRtd(womElement, n, 2);
  }
  return pop(womElement);
}

代码示例来源:origin: sweble/sweble-wikitext

public final boolean hasBody()
{
  return getBody() != WtBody.NO_BODY;
}

代码示例来源:origin: sweble/sweble-wikitext

@Override
  protected Object setValue(int index, Object value)
  {
    switch (index - getSuperPropertyCount())
    {
      case 0:
      {
        String old = WtXmlElement.this.getName();
        WtXmlElement.this.setName((String) value);
        return old;
      }
      default:
        return super.setValue(index, value);
    }
  }
};

代码示例来源:origin: sweble/sweble-wikitext

@Override
protected Object getValue(int index)
{
  switch (index - getSuperPropertyCount())
  {
    case 0:
      return WtXmlElement.this.getName();
    default:
      return super.getValue(index);
  }
}

代码示例来源:origin: sweble/sweble-wikitext

@Override
  public <T extends WtXmlElement> T addCssClass(T elem, String cssClass)
  {
    if (elem.getXmlAttributes().isEmpty())
      elem.setXmlAttributes(attrs(list()));

    for (WtNode attr : elem.getXmlAttributes())
    {
      if (attr == null || !(attr instanceof WtXmlAttribute))
        continue;

      WtXmlAttribute a = (WtXmlAttribute) attr;
      if (!a.getName().equals("class"))
        continue;

      if (!a.hasValue())
        a.setValue(value(list()));
      a.getValue().add(text(" " + cssClass));
    }

    return elem;
  }
}

代码示例来源:origin: sweble/sweble-wikitext

public Wom3ElementNode visit(WtXmlElement n)
{
  String lowercaseName = n.getName().toLowerCase();
  HtmlElement elementType = xhtmlElems.get(lowercaseName);
  if (elementType != null)
  {
    return convertXmlElementToNative(n, elementType);
  }
  else
  {
    return convertGenericXmlElement(n);
  }
}

代码示例来源:origin: sweble/sweble-wikitext

private void setElementBody(
    ElementType elementType,
    int nodeType,
    WtNamedXmlElement template,
    WtXmlElement element)
{
  switch (elementType)
  {
    case AREA:
    case BR:
    case IMG:
    case HR:
    case COL:
      if (nodeType != NT_XML_EMPTY_TAG)
        tb.error((WtNode) template, "12.2.4 Element should be an empty tag!");
      // Doesn't need body
      break;
    default:
      if ((nodeType == NT_XML_EMPTY_TAG)
          || (nodeType == NT_XML_ELEMENT && !((WtXmlElement) template).hasBody()))
        tb.error((WtNode) template, "12.2.4 Element should not be an empty tag!");
      if (nodeType != NT_XML_EMPTY_TAG)
        element.setBody(createEmptyBody());
      break;
  }
}

代码示例来源:origin: org.sweble.wikitext/swc-parser-lazy

private void copyStartTagRtd(
    boolean suppressRtd,
    WtXmlElement newElement,
    WtRtData rtd)
{
  if ((!suppressRtd && (rtd != null)))
    newElement.setRtd(
        rtd.getField(0),
        RtData.SEP,
        rtd.getField(1),
        RtData.SEP);
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com