Skip to content

How to find particular XML records

Pascal Christoph edited this page Jun 8, 2021 · 3 revisions
  1. place the XML file to "src/test/resources/alma/almaMarcXmlTestFiles.xml.tar.bz2"
  2. adapt the AlmaTest in AlmaMarc21XmlToLobidJsonTest.java to something like this:

private static final String PATTERN_TO_IDENTIFY_XML_RECORDS = "tag=\"647\"";

It's even possible to fish for more than one field with an OR pattern "|" like:

private static final String PATTERN_TO_IDENTIFY_XML_RECORDS = "tag=\"654\"|tag=\"656\"|tag=\"657\"|tag=\"662\"|tag=\"69X\"";

  1. build and execute the AlmaTest: mvn clean install -DskipTests=true; mvn failsafe:integration-test -Dit.test=AlmaMarc21XmlToLobidJsonTest
  2. look in src/test/resources/alma/ to see the single filtered XML records
  3. if you have fished enough, break the AlmaTest by pressing ctrl + c, or wait till the end

(see https://github.com/hbz/lobid-resources/issues/1222 for details)