本文整理了Java中org.hl7.fhir.utilities.xhtml.XhtmlNode.<init>()
方法的一些代码示例,展示了XhtmlNode.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XhtmlNode.<init>()
方法的具体详情如下:
包路径:org.hl7.fhir.utilities.xhtml.XhtmlNode
类名称:XhtmlNode
方法名:<init>
暂无
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addInstruction(String content)
{
if (!(nodeType == NodeType.Document))
throw new Error("Wrong node type");
XhtmlNode node = new XhtmlNode(NodeType.Instruction);
node.setContent(content);
childNodes.add(node);
return node;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addComment(String content)
{
if (!(nodeType == NodeType.Element || nodeType == NodeType.Document))
throw new Error("Wrong node type");
XhtmlNode node = new XhtmlNode(NodeType.Comment);
node.setContent(content);
childNodes.add(node);
return node;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode copy() {
XhtmlNode dst = new XhtmlNode(nodeType);
dst.name = name;
for (String n : attributes.keySet()) {
dst.attributes.put(n, attributes.get(n));
}
for (XhtmlNode n : childNodes)
dst.childNodes.add(n.copy());
dst.content = content;
return dst;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addText(String content)
{
if (!(nodeType == NodeType.Element || nodeType == NodeType.Document))
throw new Error("Wrong node type");
if (content != null) {
XhtmlNode node = new XhtmlNode(NodeType.Text);
node.setContent(content);
childNodes.add(node);
return node;
} else
return null;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addText(int index, String content)
{
if (!(nodeType == NodeType.Element || nodeType == NodeType.Document))
throw new Error("Wrong node type");
if (content == null)
throw new Error("Content cannot be null");
XhtmlNode node = new XhtmlNode(NodeType.Text);
node.setContent(content);
childNodes.add(index, node);
return node;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addDocType(String content)
{
if (!(nodeType == NodeType.Document))
throw new Error("Wrong node type");
XhtmlNode node = new XhtmlNode(NodeType.DocType);
node.setContent(content);
childNodes.add(node);
return node;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode getValue() {
return place == null ? new XhtmlNode(NodeType.Element, "div") : place.getDiv();
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addTag(String name)
{
if (!(nodeType == NodeType.Element || nodeType == NodeType.Document))
throw new Error("Wrong node type. is "+nodeType.toString());
XhtmlNode node = new XhtmlNode(NodeType.Element);
node.setName(name);
childNodes.add(node);
return node;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public XhtmlNode addTag(int index, String name)
{
if (!(nodeType == NodeType.Element || nodeType == NodeType.Document))
throw new Error("Wrong node type. is "+nodeType.toString());
XhtmlNode node = new XhtmlNode(NodeType.Element);
node.setName(name);
childNodes.add(index, node);
return node;
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* @return {@link #div} (The actual narrative content, a stripped down version of XHTML.)
*/
public XhtmlNode getDiv() {
if (this.div == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Narrative.div");
else if (Configuration.doAutoCreate())
this.div = new XhtmlNode(); // cc
return this.div;
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* @return {@link #div} (The actual narrative content, a stripped down version of XHTML.)
*/
public XhtmlNode getDiv() {
if (this.div == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Narrative.div");
else if (Configuration.doAutoCreate())
this.div = new XhtmlNode(); // cc
return this.div;
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* @return {@link #div} (The actual narrative content, a stripped down version of XHTML.)
*/
public XhtmlNode getDiv() {
if (this.div == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Narrative.div");
else if (Configuration.doAutoCreate())
this.div = new XhtmlNode(); // cc
return this.div;
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* Sets the value of
*
* @param theString
* @throws Exception
*/
public void setDivAsString(String theString) {
XhtmlNode div;
if (StringUtils.isNotBlank(theString)) {
div = new XhtmlNode();
div.setValueAsString(theString);
} else {
div = null;
}
setDiv(div);
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* Sets the value of
*
* @param theString
* @throws Exception
*/
public void setDivAsString(String theString) {
XhtmlNode div;
if (StringUtils.isNotBlank(theString)) {
div = new XhtmlNode(NodeType.Element, "div");
div.setValueAsString(theString);
} else {
div = null;
}
setDiv(div);
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* Sets the value of
*
* @param theString
* @throws Exception
*/
public void setDivAsString(String theString) {
XhtmlNode div;
if (StringUtils.isNotBlank(theString)) {
div = new XhtmlNode();
div.setValueAsString(theString);
} else {
div = null;
}
setDiv(div);
}
代码示例来源:origin: jamesagnew/hapi-fhir
/**
* for a CDA narrative, return the matching XHTML.
*
* For further information, see http://wiki.hl7.org/index.php?title=CDA_Narrative_to_html_mapping
*
* @param ed
* @return
* @throws FHIRException
*/
public XhtmlNode convert(Element ed) throws FHIRException {
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
processAttributes(ed, div, "ID", "language", "styleCode");
processChildren(ed, div);
return div;
}
代码示例来源: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
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -892481550: return getStatusElement();
case 99473: /*div*/
if (div == null)
div = new XhtmlNode(NodeType.Element, "div");
return new StringType(new org.hl7.fhir.utilities.xhtml.XhtmlComposer(true).composeEx(this.div));
default: return super.makeProperty(hash, name);
}
}
代码示例来源:origin: jamesagnew/hapi-fhir
private XhtmlNode parseFragment() throws IOException, FHIRException
{
skipWhiteSpace();
if (peekChar() != '<')
throw new FHIRException("Unable to Parse HTML - does not start with tag. Found "+peekChar()+descLoc());
readChar();
if (peekChar() == '?') {
readToTagEnd();
skipWhiteSpace();
if (peekChar() != '<')
throw new FHIRException("Unable to Parse HTML - does not start with tag after processing instruction. Found "+peekChar()+descLoc());
readChar();
}
String n = readName().toLowerCase();
readToTagEnd();
XhtmlNode result = new XhtmlNode(NodeType.Element);
int colonIndex = n.indexOf(':');
if (colonIndex != -1) {
n = n.substring(colonIndex + 1);
}
result.setName(n);
unwindPoint = null;
List<XhtmlNode> p = new ArrayList<XhtmlNode>();
parseElementInner(result, p, null, true);
return result;
}
内容来源于网络,如有侵权,请联系作者删除!