hc_characterdatareplacedataexceedslengthofdatapublic final class hc_characterdatareplacedataexceedslengthofdata extends org.w3c.domts.DOMTestCase If the sum of the offset and count exceeds the length then
all the characters to the end of the data are replaced.
Retrieve the character data from the last child of the
first employee. The "replaceData(offset,count,arg)"
method is then called with offset=0 and count=50 and
arg="2600". The method should replace all the characters
with "2600". This is because the sum of the offset and
count exceeds the length of the character data. |
Constructors Summary |
---|
public hc_characterdatareplacedataexceedslengthofdata(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "hc_staff", true);
|
Methods Summary |
---|
public java.lang.String | getTargetURI()Gets URI that identifies the test.
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofdata";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(hc_characterdatareplacedataexceedslengthofdata.class, args);
| public void | runTest()Runs the test case.
Document doc;
NodeList elementList;
Node nameNode;
CharacterData child;
String childData;
doc = (Document) load("hc_staff", true);
elementList = doc.getElementsByTagName("acronym");
nameNode = elementList.item(0);
child = (CharacterData) nameNode.getFirstChild();
child.replaceData(0, 50, "2600");
childData = child.getData();
assertEquals("characterdataReplaceDataExceedsLengthOfDataAssert", "2600", childData);
|
|