@Test public void withInlineCount() throws Exception { final String xml = "<links xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">" + "<m:count xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">4</m:count>" + "<uri>" + SERVICE_ROOT + "Employees('5')</uri>" + "</links>"; final List<String> links = new XmlLinkConsumer().readLinks(createReaderForTest(xml, true), null); assertEquals(1, links.size()); }
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);  }