gpt4 book ai didi

org.bedework.util.xml.XmlUtil.getElementContent()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 14:15:40 32 4
gpt4 key购买 nike

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

XmlUtil.getElementContent介绍

[英]Return the content for the current element. All leading and trailing whitespace and embedded comments will be removed.

This is only intended for an element with no child elements.
[中]返回当前元素的内容。所有前导和尾随空格以及嵌入的注释都将被删除。
这只适用于没有子元素的元素。

代码示例

代码示例来源:origin: org.bedework/bw-util-xml

/** Return the content for the current element. All leading and trailing
 * whitespace and embedded comments will be removed.
 *
 * <p>This is only intended for an element with no child elements.
 *
 * @param el
 * @return element content
 * @throws SAXException
 */
public static String getElementContent(final Element el) throws SAXException {
 return getElementContent(el, true);
}

代码示例来源:origin: org.bedework/bw-util-xml

/** Return true if the current element has non zero length content.
 *
 * @param el
 * @return boolean
 * @throws SAXException
 */
public static boolean hasContent(final Element el) throws SAXException {
 String s = getElementContent(el);
 return (s != null) && (s.length() > 0);
}

代码示例来源:origin: org.bedework/bw-caldav-util

private int getIntContent(final Element nd) throws Throwable {
 String val = XmlUtil.getElementContent(nd);
 return Integer.valueOf(val);
}

代码示例来源:origin: org.bedework/bw-util-dav

/**
 * @param el
 * @return String
 * @throws Throwable
 */
public static String getElementContent(final Element el) throws Throwable {
 try {
  return XmlUtil.getElementContent(el);
 } catch (Throwable t) {
  //if (debug) {
  //  getLogger().error(this, t);
  //}
  throw new Exception(t.getMessage());
 }
}

代码示例来源:origin: org.bedework/bw-util2-calendar

protected String getElementContent(final Element el) throws ParserException {
 try {
  return XmlUtil.getElementContent(el);
 } catch (Throwable t) {
  throw new ParserException(t.getMessage(), 0);
 }
}

代码示例来源:origin: org.bedework/bw-caldav-util

private String parseHref(final Element nd) throws Throwable {
 expect(nd, WebdavTags.href);
 return XmlUtil.getElementContent(nd);
}

代码示例来源:origin: org.bedework/bw-util-xml

private Object simpleValue(final Class cl,
              final Element el) throws Throwable {
 if (!XmlUtil.hasChildren(el)) {
  /* A primitive value for which we should have a setter */
  final String ndval = XmlUtil.getElementContent(el);
  if (cl.getName().equals("java.lang.String")) {
   return ndval;
  }
  if (cl.getName().equals("int") ||
    cl.getName().equals("java.lang.Integer")) {
   return Integer.valueOf(ndval);
  }
  if (cl.getName().equals("long") ||
    cl.getName().equals("java.lang.Long")) {
   return Long.valueOf(ndval);
  }
  if (cl.getName().equals("boolean") ||
    cl.getName().equals("java.lang.Boolean")) {
   return Boolean.valueOf(ndval);
  }
  // XXX Should do byte, char, short, float, and double.
  return cb.simpleValue(cl, ndval);
 }
 // Complex value
 return null;
}

代码示例来源:origin: org.bedework/bw-util-config

final String ndval = XmlUtil.getElementContent(el);
if (ndval.length() == 0) {
 return null;

代码示例来源:origin: org.bedework/bw-caldav-util

ProcessorType parseProcessor(final Element nd) throws Throwable {
 final ProcessorType pt = new ProcessorType();
 final Element[] els = XmlUtil.getElementsArray(nd);
 final int len = els.length;
 int pos = 0;
 if ((len > pos) &&
     XmlUtil.nodeMatches(els[pos], BedeworkServerTags.type)) {
  pt.setType(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 if ((els.length > pos) &&
     XmlUtil.nodeMatches(els[pos], dtstampTag)) {
  pt.setDtstamp(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 if ((len > pos) &&
     XmlUtil.nodeMatches(els[pos], WebdavTags.status)) {
  pt.setStatus(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 return pt;
}

代码示例来源:origin: org.bedework/bw-caldav-util

private ChangedByType parseChangedBy(final Element nd) throws Throwable {
 ChangedByType cb = new ChangedByType();
 Element[] els = XmlUtil.getElementsArray(nd);
 int pos;
 if (XmlUtil.nodeMatches(els[0], AppleServerTags.commonName)) {
  cb.setCommonName(XmlUtil.getElementContent(els[0]));
  pos = 1;
 } else {
  expect(els[0], AppleServerTags.firstName);
  cb.setFirstName(XmlUtil.getElementContent(els[0]));
  expect(els[1], AppleServerTags.lastName);
  cb.setLastName(XmlUtil.getElementContent(els[1]));
  pos = 2;
 }
 if (XmlUtil.nodeMatches(els[pos], AppleServerTags.dtstamp)) {
  cb.setDtstamp(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 cb.setHref(parseHref(els[pos]));
 return cb;
}

代码示例来源:origin: org.bedework/bw-caldav-util

private ChangedParameterType parseChangedParameter(final Element nd) throws Throwable {
 ChangedParameterType cp = new ChangedParameterType();
 cp.setName(XmlUtil.getAttrVal(nd, "name"));
 Element[] els = XmlUtil.getElementsArray(nd);
 int pos = 0;
 if ((els.length > pos) &&
  XmlUtil.nodeMatches(els[pos], BedeworkServerTags.dataFrom)) {
  cp.setDataFrom(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 if ((els.length > pos) &&
  XmlUtil.nodeMatches(els[pos], BedeworkServerTags.dataTo)) {
  cp.setDataTo(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 if (els.length > pos) {
  throw badNotification(els[pos]);
 }
 return cp;
}

代码示例来源:origin: org.bedework/bw-util2-calendar

private void processProperty(final Element el,
               final BuildState bs) throws ParserException {
 try {
  bs.getContentHandler().startProperty(el.getLocalName());
  for (Element e: XmlUtil.getElements(el)) {
   if (XmlUtil.nodeMatches(e, XcalTags.parameters)) {
    for (Element par: XmlUtil.getElements(e)) {
     bs.getContentHandler().parameter(par.getLocalName(),
                XmlUtil.getElementContent(par));
    }
   }
   if (!processValue(e, bs)) {
    throw new ParserException("Bad property " + el, 0);
   }
  }
  bs.getContentHandler().endProperty(el.getLocalName());
 } catch (SAXException e) {
  throw new ParserException(e.getMessage(), 0, e);
 } catch (URISyntaxException e) {
  throw new ParserException(e.getMessage(), 0, e);
 }
}

代码示例来源:origin: org.bedework/bw-caldav-util

dd.setDeletedDisplayname(XmlUtil.getElementContent(els[pos]));
 pos++;
dd.setDeletedComponent(XmlUtil.getElementContent(els[pos]));
dd.setDeletedSummary(XmlUtil.getElementContent(els[pos]));
 dd.setDeletedNextInstance(XmlUtil.getElementContent(els[pos]));
 dd.setDeletedNextInstanceTzid(XmlUtil.getAttrVal(els[pos], "tzid"));
 pos++;

代码示例来源:origin: org.bedework/bw-caldav-util

private ChangedPropertyType parseChangedProperty(final Element nd) throws Throwable {
 ChangedPropertyType cp = new ChangedPropertyType();
 cp.setName(XmlUtil.getAttrVal(nd, "name"));
 Element[] els = XmlUtil.getElementsArray(nd);
 int pos = 0;
 while ((els.length > pos) &&
  XmlUtil.nodeMatches(els[pos], AppleServerTags.changedParameter)) {
  cp.getChangedParameter().add(parseChangedParameter(els[pos]));
  pos++;
 }
 if ((els.length > pos) &&
  XmlUtil.nodeMatches(els[pos], BedeworkServerTags.dataFrom)) {
  cp.setDataFrom(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 if ((els.length > pos) &&
  XmlUtil.nodeMatches(els[pos], BedeworkServerTags.dataTo)) {
  cp.setDataTo(XmlUtil.getElementContent(els[pos]));
  pos++;
 }
 if (els.length > pos) {
  throw badNotification(els[pos]);
 }
 return cp;
}

代码示例来源:origin: org.bedework/bw-caldav-util

private OrganizerType parseOrganizer(final Node nd) throws Throwable {
 OrganizerType o = new OrganizerType();
 Element[] els = XmlUtil.getElementsArray(nd);
 for (Element curnode: els) {
  if (XmlUtil.nodeMatches(curnode, hrefTag)) {
   if (o.getHref() != null) {
    throw badOrganizer();
   }
   o.setHref(XmlUtil.getElementContent(curnode));
   continue;
  }
  if (XmlUtil.nodeMatches(curnode, commonNameTag)) {
   if (o.getCommonName() != null) {
    throw badOrganizer();
   }
   o.setCommonName(XmlUtil.getElementContent(curnode));
   continue;
  }
  throw badOrganizer();
 }
 return o;
}

代码示例来源:origin: org.bedework/bw-caldav-util

private RemoveType parseRemove(final Node nd) throws Throwable {
 RemoveType r = new RemoveType();
 Element[] els = XmlUtil.getElementsArray(nd);
 for (Element curnode: els) {
  if (XmlUtil.nodeMatches(curnode, hrefTag)) {
   if (r.getHref() != null) {
    throw badRemove();
   }
   r.setHref(XmlUtil.getElementContent(curnode));
   continue;
  }
  throw badRemove();
 }
 if (r.getHref() == null) {
  throw badRemove();
 }
 return r;
}

代码示例来源:origin: org.bedework/bw-caldav-util

XmlUtil.getElementContent(curnode)));
continue;

代码示例来源:origin: org.bedework/bw-caldav-util

} else {
 expect(els[pos], AppleServerTags.recurrenceid);
 r.setRecurrenceid(XmlUtil.getElementContent(els[pos]));
 pos++;

代码示例来源:origin: org.bedework/bw-caldav-util

private String parseHostUrl(final Node nd) throws WebdavException {
 try {
  if (!XmlUtil.nodeMatches(nd, hosturlTag)) {
   throw new WebdavBadRequest("Expected " + hosturlTag);
  }
  String href = null;
  Element[] els = XmlUtil.getElementsArray(nd);
  for (Element curnode: els) {
   if (XmlUtil.nodeMatches(curnode, hrefTag)) {
    if (href != null) {
     throw badHostUrl();
    }
    href = XmlUtil.getElementContent(curnode);
    continue;
   }
   throw badHostUrl();
  }
  if (href == null) {
   throw badHostUrl();
  }
  return href;
 } catch (SAXException e) {
  throw parseException(e);
 } catch (WebdavException wde) {
  throw wde;
 } catch (Throwable t) {
  throw new WebdavException(t);
 }
}

代码示例来源:origin: org.bedework/bw-caldav-util

n.setDtstamp(XmlUtil.getElementContent(curnode));
} else {
 final BaseNotificationParser bnp = parsers.get(XmlUtil.fromNode(curnode));

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