Search in sources :

Example 1 with NodeType

use of org.hl7.fhir.utilities.xhtml.NodeType in project org.hl7.fhir.core by hapifhir.

the class XhtmlNode method addComment.

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;
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 2 with NodeType

use of org.hl7.fhir.utilities.xhtml.NodeType in project org.hl7.fhir.core by hapifhir.

the class XhtmlNode method addTag.

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);
    if (inPara || name.equals("p")) {
        node.inPara = true;
    }
    if (inLink || name.equals("a")) {
        node.inLink = true;
    }
    node.setName(name);
    childNodes.add(index, node);
    return node;
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 3 with NodeType

use of org.hl7.fhir.utilities.xhtml.NodeType in project org.hl7.fhir.core by hapifhir.

the class XhtmlNode method addDocType.

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;
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 4 with NodeType

use of org.hl7.fhir.utilities.xhtml.NodeType in project org.hl7.fhir.core by hapifhir.

the class XhtmlNode method addInstruction.

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;
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 5 with NodeType

use of org.hl7.fhir.utilities.xhtml.NodeType in project org.hl7.fhir.core by hapifhir.

the class XhtmlNode method addText.

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;
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Aggregations

FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)6