Does you usecase require parsing of the YANG file(s)?
If you need to parse YANG data models (similarly like XML), you can use
pyang and write
pyang plugin that suites your needs. For this you need to write Python code.
If you need to parse YANG data model in Java, try to search for some java YANG parser.
You can also use
pyang to convert YANG to XML and then parse it in Java.