From c5f5689714f4f3aefaa036be7bc4b51d074d6093 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sun, 7 May 2023 07:14:44 -0500 Subject: [PATCH] fixes for R5 redirector --- .../hl7/fhir/utilities/npm/NpmPackage.java | 2 +- .../hl7/fhir/utilities/xhtml/XhtmlNode.java | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java index b5b3679da..70a46f406 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java @@ -580,7 +580,7 @@ public class NpmPackage { for (NpmPackageFolder folder : folders.values()) { if (folder.index != null) { for (JsonObject fi : folder.index.getJsonObjects("files")) { - if (Utilities.existsInList(fi.asString("resourceType"), types)) { + if (Utilities.existsInList(fi.asString("resourceType"), types) || types.isEmpty()) { res.add(new PackageResourceInformation(folder.folder == null ? "@"+folder.getName() : folder.folder.getAbsolutePath(), fi)); } } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java index f4bad9f07..e08257375 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java @@ -837,4 +837,33 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml { return false; } + + public XhtmlNode getElementById(String id) { + if (id.equals(getAttribute("id"))) { + return this; + } + if (childNodes != null) { + for (XhtmlNode x : childNodes) { + XhtmlNode r = x.getElementById(id); + if (r != null) { + return r; + } + } + } + return null; + } + + + public List getChildren(String name) { + List res = new ArrayList<>(); + XhtmlNode x = getFirstElement(); + while (x != null) { + if (name.equals(x.getName())) { + res.add(x); + } + x = getNextElement(x); + } + return res; + } + } \ No newline at end of file