NoSbdhParser implements ContentDetector { public PeppolStandardBusinessHeader originalParse(InputStream inputStream) throws OxalisContentException { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(inputStream); XPath xPath = XPathFactory.newInstance().newXPath(); xPath.setNamespaceContext(new HardCodedNamespaceResolver()); PeppolStandardBusinessHeader sbdh = PeppolStandardBusinessHeader .createPeppolStandardBusinessHeaderWithNewDate(); PlainUBLHeaderParser headerParser = new PlainUBLHeaderParser(document, xPath); if (headerParser.canParse()) { sbdh.setDocumentTypeIdentifier(headerParser.fetchDocumentTypeId().toVefa()); sbdh.setProfileTypeIdentifier(headerParser.fetchProcessTypeId()); PEPPOLDocumentParser documentParser = null; try { documentParser = headerParser.createDocumentParser(); } catch (Exception ex) { } if (documentParser != null) { try { sbdh.setSenderId(documentParser.getSender()); } catch (Exception e) { } try { sbdh.setRecipientId(documentParser.getReceiver()); } catch (Exception e) { } } } return sbdh; } catch (Exception e) { throw new OxalisContentException("Unable to parseOld document " + e.getMessage(), e); } } NoSbdhParser(); @Override Header parse(InputStream inputStream); PeppolStandardBusinessHeader originalParse(InputStream inputStream);  }
@Test public void verifyCorrectParsingOfReceiver() throws Exception { InputStream resourceAsStream = getClass().getResourceAsStream("/issue250/Issue250-sample-invoice.xml"); assertNotNull(resourceAsStream, "Test resource not found"); NoSbdhParser p = new NoSbdhParser(); PeppolStandardBusinessHeader peppolStandardBusinessHeader = p.originalParse(resourceAsStream); String receiver = peppolStandardBusinessHeader.getRecipientId().getIdentifier(); assertEquals("9954:111111111", receiver); }