@Test public void testBuildFromTextWithIds() throws Exception { text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<resources>\n" + "<!--testing regular-->\n" + "<string name=\"pinterest\" tmTextUnitId=\"234\">Pinterest</string>\n" + "<!--testing @ escape-->\n" + "<string name=\"atescape\">\\@</string>\n" + "<!--testing plural-->\n" + "<plurals name=\"pins\">\n" + "<item quantity=\"one\" tmTextUnitId=\"235\">1 Pin</item>\n" + "<item quantity=\"other\" tmTextUnitId=\"236\">{num_pins} Pins</item>\n" + "</plurals>\n" + "</resources>"; document = AndroidStringDocumentReader.fromText(text); assertThat(document).isNotNull(); assertThat(document.getSingulars()).hasSize(2); AndroidSingular singular = document.getSingulars().get(0); assertThat(singular.getComment()).isEqualTo("testing regular"); assertThat(singular.getName()).isEqualTo("pinterest"); assertThat(singular.getId()).isEqualTo(234L); assertThat(singular.getContent()).isEqualTo("Pinterest"); singular = document.getSingulars().get(1); assertThat(singular.getComment()).isEqualTo("testing @ escape"); assertThat(singular.getName()).isEqualTo("atescape"); assertThat(singular.getId()).isNull(); assertThat(singular.getContent()).isEqualTo("@"); assertThat(document.getPlurals()).hasSize(1); AndroidPlural plural = document.getPlurals().get(0); assertThat(plural.getComment()).isEqualTo("testing plural"); assertThat(plural.getName()).isEqualTo("pins"); assertThat(plural.getItems()).hasSize(2); assertThat(plural.getItems().get(ONE).getId()).isEqualTo(235L); assertThat(plural.getItems().get(ONE).getContent()).isEqualTo("1 Pin"); assertThat(plural.getItems().get(OTHER).getId()).isEqualTo(236L); assertThat(plural.getItems().get(OTHER).getContent()).isEqualTo("{num_pins} Pins"); }
public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); } }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }  }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }  static AndroidStringDocument fromFile(String fileName); static AndroidStringDocument fromText(String text); }
AndroidStringDocumentReader { public static AndroidStringDocument fromText(String text) throws ParserConfigurationException, IOException, SAXException { return buildFromDocument(documentBuilder().parse(new InputSource(new StringReader(Strings.nullToEmpty(text))))); }  static AndroidStringDocument fromFile(String fileName); static AndroidStringDocument fromText(String text);  }