Skip to content

Commit

Permalink
bad xpath expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Niessner authored and Al Niessner committed Nov 3, 2023
1 parent 6a9ce15 commit a45d317
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/gov/nasa/pds/validate/ri/UserInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.xml.transform.sax.SAXSource;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.xml.sax.InputSource;
Expand Down Expand Up @@ -44,10 +45,11 @@ private boolean isLabel (String cliArg) {
TreeInfo docInfo = LabelParser.parse(saxSource); // Parses a label.
List<TinyNodeImpl> xmlModels = new ArrayList<>();
XMLExtractor extractor = new XMLExtractor(docInfo.getRootNode());
xmlModels = extractor.getNodesFromDoc("logical_identifier");
xmlModels = extractor.getNodesFromDoc("//logical_identifier");
this.labels_lidvid = xmlModels.get(0).getStringValue();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
Expand All @@ -57,7 +59,10 @@ private boolean isLabel (String cliArg) {
private List<String> process (List<String> cliList){
List<String> lidvids = new ArrayList<String>();
for (String cliArg : cliList) {
if (cliArg.startsWith ("urn:")) {
cliArg = StringUtils.substringBefore(cliArg, "#");
if (cliArg.length() == 0) {
// ignore empty lines
} else if (cliArg.startsWith ("urn:")) {
lidvids.add (cliArg);
} else if (this.isLabel (cliArg)) {
lidvids.add (this.labels_lidvid);
Expand Down

0 comments on commit a45d317

Please sign in to comment.