@Test public void readEmptyList2() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<links xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\"></links>"; final List<String> links = new XmlLinkConsumer().readLinks(createReaderForTest(xml, true), null); assertNotNull(links); assertTrue(links.isEmpty()); }
public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } } }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  String readLink(final XMLStreamReader reader, final EdmEntitySet entitySet); List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet); }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  String readLink(final XMLStreamReader reader, final EdmEntitySet entitySet); List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet);  }