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

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

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

XhtmlNode.getName介绍

暂无

代码示例

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

private void processFootNodeRef(IXMLWriter xml, XhtmlNode n) {
 throw new Error("element "+n.getName()+" not handled yet");
}

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

private void processTFoot(IXMLWriter xml, XhtmlNode n) {
 throw new Error("element "+n.getName()+" not handled yet");
}

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

private void processFootNote(IXMLWriter xml, XhtmlNode n) {
 throw new Error("element "+n.getName()+" not handled yet");
}

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

public XhtmlNode getElement(String name) {
 for (XhtmlNode n : childNodes)
  if (n.getNodeType() == NodeType.Element && name.equals(n.getName())) 
   return n;
 return null;
}

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

private void writeElement(String indent, XhtmlNode node, boolean noPrettyOverride) throws IOException  {
 if (!pretty || noPrettyOverride)
  indent = "";
 // html self closing tags: http://xahlee.info/js/html5_non-closing_tag.html 
 if (node.getChildNodes().size() == 0 && (xml || Utilities.existsInList(node.getName(), "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr")))
  dst.append(indent + "<" + node.getName() + attributes(node) + "/>" + (pretty && !noPrettyOverride ? "\r\n" : ""));
 else {
 boolean act = node.allChildrenAreText();
 if (act || !pretty ||  noPrettyOverride)
  dst.append(indent + "<" + node.getName() + attributes(node)+">");
 else
  dst.append(indent + "<" + node.getName() + attributes(node) + ">\r\n");
 if (node.getName() == "head" && node.getElement("meta") == null)
  dst.append(indent + "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>" + (pretty && !noPrettyOverride ? "\r\n" : ""));
 for (XhtmlNode c : node.getChildNodes())
  writeNode(indent + "  ", c, noPrettyOverride || node.isNoPretty());
 if (act)
  dst.append("</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : ""));
 else if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text)
  dst.append((pretty && !noPrettyOverride ? "\r\n"+ indent : "")  + "</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : ""));
 else
  dst.append(indent + "</" + node.getName() + ">" + (pretty && !noPrettyOverride ? "\r\n" : ""));
 }
}

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

if (x.getName().equals("li")) {
 b.append("* ");
 lastWS = true;
 lastWS = composePlainText(n, b, lastWS);
if (x.getName().equals("p")) {
 b.append("\r\n\r\n");
 lastWS = true;
if (x.getName().equals("br") || x.getName().equals("li")) {
 b.append("\r\n");
 lastWS = true;

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

list.add(new Piece(null, c.getContent(), null));
else if (c.getNodeType() == NodeType.Element) {
 if (c.getName().equals("a")) {
  list.add(new Piece(c.getAttribute("href"), c.allText(), c.getAttribute("title")));                    
 } else if (c.getName().equals("b") || c.getName().equals("em") || c.getName().equals("strong")) {
  list.add(new Piece(null, c.allText(), null).setStyle("font-face: bold"));                    
 } else if (c.getName().equals("code")) {
  list.add(new Piece(null, c.allText(), null).setStyle("padding: 2px 4px; color: #005c00; background-color: #f9f2f4; white-space: nowrap; border-radius: 4px"));                    
 } else if (c.getName().equals("i")) {
  list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic"));
 } else if (c.getName().equals("pre")) {
  Piece p = new Piece(c.getName()).setStyle("white-space: pre; font-family: courier");
  list.add(p);
  p.getChildren().addAll(c.getChildNodes());
 } else if (c.getName().equals("ul") || c.getName().equals("ol")) {
  Piece p = new Piece(c.getName());
  list.add(p);
  p.getChildren().addAll(c.getChildNodes());
 } else if (c.getName().equals("i")) {
  list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic"));                    
 } else if (c.getName().equals("h1")||c.getName().equals("h2")||c.getName().equals("h3")||c.getName().equals("h4")) {
  Piece p = new Piece(c.getName());
  list.add(p);
  p.getChildren().addAll(c.getChildNodes());
 } else if (c.getName().equals("br")) {
  list.add(new Piece(c.getName()));
 } else {
  throw new Error("Not handled yet: "+c.getName());

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

return;
case Element:
 if (n.getName().equals("br"))
  processBreak(xml, n);
 else if (n.getName().equals("h2"))
  processCaption(xml, n);
 else if (n.getName().equals("col"))
  processCol(xml, n);
 else if (n.getName().equals("colgroup"))
  processColGroup(xml, n);
 else if (n.getName().equals("span"))
  processContent(xml, n);
 else if (n.getName().equals("footnote"))
  processFootNote(xml, n);
 else if (n.getName().equals("footnoteRef"))
  processFootNodeRef(xml, n);
 else if (n.getName().equals("li"))
  processItem(xml, n);
 else if (n.getName().equals("linkHtml"))
  processlinkHtml(xml, n);
 else if (n.getName().equals("ul") || n.getName().equals("ol"))
  processList(xml, n);
 else if (n.getName().equals("p"))
  processParagraph(xml, n);
 else if (n.getName().equals("img"))
  processRenderMultiMedia(xml, n);
 else if (n.getName().equals("sub"))
  processSub(xml, n);
 else if (n.getName().equals("sup"))

代码示例来源: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 void appendChild(Element e, XhtmlNode node) {
 if (node.getNodeType() == NodeType.Comment)
  e.appendChild(e.getOwnerDocument().createComment(node.getContent()));
 else if (node.getNodeType() == NodeType.DocType)
  throw new Error("not done yet");
 else if (node.getNodeType() == NodeType.Instruction)
  e.appendChild(e.getOwnerDocument().createProcessingInstruction("", node.getContent()));
 else if (node.getNodeType() == NodeType.Text)
  e.appendChild(e.getOwnerDocument().createTextNode(node.getContent()));
 else if (node.getNodeType() == NodeType.Element) {
  Element child = e.getOwnerDocument().createElementNS(XHTML_NS, node.getName());
  e.appendChild(child);
  for (XhtmlNode c : node.getChildNodes()) {
   appendChild(child, c);
  }
 } else
  throw new Error("Unknown node type: "+node.getNodeType().toString());
}

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

private void composeElement(IXMLWriter xml, XhtmlNode node, boolean noPrettyOverride) throws IOException  {
 for (String n : node.getAttributes().keySet()) {
  if (n.equals("xmlns")) 
    xml.setDefaultNamespace(node.getAttributes().get(n));
  else if (n.startsWith("xmlns:")) 
    xml.namespace(n.substring(6), node.getAttributes().get(n));
  else
  xml.attribute(n, node.getAttributes().get(n));
 }
 xml.enter(XHTML_NS, node.getName());
 for (XhtmlNode n : node.getChildNodes())
  compose(xml, n, noPrettyOverride || node.isNoPretty());
 xml.exit(XHTML_NS, node.getName());
}

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

private void checkInnerNames(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) {
  for (XhtmlNode node : list) {
    if (node.getNodeType() == NodeType.Element) {
      rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(), 
          "p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong",
          "small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup",
          "ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td",
          "code", "samp", "img", "map", "area"
          ), "Illegal element name in the XHTML ('"+node.getName()+"')");
      for (String an : node.getAttributes().keySet()) {
        boolean ok = an.startsWith("xmlns") || Utilities.existsInList(an, 
            "title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex",
            // tables
            "span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") ||
            Utilities.existsInList(node.getName()+"."+an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite",
                "a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src",
                "img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape",
                "area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border",
                "table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space"
                );
        if (!ok)
          rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Illegal attribute name in the XHTML ('"+an+"' on '"+node.getName()+"')");
      }
      checkInnerNames(errors, e, path, node.getChildNodes());
    }
  }    
}

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

private void checkInnerNames(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) {
 for (XhtmlNode node : list) {
  if (node.getNodeType() == NodeType.Element) {
   rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(), 
     "p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong",
     "small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup",
     "ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td",
     "code", "samp", "img", "map", "area"
     ), "Illegal element name in the XHTML ('"+node.getName()+"')");
   for (String an : node.getAttributes().keySet()) {
    boolean ok = an.startsWith("xmlns") || Utilities.existsInList(an, 
      "title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex",
      // tables
      "span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") ||
      Utilities.existsInList(node.getName()+"."+an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite",
        "a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src",
        "img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape",
        "area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border",
        "table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space"
        );
    if (!ok)
     rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Illegal attribute name in the XHTML ('"+an+"' on '"+node.getName()+"')");
   }
   checkInnerNames(errors, e, path, node.getChildNodes());
  }
 }    
}

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

private void checkInnerNames(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) {
 for (XhtmlNode node : list) {
  if (node.getNodeType() == NodeType.Element) {
   rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(),
     "p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong",
     "small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup",
     "ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td",
     "code", "samp", "img", "map", "area"
     ), "Illegal element name in the XHTML ('"+node.getName()+"')");
   for (String an : node.getAttributes().keySet()) {
    boolean ok = an.startsWith("xmlns") || Utilities.existsInList(an,
      "title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex",
      // tables
      "span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") ||
      Utilities.existsInList(node.getName()+"."+an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite",
        "a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src",
        "img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape",
        "area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border",
        "table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space", "td.nowrap"
        );
    if (!ok)
     rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Illegal attribute name in the XHTML ('"+an+"' on '"+node.getName()+"')");
   }
   checkInnerNames(errors, e, path, node.getChildNodes());
  }
 }
}

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

private void processList(IXMLWriter xml, XhtmlNode n) throws IOException, FHIRException {
 if (n.getName().equals("ol"))
  xml.attribute("listType", "ordered");
 else
  xml.attribute("listType", "unordered");
 processAttributes(n, xml, "id", "language", "styleCode");
 xml.enter("list");
 processChildren(xml, n);
 xml.exit("list");
}

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

readChar();
QName n = new QName(readToTagEnd());
if (node.getName().equals(n.getName()))
 return;
else
  throw new FHIRFormatError("Malformed XHTML: Found \"</"+n.getName()+">\" expecting \"</"+node.getName()+">\""+descLoc());
 for (int i = parents.size() - 1; i >= 0; i--)
  if (parents.get(i).getName().equals(n))
   unwindPoint = parents.get(i);
throw new FHIRFormatError("Unable to Parse HTML - node '" + node.getName() + "' has unexpected content '"+peekChar()+"' (last text = '"+lastText+"'"+descLoc());

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

if (name.length() == 0)
 throw new FHIRFormatError("Unable to read attribute on <"+node.getName()+">"+descLoc());
else if (peekChar() != '=')
 throw new FHIRFormatError("Unable to read attribute '"+name+"' value on <"+node.getName()+">"+descLoc());

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

rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div");

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

rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div");

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

rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div");

相关文章