Added hacked DocumentImpl git-svn-id: svn://10.0.0.236/trunk@58135 18797224-902f-48f8-a5cc-f745e15eee43
138 lines
3.6 KiB
Java
Executable File
138 lines
3.6 KiB
Java
Executable File
/*
|
|
The contents of this file are subject to the Mozilla Public
|
|
License Version 1.1 (the "License"); you may not use this file
|
|
except in compliance with the License. You may obtain a copy of
|
|
the License at http://www.mozilla.org/MPL/
|
|
|
|
Software distributed under the License is distributed on an "AS
|
|
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
implied. See the License for the specific language governing
|
|
rights and limitations under the License.
|
|
|
|
The Original Code is mozilla.org code.
|
|
|
|
The Initial Developer of the Original Code is Sun Microsystems,
|
|
Inc. Portions created by Sun are
|
|
Copyright (C) 1999 Sun Microsystems, Inc. All
|
|
Rights Reserved.
|
|
|
|
Contributor(s):
|
|
*/
|
|
package org.mozilla.dom.test;
|
|
|
|
import java.util.*;
|
|
import java.io.*;
|
|
import org.mozilla.dom.test.*;
|
|
import org.mozilla.dom.*;
|
|
import org.w3c.dom.*;
|
|
|
|
public class NodeImpl_getChildNodes extends BWBaseTest implements Execution
|
|
{
|
|
|
|
/**
|
|
*
|
|
***********************************************************
|
|
* Constructor
|
|
***********************************************************
|
|
*
|
|
*/
|
|
public NodeImpl_getChildNodes()
|
|
{
|
|
}
|
|
|
|
|
|
/**
|
|
*
|
|
***********************************************************
|
|
* Starting point of application
|
|
*
|
|
* @param args Array of command line arguments
|
|
*
|
|
***********************************************************
|
|
*/
|
|
public static void main(String[] args)
|
|
{
|
|
}
|
|
|
|
/**
|
|
***********************************************************
|
|
*
|
|
* Execute Method
|
|
*
|
|
* @param tobj Object reference (Node/Document/...)
|
|
* @return true or false depending on whether test passed or failed.
|
|
*
|
|
***********************************************************
|
|
*/
|
|
public boolean execute(Object tobj)
|
|
{
|
|
if (tobj == null) {
|
|
TestLoader.logPrint("Object is NULL...");
|
|
return BWBaseTest.FAILED;
|
|
}
|
|
|
|
String os = System.getProperty("OS");
|
|
osRoutine(os);
|
|
|
|
Document d = (Document)tobj;
|
|
if (d != null)
|
|
{
|
|
String elname = "SCRIPT";
|
|
Element e = d.createElement(elname);
|
|
if (e == null)
|
|
{
|
|
TestLoader.logErrPrint("Could not create Element " + elname);
|
|
return BWBaseTest.FAILED;
|
|
}
|
|
|
|
String nodename = "HTML";
|
|
NodeList nl = d.getElementsByTagName(nodename);
|
|
if (nl != null)
|
|
{
|
|
int len = nl.getLength();
|
|
|
|
Node n = nl.item(0);
|
|
if (n.getNodeName().compareTo(nodename) == 0)
|
|
{
|
|
NodeList childList = n.getChildNodes();
|
|
if (childList == null)
|
|
{
|
|
TestLoader.logErrPrint("Could not get childNodes for node " + nodename);
|
|
return BWBaseTest.FAILED;
|
|
}
|
|
}
|
|
} else {
|
|
TestLoader.logErrPrint("Could not find Node " + nodename);
|
|
return BWBaseTest.FAILED;
|
|
}
|
|
} else {
|
|
System.out.println("Document is NULL..");
|
|
return BWBaseTest.FAILED;
|
|
}
|
|
|
|
return BWBaseTest.PASSED;
|
|
|
|
}
|
|
|
|
/**
|
|
*
|
|
***********************************************************
|
|
* Routine where OS specific checks are made.
|
|
*
|
|
* @param os OS Name (SunOS/Linus/MacOS/...)
|
|
***********************************************************
|
|
*
|
|
*/
|
|
private void osRoutine(String os)
|
|
{
|
|
if(os == null) return;
|
|
|
|
os = os.trim();
|
|
if(os.compareTo("SunOS") == 0) {}
|
|
else if(os.compareTo("Linux") == 0) {}
|
|
else if(os.compareTo("Windows") == 0) {}
|
|
else if(os.compareTo("MacOS") == 0) {}
|
|
else {}
|
|
}
|
|
}
|