/** * @since SAAJ 1.2 * @param offset * @param count * @return * @throws DOMException */ public String substringData(int offset, int count)throws DOMException { return textRep.substringData(offset,count); }
/** * @since SAAJ 1.2 * @param offset * @param count * @return * @throws DOMException */ public String substringData(int offset, int count)throws DOMException { return textRep.substringData(offset,count); }
/** * @since SAAJ 1.2 * @param offset * @param count * @return * @throws DOMException */ public String substringData(int offset, int count)throws DOMException { return textRep.substringData(offset,count); }
@Override public String substringData(int offset, int count) throws DOMException { return domNode.substringData(offset, count); }
/** * Extracts a range of data from the node. * * @param offset Start offset of substring to extract. * @param count The number of 16-bit units to extract. * @return The specified substring. If the sum of <code>offset</code> and <code>count</code> * exceeds the <code>length</code>, then all 16-bit units to the end of the data are * returned. * @throws DOMException INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is negative * or greater than the number of 16-bit units in <code>data</code>, or if * the specified <code>count</code> is negative. <br>DOMSTRING_SIZE_ERR: * Raised if the specified range of text does not fit into a * <code>DOMString</code>. */ public String substringData(int offset, int count) throws DOMException { return target.substringData(offset, count); }
/** * Extracts a range of data from the node. * * @param offset Start offset of substring to extract. * @param count The number of 16-bit units to extract. * @return The specified substring. If the sum of <code>offset</code> and <code>count</code> * exceeds the <code>length</code>, then all 16-bit units to the end of the data are * returned. * @throws DOMException INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is negative * or greater than the number of 16-bit units in <code>data</code>, or if * the specified <code>count</code> is negative. <br>DOMSTRING_SIZE_ERR: * Raised if the specified range of text does not fit into a * <code>DOMString</code>. */ public String substringData(int offset, int count) throws DOMException { return target.substringData(offset, count); }
public String substringData(int offset, int count) throws DOMException { try { return _delegate.substringData(offset, count); } catch (org.w3c.dom.DOMException ex) { throw wrap(ex); } } }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String substring; doc = (Document) load("staff", false); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); substring = child.substringData(9, 10); assertEquals("characterdataSubStringExceedsValueAssert", "Martin", substring); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String substring; doc = (Document) load("hc_staff", false); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); substring = child.substringData(9, 10); assertEquals("characterdataSubStringExceedsValueAssert", "Martin", substring); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String substring; doc = (Document) load("staff", false); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); substring = child.substringData(0, 8); assertEquals("characterdataSubStringValueAssert", "Margaret", substring); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String substring; doc = (Document) load("hc_staff", false); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); substring = child.substringData(0, 8); assertEquals("characterdataSubStringValueAssert", "Margaret", substring); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String badString; doc = (Document) load("staff", false); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); { boolean success = false; try { badString = child.substringData(-5, 3); } catch (DOMException ex) { success = (ex.code == DOMException.INDEX_SIZE_ERR); } assertTrue("throws_INDEX_SIZE_ERR", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String badString; doc = (Document) load("staff", false); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); { boolean success = false; try { badString = child.substringData(40, 3); } catch (DOMException ex) { success = (ex.code == DOMException.INDEX_SIZE_ERR); } assertTrue("throw_INDEX_SIZE_ERR", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String badString; doc = (Document) load("hc_staff", true); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); { boolean success = false; try { badString = child.substringData(10, -3); } catch (DOMException ex) { success = (ex.code == DOMException.INDEX_SIZE_ERR); } assertTrue("throws_INDEX_SIZE_ERR", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String badString; doc = (Document) load("hc_staff", false); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); { boolean success = false; try { badString = child.substringData(40, 3); } catch (DOMException ex) { success = (ex.code == DOMException.INDEX_SIZE_ERR); } assertTrue("throw_INDEX_SIZE_ERR", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String badString; doc = (Document) load("hc_staff", false); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); { boolean success = false; try { badString = child.substringData(-5, 3); } catch (DOMException ex) { success = (ex.code == DOMException.INDEX_SIZE_ERR); } assertTrue("throws_INDEX_SIZE_ERR", success); } } /**
public org.w3c.dom.Text splitText(int offset) throws DOMException { int length = textRep.getLength(); // take the first part, and save the second part for new Text // length check and exception will be thrown here, no need to // duplicated check String tailData = textRep.substringData(offset, length); textRep.deleteData(offset, length); // insert the first part again as a new node Text tailText = new CommentImpl(tailData); org.w3c.dom.Node myParent = (org.w3c.dom.Node) getParentNode(); if (myParent != null) { org.w3c.dom.NodeList brothers = (org.w3c.dom.NodeList) myParent.getChildNodes(); for (int i = 0; i < brothers.getLength(); i++) { if (brothers.item(i).equals(this)) { myParent.insertBefore(tailText, this); return tailText; } } } return tailText; }
public org.w3c.dom.Text splitText(int offset) throws DOMException { int length = textRep.getLength(); // take the first part, and save the second part for new Text // length check and exception will be thrown here, no need to // duplicated check String tailData = textRep.substringData(offset, length); textRep.deleteData(offset, length); // insert the first part again as a new node Text tailText = new CommentImpl(tailData); org.w3c.dom.Node myParent = (org.w3c.dom.Node) getParentNode(); if (myParent != null) { org.w3c.dom.NodeList brothers = (org.w3c.dom.NodeList) myParent.getChildNodes(); for (int i = 0; i < brothers.getLength(); i++) { if (brothers.item(i).equals(this)) { myParent.insertBefore(tailText, this); return tailText; } } } return tailText; }
public org.w3c.dom.Text splitText(int offset) throws DOMException { int length = textRep.getLength(); // take the first part, and save the second part for new Text // length check and exception will be thrown here, no need to // duplicated check String tailData = textRep.substringData(offset, length); textRep.deleteData(offset, length); // insert the first part again as a new node Text tailText = new CommentImpl(tailData); org.w3c.dom.Node myParent = (org.w3c.dom.Node) getParentNode(); if (myParent != null) { org.w3c.dom.NodeList brothers = (org.w3c.dom.NodeList) myParent.getChildNodes(); for (int i = 0; i < brothers.getLength(); i++) { if (brothers.item(i).equals(this)) { myParent.insertBefore(tailText, this); return tailText; } } } return tailText; }
String tailData = textRep.substringData(offset,length); textRep.deleteData(offset,length);