gpt4 book ai didi

org.hl7.fhir.utilities.xhtml.XhtmlNode.addText()方法的使用及代码示例

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

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

XhtmlNode.addText介绍

暂无

代码示例

代码示例来源:origin: jamesagnew/hapi-fhir

public XhtmlNode tx(String cnt) {
 return addText(cnt);
}
public XhtmlNode ah(String href) {

代码示例来源:origin: jamesagnew/hapi-fhir

public void commit(XhtmlNode xt) {
  if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 1 && newResources.containsKey(keyProps.get(0).getVar()) ) {
   xt.addText("new "+assignments.get(0).desc+" ("+keyProps.get(0).desc.substring(keyProps.get(0).desc.indexOf(".")+1)+")");
  } else if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 0) {
   xt.addText("new "+assignments.get(0).desc);
  } else {
   xt.addText(txt.toString());        
 }
 }
}

代码示例来源:origin: jamesagnew/hapi-fhir

private void addTextNode(XhtmlNode node, StringBuilder s)
{
 String t = isTrimWhitespace() ? s.toString().trim() : s.toString();
 if (t.length() > 0)
 {
  lastText = t;
  // System.out.println(t);
  node.addText(t).setLocation(markLocation());
  s.setLength(0);
 }
}
private void parseElementInner(XhtmlNode node, List<XhtmlNode> parents, NSMap nsm, boolean escaping) throws FHIRFormatError, IOException

代码示例来源:origin: jamesagnew/hapi-fhir

private XhtmlNode parseNode(Element node, String defaultNS) throws FHIRFormatError  {
 XhtmlNode res = new XhtmlNode(NodeType.Element);
 res.setName(node.getLocalName());
 defaultNS = checkNS(res, node, defaultNS);
 for (int i = 0; i < node.getAttributes().getLength(); i++) {
  Attr attr = (Attr) node.getAttributes().item(i);
  if (attributeIsOk(res.getName(), attr.getName(), attr.getValue()) && !attr.getLocalName().startsWith("xmlns"))
   res.getAttributes().put(attr.getName(), attr.getValue());
 }
 Node child = node.getFirstChild();
 while (child != null) {
  if (child.getNodeType() == Node.TEXT_NODE) {
   res.addText(child.getTextContent());
  } else if (child.getNodeType() == Node.COMMENT_NODE) {
   res.addComment(child.getTextContent());
  } else if (child.getNodeType() == Node.ELEMENT_NODE) {
   if (elementIsOk(child.getLocalName()))
    res.getChildNodes().add(parseNode((Element) child, defaultNS));
  } else
   throw new FHIRFormatError("Unhandled XHTML feature: "+Integer.toString(child.getNodeType())+descLoc());
  child = child.getNextSibling();
 }
 return res;
}

代码示例来源:origin: jamesagnew/hapi-fhir

private XhtmlNode parseNode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError  {
 XhtmlNode res = new XhtmlNode(NodeType.Element);
 res.setName(xpp.getName());
 
 for (int i = 0; i < xpp.getAttributeCount(); i++) {
  if (attributeIsOk(xpp.getName(), xpp.getAttributeName(i), xpp.getAttributeValue(i)))
  res.getAttributes().put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
 }
 int eventType = xpp.next();
 while (eventType != XmlPullParser.END_TAG) {
  if (eventType == XmlPullParser.TEXT) {
   res.addText(xpp.getText());
   xpp.next();
  } else if (eventType == XmlPullParser.COMMENT) {
   res.addComment(xpp.getText());
   xpp.next();
  } else if (eventType == XmlPullParser.START_TAG) {
   if (elementIsOk(xpp.getName()))
    res.getChildNodes().add(parseNode(xpp));
  } else
   throw new FHIRFormatError("Unhandled XHTML feature: "+Integer.toString(eventType)+descLoc());
  eventType = xpp.getEventType();
 }
 xpp.next();
 return res;
}

代码示例来源:origin: jamesagnew/hapi-fhir

case Node.TEXT_NODE: 
 if (!Utilities.isWhitespace(n.getTextContent()))
  xn.addText(n.getTextContent());
 return;
case Node.ELEMENT_NODE:

代码示例来源:origin: jamesagnew/hapi-fhir

private void renderRow(XhtmlNode table, Row r, int indent, List<Integer> indents, String imagePath, int border, Set<String> outputTracker) throws IOException  {
 XhtmlNode tr = table.addTag("tr");
 String color = "white";
 if (r.getColor() != null)
  color = r.getColor();
 tr.setAttribute("style", "border: " + border + "px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: "+color+";");
 boolean first = true;
 for (Cell t : r.getCells()) {
  renderCell(tr, t, "td", first ? r.getIcon() : null, first ? r.getHint() : null, first ? indents : null, !r.getSubRows().isEmpty(), first ? r.getAnchor() : null, color, r.getLineColor(), imagePath, border, outputTracker);
  first = false;
 }
 table.addText("\r\n");
 
 for (int i = 0; i < r.getSubRows().size(); i++) {
  Row c = r.getSubRows().get(i);
  List<Integer> ind = new ArrayList<Integer>();
  ind.addAll(indents);
  if (i == r.getSubRows().size() - 1) {
   ind.add(r.getLineColor()*2);
  } else {
   ind.add(r.getLineColor()*2+1);
  }
  renderRow(table, c, indent+1, ind, imagePath, border, outputTracker);
 }
}

代码示例来源:origin: jamesagnew/hapi-fhir

public StructureMap generateMapFromMappings(StructureDefinition sd) throws IOException, FHIRException {
 String id = getLogicalMappingId(sd);
 if (id == null) 
   return null;
 String prefix = ToolingExtensions.readStringExtension(sd,  ToolingExtensions.EXT_MAPPING_PREFIX);
 String suffix = ToolingExtensions.readStringExtension(sd,  ToolingExtensions.EXT_MAPPING_SUFFIX);
 if (prefix == null || suffix == null)
  return null;
 // we build this by text. Any element that has a mapping, we put it's mappings inside it....
 StringBuilder b = new StringBuilder();
 b.append(prefix);
 ElementDefinition root = sd.getSnapshot().getElementFirstRep();
 String m = getMapping(root, id);
 if (m != null)
  b.append(m+"\r\n");
 addChildMappings(b, id, "", sd, root, false);
 b.append("\r\n");
 b.append(suffix);
 b.append("\r\n");
 StructureMap map = parse(b.toString(), sd.getUrl());
 map.setId(tail(map.getUrl()));
 if (!map.hasStatus())
  map.setStatus(PublicationStatus.DRAFT);
 map.getText().setStatus(NarrativeStatus.GENERATED);
 map.getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
 map.getText().getDiv().addTag("pre").addText(render(map));
 return map;
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-utilities

public XhtmlNode tx(String cnt) {
 return addText(cnt);
}
public XhtmlNode ah(String href) {

代码示例来源:origin: jamesagnew/hapi-fhir

if (model.getDocoImg() != null)
 a.addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg());
a.addText(" "+translate("sd.doco", "Documentation for this format"));

代码示例来源:origin: jamesagnew/hapi-fhir

if (hint != null)
  img.setAttribute("title", hint);
 tc.addText(" ");
  if (!Utilities.noString(p.getHint()))
   a.setAttribute("title", p.getHint());
  a.addText(p.getText());
  addStyle(a, p);
 } else { 
   XhtmlNode s = addStyle(tc.addTag("span"), p);
   s.setAttribute("title", p.getHint());
   s.addText(p.getText());
  } else if (p.getStyle() != null) {
   XhtmlNode s = addStyle(tc.addTag("span"), p);
   s.addText(p.getText());
  } else
   tc.addText(p.getText());
 tc.addTag("a").setAttribute("name", nmTokenize(anchor)).addText(" ");
return tc;

代码示例来源:origin: jamesagnew/hapi-fhir

type.addType(pt);
 td.addText(prop.getPath()+"."+src.getElement()); 
 if (src.hasVariable())
  result.add(VariableMode.INPUT, src.getVariable(), new PropertyWithType(prop.getPath()+"."+src.getElement(), element, null, type));
return result;
} else {
 td.addText(prop.getPath()); // ditto!
 return vars.copy(optional, repeating);

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-dstu3

public void commit(XhtmlNode xt) {
  if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 1 && newResources.containsKey(keyProps.get(0).getVar()) ) {
   xt.addText("new "+assignments.get(0).desc+" ("+keyProps.get(0).desc.substring(keyProps.get(0).desc.indexOf(".")+1)+")");
  } else if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 0) {
   xt.addText("new "+assignments.get(0).desc);
  } else {
   xt.addText(txt.toString());        
 }
 }
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-r4

public void commit(XhtmlNode xt) {
  if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 1 && newResources.containsKey(keyProps.get(0).getVar()) ) {
   xt.addText("new "+assignments.get(0).desc+" ("+keyProps.get(0).desc.substring(keyProps.get(0).desc.indexOf(".")+1)+")");
  } else if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 0) {
   xt.addText("new "+assignments.get(0).desc);
  } else {
   xt.addText(txt.toString());        
 }
 }
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-utilities

private void addTextNode(XhtmlNode node, StringBuilder s)
{
 String t = isTrimWhitespace() ? s.toString().trim() : s.toString();
 if (t.length() > 0)
 {
  lastText = t;
  // System.out.println(t);
  node.addText(t).setLocation(markLocation());
  s.setLength(0);
 }
}
private void parseElementInner(XhtmlNode node, List<XhtmlNode> parents, NSMap nsm, boolean escaping) throws FHIRFormatError, IOException

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-utilities

private XhtmlNode parseNode(Element node, String defaultNS) throws FHIRFormatError  {
 XhtmlNode res = new XhtmlNode(NodeType.Element);
 res.setName(node.getLocalName());
 defaultNS = checkNS(res, node, defaultNS);
 for (int i = 0; i < node.getAttributes().getLength(); i++) {
  Attr attr = (Attr) node.getAttributes().item(i);
  if (attributeIsOk(res.getName(), attr.getName(), attr.getValue()) && !attr.getLocalName().startsWith("xmlns"))
   res.getAttributes().put(attr.getName(), attr.getValue());
 }
 Node child = node.getFirstChild();
 while (child != null) {
  if (child.getNodeType() == Node.TEXT_NODE) {
   res.addText(child.getTextContent());
  } else if (child.getNodeType() == Node.COMMENT_NODE) {
   res.addComment(child.getTextContent());
  } else if (child.getNodeType() == Node.ELEMENT_NODE) {
   if (elementIsOk(child.getLocalName()))
    res.getChildNodes().add(parseNode((Element) child, defaultNS));
  } else
   throw new FHIRFormatError("Unhandled XHTML feature: "+Integer.toString(child.getNodeType())+descLoc());
  child = child.getNextSibling();
 }
 return res;
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-dstu3

private void noteInput(VariablesForProfiling vars, StructureMapGroupInputComponent inp, VariableMode mode, XhtmlNode xs) {
 VariableForProfiling v = vars.get(mode, inp.getName());
 if (v != null)
  xs.addText("Input: "+v.property.getPath());
}

代码示例来源:origin: apache/ctakes

/**
* @param text -
* @return fhir narrative object containing the given text wrapped in an html "div".
*/
static public Narrative createNarrative( final String text ) {
 final Narrative narrative = new Narrative();
 narrative.setStatus( Narrative.NarrativeStatus.GENERATED );
 final XhtmlNode htmlNode = new XhtmlNode( NodeType.Element, "div" );
 htmlNode.addText( text );
 narrative.setDiv( htmlNode );
 return narrative;
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-utilities

private XhtmlNode parseNode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError  {
 XhtmlNode res = new XhtmlNode(NodeType.Element);
 res.setName(xpp.getName());
 
 for (int i = 0; i < xpp.getAttributeCount(); i++) {
  if (attributeIsOk(xpp.getName(), xpp.getAttributeName(i), xpp.getAttributeValue(i)))
  res.getAttributes().put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
 }
 int eventType = xpp.next();
 while (eventType != XmlPullParser.END_TAG) {
  if (eventType == XmlPullParser.TEXT) {
   res.addText(xpp.getText());
   xpp.next();
  } else if (eventType == XmlPullParser.COMMENT) {
   res.addComment(xpp.getText());
   xpp.next();
  } else if (eventType == XmlPullParser.START_TAG) {
   if (elementIsOk(xpp.getName()))
    res.getChildNodes().add(parseNode(xpp));
  } else
   throw new FHIRFormatError("Unhandled XHTML feature: "+Integer.toString(eventType)+descLoc());
  eventType = xpp.getEventType();
 }
 xpp.next();
 return res;
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-utilities

private void renderRow(XhtmlNode table, Row r, int indent, List<Integer> indents, String imagePath, int border, Set<String> outputTracker) throws IOException  {
 XhtmlNode tr = table.addTag("tr");
 String color = "white";
 if (r.getColor() != null)
  color = r.getColor();
 tr.setAttribute("style", "border: " + border + "px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: "+color+";");
 boolean first = true;
 for (Cell t : r.getCells()) {
  renderCell(tr, t, "td", first ? r.getIcon() : null, first ? r.getHint() : null, first ? indents : null, !r.getSubRows().isEmpty(), first ? r.getAnchor() : null, color, r.getLineColor(), imagePath, border, outputTracker);
  first = false;
 }
 table.addText("\r\n");
 
 for (int i = 0; i < r.getSubRows().size(); i++) {
  Row c = r.getSubRows().get(i);
  List<Integer> ind = new ArrayList<Integer>();
  ind.addAll(indents);
  if (i == r.getSubRows().size() - 1) {
   ind.add(r.getLineColor()*2);
  } else {
   ind.add(r.getLineColor()*2+1);
  }
  renderRow(table, c, indent+1, ind, imagePath, border, outputTracker);
 }
}

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