/** * Checks if the string starts with a complete XML namespace attribute, and * if so, returns the number of characters that match. * * @param s * The string to check for an XML namespace definition. * * @return -1 if no XML namespace definition was found, otherwise the length * of the identified XML namespace definition. */ private int matchXmlNamespaceAttribute(String s) { /* * The regex we're simulating is: "xmlns\\s*=\\s*\".+?\".*" */ StringPrefixSlicer stringSlicer = new StringPrefixSlicer(s); if (stringSlicer.removePrefix("xmlns") == false) return -1; stringSlicer.removeRepeatingPrefix(" "); if (stringSlicer.removePrefix("=") == false) return -1; stringSlicer.removeRepeatingPrefix(" "); if (stringSlicer.removePrefix("\"") == false) return -1; if (stringSlicer.removePrefixEndingWith("\"") == false) return -1; return s.length() - stringSlicer.getString().length(); }
/** * Checks if the string starts with a complete XML namespace attribute, and * if so, returns the number of characters that match. * * @param s The string to check for an XML namespace definition. * @return -1 if no XML namespace definition was found, otherwise the length * of the identified XML namespace definition. */ private int matchXmlNamespaceAttribute(String s) { /* * The regex we're simulating is: "xmlns\\s*=\\s*\".+?\".*" */ StringPrefixSlicer stringSlicer = new StringPrefixSlicer(s); if (!stringSlicer.removePrefix("xmlns")) return -1; stringSlicer.removeRepeatingPrefix(" "); if (!stringSlicer.removePrefix("=")) return -1; stringSlicer.removeRepeatingPrefix(" "); if (!stringSlicer.removePrefix("\"")) return -1; if (!stringSlicer.removePrefixEndingWith("\"")) return -1; return s.length() - stringSlicer.getString().length(); }
/** * Checks if the string starts with a complete XML namespace attribute, and * if so, returns the number of characters that match. * * @param s The string to check for an XML namespace definition. * @return -1 if no XML namespace definition was found, otherwise the length * of the identified XML namespace definition. */ private int matchXmlNamespaceAttribute(String s) { /* * The regex we're simulating is: "xmlns\\s*=\\s*\".+?\".*" */ StringPrefixSlicer stringSlicer = new StringPrefixSlicer(s); if (!stringSlicer.removePrefix("xmlns")) return -1; stringSlicer.removeRepeatingPrefix(" "); if (!stringSlicer.removePrefix("=")) return -1; stringSlicer.removeRepeatingPrefix(" "); if (!stringSlicer.removePrefix("\"")) return -1; if (!stringSlicer.removePrefixEndingWith("\"")) return -1; return s.length() - stringSlicer.getString().length(); }
/** * Checks if the string starts with a complete XML namespace attribute, and * if so, returns the number of characters that match. * * @param s * The string to check for an XML namespace definition. * * @return -1 if no XML namespace definition was found, otherwise the length * of the identified XML namespace definition. */ private int matchXmlNamespaceAttribute(String s) { /* * The regex we're simulating is: "xmlns\\s*=\\s*\".+?\".*" */ StringPrefixSlicer stringSlicer = new StringPrefixSlicer(s); if (stringSlicer.removePrefix("xmlns") == false) return -1; stringSlicer.removeRepeatingPrefix(" "); if (stringSlicer.removePrefix("=") == false) return -1; stringSlicer.removeRepeatingPrefix(" "); if (stringSlicer.removePrefix("\"") == false) return -1; if (stringSlicer.removePrefixEndingWith("\"") == false) return -1; return s.length() - stringSlicer.getString().length(); }
/** * Checks if the string starts with a complete XML namespace attribute, and * if so, returns the number of characters that match. * * @param s The string to check for an XML namespace definition. * @return -1 if no XML namespace definition was found, otherwise the length * of the identified XML namespace definition. */ private int matchXmlNamespaceAttribute(String s) { /* * The regex we're simulating is: "xmlns\\s*=\\s*\".+?\".*" */ StringPrefixSlicer stringSlicer = new StringPrefixSlicer(s); if (!stringSlicer.removePrefix("xmlns")) return -1; stringSlicer.removeRepeatingPrefix(" "); if (!stringSlicer.removePrefix("=")) return -1; stringSlicer.removeRepeatingPrefix(" "); if (!stringSlicer.removePrefix("\"")) return -1; if (!stringSlicer.removePrefixEndingWith("\"")) return -1; return s.length() - stringSlicer.getString().length(); }
/** * Checks if the string starts with a complete XML namespace attribute, and * if so, returns the number of characters that match. * * @param s * The string to check for an XML namespace definition. * * @return -1 if no XML namespace definition was found, otherwise the length * of the identified XML namespace definition. */ private int matchXmlNamespaceAttribute(String s) { /* * The regex we're simulating is: "xmlns\\s*=\\s*\".+?\".*" */ StringPrefixSlicer stringSlicer = new StringPrefixSlicer(s); if (stringSlicer.removePrefix("xmlns") == false) return -1; stringSlicer.removeRepeatingPrefix(" "); if (stringSlicer.removePrefix("=") == false) return -1; stringSlicer.removeRepeatingPrefix(" "); if (stringSlicer.removePrefix("\"") == false) return -1; if (stringSlicer.removePrefixEndingWith("\"") == false) return -1; return s.length() - stringSlicer.getString().length(); }