util.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. //**************************************************************************
  2. //
  3. //
  4. // National Institute Of Standards and Technology
  5. // DTS Version 1.0
  6. //
  7. //
  8. //
  9. // Ported to System.Xml by: Mizrahi Rafael [email protected]
  10. // Mainsoft Corporation (c) 2003-2004
  11. //
  12. //**************************************************************************
  13. using System;
  14. using System.Xml;
  15. namespace nist_dom
  16. {
  17. public class XmlNodeArrayList : XmlNodeList
  18. {
  19. System.Collections.ArrayList _rgNodes;
  20. public XmlNodeArrayList (System.Collections.ArrayList rgNodes)
  21. {
  22. _rgNodes = rgNodes;
  23. }
  24. public override int Count { get { return _rgNodes.Count; } }
  25. public override System.Collections.IEnumerator GetEnumerator ()
  26. {
  27. return _rgNodes.GetEnumerator ();
  28. }
  29. public override XmlNode Item (int index)
  30. {
  31. // Return null if index is out of range. by DOM design.
  32. if (index < 0 || _rgNodes.Count <= index)
  33. return null;
  34. return (XmlNode) _rgNodes [index];
  35. }
  36. }
  37. public class testResults
  38. {
  39. public string name;
  40. public string description;
  41. public string expected;
  42. public string actual;
  43. public testResults(string name)
  44. {
  45. // get the name of the calling function
  46. this.name = name;
  47. //
  48. // define some methods
  49. //
  50. //this.description = set_description();
  51. //this.expected = set_expected();
  52. //this.actual = set_actual();
  53. // this.toString = set_toString;
  54. }
  55. public void set_description(string description) { this.description = description; }
  56. public void set_expected (string expected) { this.expected = expected;}
  57. public void set_actual (string actual) { this.actual = actual; }
  58. public void set_toString()
  59. {
  60. System.Console.WriteLine("name = "+this.name+"<br>");
  61. System.Console.WriteLine("Description = "+this.description+"<br>");
  62. System.Console.WriteLine("Expected Value = "+this.expected+"<br>");
  63. System.Console.WriteLine("Actual Value = "+this.actual+"<br>");
  64. }
  65. }
  66. /// <summary>
  67. /// Summary description for util.
  68. /// </summary>
  69. public class util
  70. {
  71. public static System.Xml.XmlDocument masterDoc = new System.Xml.XmlDocument();//"files/staff.xml"
  72. public static System.Xml.XmlDocument originalDoc = new System.Xml.XmlDocument();//"files/staff.xml"
  73. public static System.Xml.XmlDocument masterXML = new System.Xml.XmlDocument();//"files/staff.html"
  74. public static System.Xml.XmlDocument otherDoc = new System.Xml.XmlDocument();//"files/otherDoc.xml"
  75. public static System.Xml.XmlDocument HTMLDoc = new System.Xml.XmlDocument();//"files/staff.html"
  76. public static System.Xml.XmlDocument noDTDXMLObject = new System.Xml.XmlDocument();//"files/noDTDXMLfile.xml"
  77. // cWin = self.parent.viewer;
  78. //public static System.Xml.XmlDocument vdoc; // = cWin.document;
  79. public static System.IO.StreamWriter vdoc = null;
  80. // dWin = self.parent.test;
  81. public static System.Xml.XmlDocument testdoc; // = dWin.document;
  82. // fWin = self.parent.frameddoc;
  83. public static System.Xml.XmlDocument framesetdoc; // = fWin.document;
  84. // oWin = self.parent.original;
  85. public static System.Xml.XmlDocument originaldoc; // = oWin.document;
  86. //
  87. // var Interfaces = new Object();
  88. //
  89. // iform = parent.interfaces.selectInterface;
  90. // testInterface = iform.interface.options[iform.interface.selectedIndex].Value;
  91. // cform = parent.categories.selectCategory;
  92. // testCategory = cform.category.options[cform.category.selectedIndex].Value;
  93. //
  94. public static string passColor = "#00FFFF";
  95. public static string failColor = "#FF0000";
  96. // public static System.Xml.XmlNode _node;
  97. // public static System.Xml.XmlAttributeCollection _attributes;
  98. // public static System.Xml.XmlNodeList _subNodes;
  99. static util()
  100. {
  101. try
  102. {
  103. //System.Console.WriteLine(System.IO.Directory.GetCurrentDirectory());
  104. masterDoc.Load("Test/System.Xml/nist_dom/files/staff.xml");
  105. originalDoc.Load("Test/System.Xml/nist_dom/files/staff.xml");
  106. masterXML.Load("Test/System.Xml/nist_dom/files/staff.html");
  107. otherDoc.Load("Test/System.Xml/nist_dom/files/otherDoc.xml");
  108. HTMLDoc.Load("Test/System.Xml/nist_dom/files/staff.html");
  109. noDTDXMLObject.Load("Test/System.Xml/nist_dom/files/noDTDXMLfile.xml");
  110. }
  111. catch (System.Exception ex)
  112. {
  113. System.Console.WriteLine(ex.Message);
  114. System.Console.WriteLine(ex.StackTrace);
  115. }
  116. }
  117. // ***********************************************************************
  118. // SUPPORTING ROUTINES AND DEFINITIONS
  119. //************************************************************************
  120. public static string SUCCESS = "Passed";
  121. public static string FAILED = "Failed";
  122. //
  123. // General defs.
  124. //
  125. public static string saved = "";
  126. public static int MAXEMPLOYEES = 5;
  127. public static int NODE = 1;
  128. public static int INDEXING = 2;
  129. public static string employee = "employee";
  130. public static string rootNode = "staff";
  131. public static string pass = "Passed";
  132. public static string fail = "Failed";
  133. public static int FIRST = 0;
  134. public static int SECOND = 1;
  135. public static int THIRD = 2;
  136. public static int FOURTH = 3;
  137. public static int FIFTH = 4;
  138. public static int SIXTH = 5;
  139. public static int SEVENTH = 6;
  140. public static int EIGHT = 7;
  141. public static int NINETH = 8;
  142. public static int TENTH = 9;
  143. public static int ELEVENTH = 10;
  144. public static int TWELVETH = 11;
  145. public static int THIRDTEENTH = 12;
  146. public static string BODY = "BODY";
  147. public static string TITLE = "TITLE";
  148. public static string H1 = "H1";
  149. public static string H2 = "H2";
  150. public static string H3 = "H3";
  151. public static string H4 = "H4";
  152. public static string H5 = "H5";
  153. public static string H6 = "H6";
  154. public static string BR = "BR";
  155. public static string TABLE = "TABLE";
  156. public static string IMG = "IMG";
  157. public static string OBJECT = "OBJECT";
  158. public static string FONT = "FONT";
  159. public static string BASEFONT = "BASEFONT";
  160. public static string MAP = "MAP";
  161. public static string AREA = "AREA";
  162. public static string P = "P";
  163. public static string OL = "OL";
  164. public static string UL = "UL";
  165. public static string DL = "DL";
  166. public static string HR = "HR";
  167. public static string HTML = "HTML";
  168. public static string HEAD = "HEAD";
  169. public static string LINK = "LINK";
  170. public static string META = "META";
  171. public static string BASE = "BASE";
  172. public static string FORM = "FORM";
  173. public static string SELECT = "SELECT";
  174. public static string OPTION = "OPTION";
  175. public static string Q = "Q";
  176. public static string BLOCKQUOTE = "BLOCKQUOTE";
  177. public static string COL = "COL";
  178. public static string COLGROUP = "COLGROUP";
  179. public static string PRE = "PRE";
  180. public static string DIV = "DIV";
  181. public static string INS = "INS";
  182. public static string DEL = "DEL";
  183. public static string DIR = "DIR";
  184. public static string APPLET = "APPLET";
  185. public static string OPTGROUP = "OPTGROUP";
  186. public static string SCRIPT = "SCRIPT";
  187. public static string PARAM = "PARAM";
  188. public static string ISINDEX = "ISINDEX";
  189. public static string INPUT = "INPUT";
  190. public static string BUTTON = "BUTTON";
  191. public static string LABEL = "LABEL";
  192. public static string TEXTAREA = "TEXTAREA";
  193. public static string FIELDSET = "FIELDSET";
  194. public static string ANCHOR = "A";
  195. public static string FRAMESET = "FRAMESET";
  196. public static string FRAME = "FRAME";
  197. public static string IFRAME = "IFRAME";
  198. public static string LEGEND = "LEGEND";
  199. public static string MENU = "MENU";
  200. //public static string IFRAME = "IFRAME";
  201. public static string STYLE = "STYLE";
  202. public static string LI = "LI";
  203. public static string SUB = "SUB";
  204. public static string SUP = "SUP";
  205. public static string SPAN = "SPAN";
  206. public static string BDO = "BDO";
  207. public static string TT = "TT";
  208. public static string I = "I";
  209. public static string B = "B";
  210. public static string U = "U";
  211. public static string S = "S";
  212. public static string STRIKE = "STRIKE";
  213. public static string BIG = "BIG";
  214. public static string SMALL = "SMALL";
  215. public static string EM = "EM";
  216. public static string STRONG = "STRONG";
  217. public static string DFN = "DFN";
  218. public static string CODE = "CODE";
  219. public static string SAMP = "SAMP";
  220. public static string KBD = "KBD";
  221. public static string VAR = "VAR";
  222. public static string CITE = "CITE";
  223. public static string ACRONYM = "ACRONYM";
  224. public static string ABBR = "ABBR";
  225. public static string DT = "DT";
  226. public static string DD = "DD";
  227. public static string NOFRAMES = "NOFRAMES";
  228. public static string NOSCRIPT = "NOSCRIPT";
  229. public static string ADDRESS = "ADDRESS";
  230. public static string CENTER = "CENTER";
  231. public static string TD = "TD";
  232. public static string TBODY = "TBODY";
  233. public static string TFOOT = "TFOOT";
  234. public static string THEAD = "THEAD";
  235. public static string TR = "TR";
  236. public static string TH = "TH";
  237. //
  238. // Base URL's for tests depending on specific URL's
  239. //
  240. // BASE1 - The URI returned by the "referrer" attribute (Document interface).
  241. // BASE2 - The string returned by the "domain" attribute (Document interface).
  242. // BASE3 - The URI returned by the "URL" attribute (Document interface).
  243. // BASE4 - The URI returned by the "codebase" attribute (Applet interface).
  244. // BASE5 - ThE URI returned by the "codeBase" attribute (Object interface).
  245. // BASE6 - The URI returned by the "href" attribute (Base interface).
  246. //
  247. public static string BASE1 = "HTTP://XW2K.SDCT.ITL.NIST.GOV/BRADY/DOM/INDEX.HTML";
  248. public static string BASE2 = "XW2K.SDCT.ITL.NIST.GOV";
  249. public static string BASE3 = "HTTP://XW2K.SDCT.ITL.NIST.GOV/BRADY/DOM/FILES/TEST.HTML";
  250. public static string BASE4 = "HTTP://XW2K.SDCT.ITL.NIST.GOV/BRADY/DOM/FILES/";
  251. public static string BASE5 = "HTTP://XW2K.SDCT.ITL.NIST.GOV/BRADY/DOM/";
  252. public static string BASE6 = "HTTP://XW2K.SDCT.ITL.NIST.GOV/BRADY/DOM/";
  253. //
  254. // Exception codes
  255. //
  256. public static string EOL = "\n"; //String.fromCharCode(13,10);
  257. public static string INDEX_SIZE_ERR = "StartIndex cannot be less than zero.\r\nParameter name: startIndex";
  258. public static string DOMSTRING_SIZE_ERR = " ";
  259. public static string INVALID_CHARACTER_ERR = "A name contained an invalid character." + EOL;
  260. public static string NOT_DATA_ALLOWED_ERR = " ";
  261. public static string NO_MODIFICATION_ALLOWED_ERR = "Attempt to modify a read-only node." + EOL;
  262. public static string NOT_FOUND1_ERR = "Invalid procedure call or argument";
  263. public static string NOT_FOUND2_ERR = "Insert position Node must be a Child of the Node to " + "insert under." + EOL;
  264. public static string NOT_FOUND3_ERR = "The parameter Node is not a child of this Node." + EOL;
  265. public static string NOT_SUPPORTED_ERR = " ";
  266. public static string INUSE_ATTRIBUTE_ERR = "The Attribute node cannot be inserted because it is already an attribute of another element.";//"Attributes must be removed before adding them " + "to a different node." + EOL;
  267. //
  268. // nodeType values
  269. //
  270. public const int ELEMENT_NODE = (int)System.Xml.XmlNodeType.Element;
  271. public const int ATTRIBUTE_NODE = (int)System.Xml.XmlNodeType.Attribute;
  272. public const int TEXT_NODE = (int)System.Xml.XmlNodeType.Text;
  273. public const int CDATA_SECTION_NODE = (int)System.Xml.XmlNodeType.CDATA;
  274. public const int ENTITY_REFERENCE_NODE = (int)System.Xml.XmlNodeType.EntityReference;
  275. public const int ENTITY_NODE = (int)System.Xml.XmlNodeType.Entity;
  276. public const int PROCESSING_INSTRUCTION_NODE = (int)System.Xml.XmlNodeType.ProcessingInstruction;
  277. public const int COMMENT_NODE = (int)System.Xml.XmlNodeType.Comment;
  278. public const int DOCUMENT_NODE = (int)System.Xml.XmlNodeType.Document;
  279. public const int DOCUMENT_TYPE_NODE = (int)System.Xml.XmlNodeType.DocumentType;
  280. public const int DOCUMENT_FRAGMENT_NODE = (int)System.Xml.XmlNodeType.DocumentFragment;
  281. public const int NOTATION_NODE = (int)System.Xml.XmlNodeType.Notation;
  282. public const int XML_DECLARATION_NODE = (int)System.Xml.XmlNodeType.XmlDeclaration;
  283. public static System.Xml.XmlDocument getDOMDocument()
  284. {
  285. return masterDoc;
  286. }
  287. public static System.Xml.XmlDocument getHTMLDocument()
  288. {
  289. return testdoc;
  290. }
  291. public static System.Xml.XmlDocument getFramesetDocument()
  292. {
  293. return framesetdoc;
  294. }
  295. public static System.Xml.XmlDocument getDOMHTMLDocument()
  296. {
  297. return HTMLDoc;
  298. }
  299. public static System.Xml.XmlDocument getnoDTDXMLDocument()
  300. {
  301. return noDTDXMLObject;
  302. }
  303. public static System.Xml.XmlDocument getOriginalDOMDocument()
  304. {
  305. return originalDoc;
  306. }
  307. public static System.Xml.XmlDocument getOtherDOMDocument()
  308. {
  309. return otherDoc;
  310. }
  311. public static System.Xml.XmlNode createNode(int type,string data)
  312. {
  313. System.Xml.XmlNode node = null;
  314. switch(type) {
  315. case ATTRIBUTE_NODE:
  316. node = getDOMDocument().CreateAttribute(data);
  317. break;
  318. case CDATA_SECTION_NODE:
  319. node = getDOMDocument().CreateCDataSection(data);
  320. break;
  321. case ELEMENT_NODE:
  322. node = getDOMDocument().CreateElement(data);
  323. break;
  324. case ENTITY_REFERENCE_NODE:
  325. node = getDOMDocument().CreateEntityReference(data);
  326. break;
  327. case TEXT_NODE:
  328. node = getDOMDocument().CreateTextNode(data);
  329. break;
  330. default:
  331. break;
  332. }
  333. return node;
  334. }
  335. public static void resetData()
  336. {
  337. try
  338. {
  339. if (getDOMDocument().DocumentElement != null)
  340. {
  341. getDOMDocument().RemoveChild(getDOMDocument().DocumentElement);
  342. }
  343. System.Xml.XmlNode tmpNode = getDOMDocument().ImportNode(getOriginalDOMDocument().DocumentElement,true);
  344. getDOMDocument().AppendChild(tmpNode);
  345. //getDOMDocument().AppendChild(getOriginalDOMDocument().DocumentElement.CloneNode(true));
  346. }
  347. catch (NotImplementedException ex)
  348. {
  349. throw ex;
  350. }
  351. }
  352. /* public static void resetHTMLData()
  353. {
  354. System.Xml.XmlNode newdoc = originalHTMLDocument(HTML);
  355. testdoc = ( System.Xml.XmlDocument) newdoc.CloneNode(true);
  356. }
  357. */
  358. public static System.Xml.XmlElement getRootNode()
  359. {
  360. return getDOMDocument().DocumentElement;
  361. }
  362. /* public void HTMLNodeObject(string argFirst,int argSecond)
  363. {
  364. string tagName = argFirst;//arguments[0];
  365. //int one = 1;
  366. //int two = 2;
  367. System.Xml.XmlNodeList nodeList=null;
  368. if (tagName==FRAMESET || tagName==FRAME)
  369. nodeList = framesetdoc.GetElementsByTagName(tagName);
  370. else
  371. nodeList = testdoc.GetElementsByTagName(tagName);
  372. if (argFirst != "") //if (arguments.length == one)
  373. this.node = nodeList.Item(util.FIRST);
  374. if (argSecond != -1) //else if (arguments.length == two)
  375. this.node = nodeList.Item(argSecond);//arguments[SECOND]);
  376. }
  377. public System.Xml.XmlNode originalHTMLDocument(string arg)
  378. {
  379. string tagName = arg;
  380. //int one = 1;
  381. //int two = 2;
  382. System.Xml.XmlNodeList nodeList = originaldoc.GetElementsByTagName(tagName);
  383. this.node = nodeList.Item(util.FIRST).CloneNode(true);
  384. return this.node;
  385. }
  386. */
  387. // public string getTableCaption(object table)
  388. // {
  389. // return table.caption;
  390. // }
  391. //
  392. // public void getTableHead(object table)
  393. // {
  394. // return table.tHead;
  395. // }
  396. //
  397. // public void getTableFoot(object table)
  398. // {
  399. // return table.tFoot;
  400. // }
  401. public static System.Xml.XmlNode nodeObject(int argFirst,int argSecond)//args)
  402. {
  403. string tagName = employee;
  404. System.Xml.XmlNodeList nodeList = null;
  405. System.Xml.XmlNode _node = null;
  406. nodeList = getRootNode().GetElementsByTagName(tagName);
  407. System.Xml.XmlElement parentNode = (System.Xml.XmlElement)nodeList.Item(argFirst);//arguments[FIRST]);
  408. if (argFirst != -1)//if (arguments.length == one)
  409. _node = parentNode;
  410. if (argSecond != -1)//else if (arguments.length == two)
  411. {
  412. System.Xml.XmlNodeList list = getSubNodes(parentNode);
  413. _node = getElement(getSubNodes(parentNode), argSecond);//arguments[SECOND]);
  414. //_node = getElement((System.Xml.XmlNodeList)getSubNodes(parentNode), argSecond);//arguments[SECOND]);
  415. }
  416. //_attributes = getAttributes(_node);
  417. //_subNodes = getSubNodes((System.Xml.XmlElement)_node);
  418. return _node;
  419. }
  420. public static System.Xml.XmlNodeList getSubNodes(System.Xml.XmlDocument node)
  421. {
  422. // GHT alternative for GetElementsByTagName("*")
  423. // System.Collections.ArrayList nodeArrayList = new System.Collections.ArrayList ();
  424. // getAllNodesRecursively (node, nodeArrayList);
  425. // return new XmlNodeArrayList (nodeArrayList);
  426. // GHT alternative for GetElementsByTagName("*")
  427. return node.GetElementsByTagName("*");
  428. }
  429. public static System.Xml.XmlNodeList getSubNodes(System.Xml.XmlElement node)
  430. {
  431. // GHT alternative for GetElementsByTagName("*")
  432. // System.Collections.ArrayList nodeArrayList = new System.Collections.ArrayList ();
  433. // getAllNodesRecursively (node, nodeArrayList);
  434. // return new XmlNodeArrayList (nodeArrayList);
  435. // GHT alternative for GetElementsByTagName("*")
  436. return node.GetElementsByTagName("*");
  437. }
  438. private static void getAllNodesRecursively (XmlNode argNode, System.Collections.ArrayList argArrayList)
  439. {
  440. XmlNodeList xmlNodeList = argNode.ChildNodes;
  441. foreach (XmlNode node in xmlNodeList)
  442. {
  443. if (node.NodeType == XmlNodeType.Element)
  444. {
  445. argArrayList.Add (node);
  446. getAllNodesRecursively (node, argArrayList);
  447. }
  448. }
  449. }
  450. public static System.Xml.XmlNode getElement(System.Xml.XmlNodeList subNodes,int elementAt)
  451. {
  452. return (System.Xml.XmlNode)subNodes.Item(elementAt);
  453. }
  454. public static System.Xml.XmlAttributeCollection getAttributes(System.Xml.XmlNode node)
  455. {
  456. return node.Attributes;
  457. }
  458. public static System.Xml.XmlDocumentType getDocType()
  459. {
  460. return (System.Xml.XmlDocumentType)getDOMDocument().ChildNodes.Item(SECOND);
  461. }
  462. public static System.Xml.XmlEntity getEntity(string name)
  463. {
  464. return (System.Xml.XmlEntity)getDocType().Entities.GetNamedItem(name);
  465. }
  466. public static System.Xml.XmlNode getNotation(string name)
  467. {
  468. return getDocType().Notations.GetNamedItem(name);
  469. }
  470. /*
  471. public void specPtr(index)
  472. {
  473. Spec = new Object();
  474. Spec['DOMImplementation'] = 'ID-102161490';
  475. Spec['DocumentFragment'] = 'ID-B63ED1A3';
  476. Spec['Document'] = 'i-Document';
  477. Spec['Node'] = 'ID-1950641247';
  478. Spec['NodeList'] = 'ID-536297177';
  479. Spec['NamedNodeMap'] = 'ID-1780488922';
  480. Spec['CharacterData'] = 'ID-FF21A306';
  481. Spec['Attr'] = 'ID-637646024';
  482. Spec['Element'] = 'ID-745549614';
  483. Spec['Text'] = 'ID-1312295772';
  484. Spec['Comment'] = 'ID-1728279322';
  485. Spec['CDATASection'] = 'ID-667469212';
  486. Spec['DocumentType'] = 'ID-412266927';
  487. Spec['Notation'] = 'ID-5431D1B9';
  488. Spec['Entity'] = 'ID-527DCFF2';
  489. Spec['EntityReference'] = 'ID-11C98490';
  490. Spec['ProcessingInstruction'] = 'ID-1004215813';
  491. Spec['HTMLCollection'] = 'ID-75708506';
  492. Spec['HTMLDocument'] = 'ID-26809268';
  493. Spec['HTMLElement'] = 'ID-58190037';
  494. Spec['HTMLHtmlElement'] = 'ID-33759296';
  495. Spec['HTMLHeadElement'] = 'ID-77253168';
  496. Spec['HTMLLinkElement'] = 'ID-35143001';
  497. Spec['HTMLTitleElement'] = 'ID-79243169';
  498. Spec['HTMLMetaElement'] = 'ID-37041454';
  499. Spec['HTMLBaseElement'] = 'ID-73629039';
  500. Spec['HTMLIsIndexElement'] = 'ID-85283003';
  501. Spec['HTMLStyleElement'] = 'ID-16428977';
  502. Spec['HTMLBodyElement'] = 'ID-62018039';
  503. Spec['HTMLFormElement'] = 'ID-40002357';
  504. Spec['HTMLSelectElement'] = 'ID-94282980';
  505. Spec['HTMLOptGroupElement'] = 'ID-38450247';
  506. Spec['HTMLOptionElement'] = 'ID-70901257';
  507. Spec['HTMLInputElement'] = 'ID-6043025';
  508. Spec['HTMLTextAreaElement'] = 'ID-24874179';
  509. Spec['HTMLButtonElement'] = 'ID-34812697';
  510. Spec['HTMLLabelElement'] = 'ID-13691394';
  511. Spec['HTMLFieldSetElement'] = 'ID-7365882';
  512. Spec['HTMLLegendElement'] = 'ID-21482039';
  513. Spec['HTMLUListElement'] = 'ID-86834457';
  514. Spec['HTMLOListElement'] = 'ID-58056027';
  515. Spec['HTMLDListElement'] = 'ID-52368974';
  516. Spec['HTMLDirectoryElement'] = 'ID-71600284';
  517. Spec['HTMLMenuElement'] = 'ID-72509186';
  518. Spec['HTMLLIElement'] = 'ID-74680021';
  519. Spec['HTMLBlockquoteElement'] = 'ID-40703765';
  520. Spec['HTMLDivElement'] = 'ID-22445964';
  521. Spec['HTMLParagraphElement'] = 'ID-84675076';
  522. Spec['HTMLHeadingElement'] = 'ID-43345119';
  523. Spec['HTMLQuoteElement'] = 'ID-70319763';
  524. Spec['HTMLPreElement'] = 'ID-11383425';
  525. Spec['HTMLBRElement'] = 'ID-56836063';
  526. Spec['HTMLBaseFontElement'] = 'ID-32774408';
  527. Spec['HTMLFontElement'] = 'ID-43943847';
  528. Spec['HTMLHRElement'] = 'ID-68228811';
  529. Spec['HTMLModElement'] = 'ID-79359609';
  530. Spec['HTMLAnchorElement'] = 'ID-48250443';
  531. Spec['HTMLImageElement'] = 'ID-17701901';
  532. Spec['HTMLObjectElement'] = 'ID-9893177';
  533. Spec['HTMLParamElement'] = 'ID-64077273';
  534. Spec['HTMLAppletElement'] = 'ID-31006348';
  535. Spec['HTMLMapElement'] = 'ID-94109203';
  536. Spec['HTMLAreaElement'] = 'ID-26019118';
  537. Spec['HTMLScriptElement'] = 'ID-81598695';
  538. Spec['HTMLTableElement'] = 'ID-64060425';
  539. Spec['HTMLTableCaptionElement'] = 'ID-12035137';
  540. Spec['HTMLTableColElement'] = 'ID-84150186';
  541. Spec['HTMLTableSectionElement'] = 'ID-67417573';
  542. Spec['HTMLTableRowElement'] = 'ID-6986576';
  543. Spec['HTMLTableCellElement'] = 'ID-82915075';
  544. Spec['HTMLFrameSetElement'] = 'ID-43829095';
  545. Spec['HTMLFrameElement'] = 'ID-97790553';
  546. Spec['HTMLIFrameElement'] = 'ID-50708718';
  547. return Spec[index];
  548. }
  549. public void setInfo()
  550. {
  551. dWin = self.parent.info;
  552. infodoc = dWin.document;
  553. iform = parent.interfaces.selectInterface;
  554. testInterface = iform.interface.options[iform.interface.selectedIndex].Value;
  555. cform = parent.categories.selectCategory;
  556. testCategory = cform.category.options[cform.category.selectedIndex].Value;
  557. sr_file = testCategory.toLowerCase()+"/"+testInterface+"/Requirements.html";
  558. src_file = testCategory.toLowerCase()+"/"+testInterface+"/"+testInterface+".html";
  559. util_file = "util.html";
  560. core_file = "spec/level-one-core.html";
  561. html_file = "spec/level-one-html.html";
  562. if (testCategory == "HTML")
  563. spec_ref = html_file + "#" + specPtr(testInterface);
  564. else
  565. spec_ref = core_file + "#" + specPtr(testInterface);
  566. infodoc.write("<BODY BGCOLOR=#0000FF LINK=#FFFF00 VLINK=#FFFF00>\n");
  567. infodoc.write("<CENTER>\n");
  568. infodoc.write("<P><P>\n");
  569. infodoc.write("<b><A HREF="+spec_ref+" TARGET=viewer>DOM REC</A></B><BR>\n");
  570. infodoc.write("<b><A HREF="+sr_file+" TARGET=viewer>SR's</A></b><BR>\n");
  571. infodoc.write("<b><A HREF="+src_file+" TARGET=viewer>Source</A></b><BR>\n");
  572. infodoc.write("<b><A HREF="+util_file+" TARGET=viewer>Utility</A></B><BR>\n");
  573. infodoc.write("</CENTER>\n");
  574. infodoc.close();
  575. }
  576. public void getInterfaces(option)
  577. {
  578. var Cats = new Object();
  579. Cats["Fundamental"] = ['DOMImplementation','Node', 'NodeList',
  580. 'Document', 'NamedNodeMap', 'CharacterData', 'Attr',
  581. 'Element', 'Text', 'Comment'];
  582. Cats["Extended"] = ['CDATASection', 'DocumentType', 'Notation', 'Entity',
  583. 'ProcessingInstruction' ];
  584. Cats["HTML"] = [
  585. 'HTMLAnchorElement',
  586. 'HTMLAppletElement',
  587. 'HTMLAreaElement',
  588. 'HTMLBaseElement',
  589. 'HTMLBaseFontElement',
  590. 'HTMLBlockquoteElement',
  591. 'HTMLBodyElement',
  592. 'HTMLBRElement',
  593. 'HTMLButtonElement',
  594. 'HTMLCollection',
  595. 'HTMLDirectoryElement',
  596. 'HTMLDivElement',
  597. 'HTMLDListElement',
  598. 'HTMLDocument',
  599. 'HTMLElement',
  600. 'HTMLFieldSetElement',
  601. 'HTMLFontElement',
  602. 'HTMLFormElement',
  603. 'HTMLFrameElement',
  604. 'HTMLFrameSetElement',
  605. 'HTMLHeadElement',
  606. 'HTMLHeadingElement',
  607. 'HTMLHRElement',
  608. 'HTMLHtmlElement',
  609. 'HTMLIFrameElement',
  610. 'HTMLImageElement',
  611. 'HTMLInputElement',
  612. 'HTMLIsIndexElement',
  613. 'HTMLLabelElement',
  614. 'HTMLLegendElement',
  615. 'HTMLLIElement',
  616. 'HTMLLinkElement',
  617. 'HTMLMapElement',
  618. 'HTMLMenuElement',
  619. 'HTMLMetaElement',
  620. 'HTMLModElement',
  621. 'HTMLObjectElement',
  622. 'HTMLOListElement',
  623. 'HTMLOptGroupElement',
  624. 'HTMLOptionElement',
  625. 'HTMLParagraphElement',
  626. 'HTMLParamElement',
  627. 'HTMLPreElement',
  628. 'HTMLQuoteElement',
  629. 'HTMLScriptElement',
  630. 'HTMLSelectElement',
  631. 'HTMLStyleElement',
  632. 'HTMLTableCaptionElement',
  633. 'HTMLTableCellElement',
  634. 'HTMLTableColElement',
  635. 'HTMLTableElement',
  636. 'HTMLTableRowElement',
  637. 'HTMLTableSectionElement',
  638. 'HTMLTextAreaElement',
  639. 'HTMLTitleElement',
  640. 'HTMLUListElement'];
  641. return Cats[option];
  642. }
  643. public void displayCategories()
  644. {
  645. cdoc.write("<BODY BGCOLOR=\"#0000FF\" TEXT=\"#FFFF00\">\n");
  646. cdoc.write("<CENTER>\n");
  647. cdoc.write("<IMG SRC=\"pix/nist.gif\" width=100 height=75>\n");
  648. cdoc.write("<P>\n");
  649. cdoc.write("<b>DOM<BR>Categories</b><p>\n");
  650. cdoc.write("<FORM NAME=selectCategory>\n");
  651. cdoc.write("<SELECT NAME=category onClick=displayInterfaces(this.form)>\n");
  652. cdoc.write("<OPTION SELECTED VALUE=Fundamental>Fundamental\n");
  653. cdoc.write("<OPTION VALUE=Extended>Extended\n");
  654. cdoc.write("<OPTION VALUE=HTML>HTML\n");
  655. cdoc.write("</select>\n");
  656. cdoc.write("</form>\n");
  657. cdoc.write("</CENTER>\n");
  658. cdoc.write("</BODY>\n");
  659. cdoc.close();
  660. }
  661. public void displayInterfaces(form)
  662. {
  663. cat = form.category.options[form.category.selectedIndex].Value;
  664. interfaces = getInterfaces(cat);
  665. idoc.write("<BODY BGCOLOR=\"#0000FF\" TEXT=\"#FFFF00\">\n");
  666. idoc.write("<CENTER>\n");
  667. idoc.write("<P>\n");
  668. idoc.write("<b>DOM<BR>Interfaces</b><p>\n");
  669. idoc.write("<FORM NAME=selectInterface>\n");
  670. idoc.write("<SELECT NAME=interface onClick=parent.navig()>\n");
  671. for (i = 0; i < interfaces.length; i++)
  672. idoc.write("<OPTION VALUE="+interfaces[i]+">"+interfaces[i]+"\n");
  673. idoc.write("</select>\n");
  674. idoc.write("</form>\n");
  675. idoc.write("</CENTER>\n");
  676. idoc.write("</BODY>\n");
  677. idoc.close();
  678. }
  679. */
  680. }//class
  681. }