public static void readPatterns(ResourceFile file, ArrayList<Pattern> patlist,
			PatternFactory pfactory) throws SAXException, IOException {
		ErrorHandler handler = new ErrorHandler() {
			@Override
			public void error(SAXParseException exception) throws SAXException {
				throw new SAXException("Error: " + exception);
			}

			@Override
			public void fatalError(SAXParseException exception) throws SAXException {
				throw new SAXException("Fatal error: " + exception);
			}

			@Override
			public void warning(SAXParseException exception) throws SAXException {
				throw new SAXException("Warning: " + exception);
			}
		};
		XmlPullParser parser;
		try (InputStream inputStream = file.getInputStream()) {
			parser = new NonThreadedXmlPullParserImpl(inputStream, file.getName(), handler, false);
		}
		parser.start("patternlist");
		XmlElement el = parser.peek();
		while (el.isStart()) {
			if (el.getName().equals("patternpairs")) {
				PatternPairSet pairset = new PatternPairSet();
				pairset.restoreXml(parser, pfactory);
				pairset.createFinalPatterns(patlist);
			}
			else {
				Pattern pat = new Pattern();
				pat.restoreXml(parser, pfactory);
				patlist.add(pat);
			}
			el = parser.peek();
		}
		parser.end();
	}
Read patterns from specified file
@param file pattern file
@param patlist list for patterns to be added to
@param pfactory optional factory for use in parsing PostRule and MatchAction elements.  
If null such elements may not be present.
@throws SAXException
@throws IOException
Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/Pattern.java