gpt4 book ai didi

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

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

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

XhtmlNode.getAttributes介绍

暂无

代码示例

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

public String getAttribute(String name) {
 return getAttributes().get(name);
}

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

public XhtmlNode setAttribute(String name, String value) {
 getAttributes().put(name, value);
 return this;    
}

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

public boolean hasAttribute(String name) {
 return getAttributes().containsKey(name);
}

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

private String checkNS(XhtmlNode res, Element node, String defaultNS) {
 if (!validatorMode)
  return null;
 String ns = node.getNamespaceURI();
 if (ns == null)
  return null;
 if (!ns.equals(defaultNS)) {
  res.getAttributes().put("xmlns", ns);
  return ns;
 }
 return defaultNS;
}

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

private String attributes(XhtmlNode node) {
 StringBuilder s = new StringBuilder();
 for (String n : node.getAttributes().keySet())
  s.append(" " + n + "=\"" + escapeHtml(node.getAttributes().get(n)) + "\"");
 return s.toString();
}

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

public XhtmlNode parseHtmlNode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError  {
 XhtmlNode res = parseNode(xpp);
 if (res.getNsDecl() == null)
  res.getAttributes().put("xmlns", XHTML_NS);
 return res;
}
private XhtmlNode parseNode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError  {

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

public XhtmlNode parseHtmlNode(Element node, String defaultNS) throws FHIRFormatError  {
 XhtmlNode res = parseNode(node, defaultNS);
 if (res.getNsDecl() == null)
  res.getAttributes().put("xmlns", XHTML_NS);
 return res;
}

代码示例来源: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 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

NSMap result = new NSMap(nsm);
List<String> nsattrs = new ArrayList<String>();
for (String an : node.getAttributes().keySet()) {
 if (an.equals("xmlns")) {
  result.def(node.getAttribute(an));
 node.getAttributes().remove(s);
if (n.hasNs()) {
 String nns = result.get(n.getNs());
 if (!nns.equals(result.def())) {
  node.getAttributes().put("xmlns", nns);
  result.def(nns);
 node.getAttributes().put("xmlns", result.def());

代码示例来源: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

node.getAttributes().put(name, null);
else if (peekChar() != '=')
  readChar();
 if (peekChar() == '"' || peekChar() == '\'')
  node.getAttributes().put(name, parseAttributeValue(readChar()));
 else
  node.getAttributes().put(name, parseAttributeValue('\0'));

代码示例来源: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: ca.uhn.hapi.fhir/hapi-fhir-utilities

public XhtmlNode setAttribute(String name, String value) {
 getAttributes().put(name, value);
 return this;    
}

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

private String checkNS(XhtmlNode res, Element node, String defaultNS) {
 if (!validatorMode)
  return null;
 String ns = node.getNamespaceURI();
 if (ns == null)
  return null;
 if (!ns.equals(defaultNS)) {
  res.getAttributes().put("xmlns", ns);
  return ns;
 }
 return defaultNS;
}

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

private String attributes(XhtmlNode node) {
 StringBuilder s = new StringBuilder();
 for (String n : node.getAttributes().keySet())
  s.append(" " + n + "=\"" + escapeHtml(node.getAttributes().get(n)) + "\"");
 return s.toString();
}

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

public XhtmlNode parseHtmlNode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError  {
 XhtmlNode res = parseNode(xpp);
 if (res.getNsDecl() == null)
  res.getAttributes().put("xmlns", XHTML_NS);
 return res;
}
private XhtmlNode parseNode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError  {

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

public XhtmlNode parseHtmlNode(Element node, String defaultNS) throws FHIRFormatError  {
 XhtmlNode res = parseNode(node, defaultNS);
 if (res.getNsDecl() == null)
  res.getAttributes().put("xmlns", XHTML_NS);
 return res;
}

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