本文整理汇总了Java中org.hl7.fhir.utilities.xhtml.XhtmlNode.getNsDecl方法的典型用法代码示例。如果您正苦于以下问题:Java XhtmlNode.getNsDecl方法的具体用法?Java XhtmlNode.getNsDecl怎么用?Java XhtmlNode.getNsDecl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hl7.fhir.utilities.xhtml.XhtmlNode
的用法示例。
在下文中一共展示了XhtmlNode.getNsDecl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: composeXhtml
import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入方法依赖的package包/类
protected void composeXhtml(String name, XhtmlNode html) throws IOException {
if (!Utilities.noString(xhtmlMessage)) {
xml.enter(XhtmlComposer.XHTML_NS, name);
xml.comment(xhtmlMessage, false);
xml.exit(XhtmlComposer.XHTML_NS, name);
} else {
XhtmlComposer comp = new XhtmlComposer(XhtmlComposer.XML, htmlPretty);
// name is also found in the html and should the same
// ? check that
boolean oldPretty = xml.isPretty();
xml.setPretty(htmlPretty);
if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)
xml.namespace(XhtmlComposer.XHTML_NS, null);
comp.compose(xml, html);
xml.setPretty(oldPretty);
}
}
示例2: composeNarrativeInner
import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入方法依赖的package包/类
protected void composeNarrativeInner(Narrative element) throws IOException {
composeElement(element);
if (element.hasStatusElement()) {
composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
}
if (element.hasDiv()) {
XhtmlNode node = element.getDiv();
if (node.getNsDecl() == null) {
node.attribute("xmlns", XHTML_NS);
}
composeXhtml("div", node);
}
}
示例3: checkInnerNS
import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入方法依赖的package包/类
private void checkInnerNS(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) {
for (XhtmlNode node : list) {
if (node.getNodeType() == NodeType.Element) {
String ns = node.getNsDecl();
rule(errors, IssueType.INVALID, e.line(), e.col(), path, ns == null || FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')");
checkInnerNS(errors, e, path, node.getChildNodes());
}
}
}
示例4: checkInnerNS
import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入方法依赖的package包/类
private void checkInnerNS(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) {
for (XhtmlNode node : list) {
if (node.getNodeType() == NodeType.Element) {
String ns = node.getNsDecl();
rule(errors, IssueType.INVALID, e.line(), e.col(), path, ns == null || FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')");
checkInnerNS(errors, e, path, node.getChildNodes());
}
}
}
示例5: checkPrimitive
import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入方法依赖的package包/类
private void checkPrimitive(List<ValidationMessage> errors, String path, String type, ElementDefinition context, Element e, StructureDefinition profile) {
if (type.equals("boolean")) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, "true".equals(e.primitiveValue()) || "false".equals(e.primitiveValue()), "boolean values must be 'true' or 'false'");
}
if (type.equals("uri")) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("oid:"), "URI values cannot start with oid:");
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("uuid:"), "URI values cannot start with uuid:");
rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().equals(e.primitiveValue().trim()), "URI values cannot have leading or trailing whitespace");
}
if (!type.equalsIgnoreCase("string") && e.hasPrimitiveValue()) {
if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().length() > 0, "@value cannot be empty")) {
warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().trim().equals(e.primitiveValue()), "value should not start or finish with whitespace");
}
}
if (type.equals("dateTime")) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year");
rule(errors, IssueType.INVALID, e.line(), e.col(), path,
e.primitiveValue()
.matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"),
"Not a valid date time");
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.primitiveValue()) || hasTimeZone(e.primitiveValue()), "if a date has a time, it must have a timezone");
}
if (type.equals("instant")) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path,
e.primitiveValue().matches("-?[0-9]{4}-(0[1-9]|1[0-2])-(0[0-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"),
"The instant '" + e.primitiveValue() + "' is not valid (by regex)");
rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year");
}
if (type.equals("code") && e.primitiveValue() != null) {
// Technically, a code is restricted to string which has at least one character and no leading or trailing whitespace, and where there is no whitespace
// other than single spaces in the contents
rule(errors, IssueType.INVALID, e.line(), e.col(), path, passesCodeWhitespaceRules(e.primitiveValue()), "The code '" + e.primitiveValue() + "' is not valid (whitespace rules)");
}
if (context.hasBinding() && e.primitiveValue() != null) {
checkPrimitiveBinding(errors, path, type, context, e, profile);
}
if (type.equals("xhtml")) {
XhtmlNode xhtml = e.getXhtml();
if (xhtml != null) { // if it is null, this is an error already noted in the parsers
// check that the namespace is there and correct.
String ns = xhtml.getNsDecl();
rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')");
// check that inner namespaces are all correct
checkInnerNS(errors, e, path, xhtml.getChildNodes());
rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div");
// check that no illegal elements and attributes have been used
checkInnerNames(errors, e, path, xhtml.getChildNodes());
}
}
// for nothing to check
}