Open hclbaur opened 1 month ago
This snippet can be used to check for a valid NCName (chatgpt so beware):
// Regular expression for NCName validation
private static final String NCNAME_REGEX = "^[A-Za-z_][A-Za-z0-9_.-]*$";
public static boolean isValidNCName(String ncName) {
if (ncName == null || ncName.isEmpty()) {
return false;
}
// Check if the input string matches the NCName pattern
return ncName.matches(NCNAME_REGEX);
}
Jaxen allows variable names to contain all kinds of characters, which may lead to strange errors when they are referenced. SDT should check for problematic names like "v a r", "var/", "va+r", "%var", etc. Suggestion (easy to implement): user defined variables must be valid SDA node names. Actual naming rules: https://www.w3.org/TR/REC-xml-names/#NT-QName