fix: make android os supported regex #35

This commit is contained in:
REAndroid 2023-04-27 19:28:44 +02:00
parent 21569db1f3
commit 096f024348

View File

@ -79,11 +79,11 @@ public class SchemaAttr extends XMLAttribute {
super.setValue(uri); super.setValue(uri);
return; return;
} }
String prf=matcher.group("B"); String prf=matcher.group(3);
if(!XMLUtil.isEmpty(prf)){ if(!XMLUtil.isEmpty(prf)){
setPrefix(prf); setPrefix(prf);
} }
uri=matcher.group("A"); uri=matcher.group(1);
super.setValue(uri); super.setValue(uri);
} }
@ -111,7 +111,7 @@ public class SchemaAttr extends XMLAttribute {
return false; return false;
} }
Matcher matcher = PATTERN_URI.matcher(value); Matcher matcher = PATTERN_URI.matcher(value);
return matcher.find(); return matcher.matches();
} }
public static String getPrefix(String xmlnsName){ public static String getPrefix(String xmlnsName){
String start="xmlns:"; String start="xmlns:";
@ -120,5 +120,5 @@ public class SchemaAttr extends XMLAttribute {
} }
return xmlnsName.substring(start.length()); return xmlnsName.substring(start.length());
} }
private static final Pattern PATTERN_URI=Pattern.compile("^\\s*(?<A>https?://[^:\\s]+)(:(?<B>([^:/\\s]+)))?\\s*$"); private static final Pattern PATTERN_URI=Pattern.compile("^\\s*(https?://[^:\\s]+)(:([^:/\\s]+))?\\s*$");
} }