KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > xml > client > impl > XMLParserImplIE6


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.xml.client.impl;
17
18 import com.google.gwt.core.client.JavaScriptObject;
19
20 /**
21  * This class is the IE6 implementation of the XMLParser interface.
22  */

23 class XMLParserImplIE6 extends XMLParserImpl {
24
25   protected native JavaScriptObject createDocumentImpl() /*-{
26     var doc = new ActiveXObject("MSXML2.DOMDocument");
27     doc.preserveWhiteSpace = true;
28     doc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
29     doc.setProperty("SelectionLanguage", "XPath");
30     return doc;
31   }-*/
;
32
33   protected native JavaScriptObject getElementByIdImpl(JavaScriptObject o,
34       String JavaDoc elementId) /*-{
35     var out = o.nodeFromID(elementId);
36     return (out == null) ? null : out;
37   }-*/
;
38
39   protected native JavaScriptObject getElementsByTagNameImpl(JavaScriptObject o,
40       String JavaDoc tagName) /*-{
41     return o.selectNodes(".//*[local-name()='" + tagName + "']");
42   }-*/
;
43
44   protected native String JavaDoc getPrefixImpl(JavaScriptObject jsObject) /*-{
45     return jsObject.prefix;
46   }-*/
;
47
48   protected native JavaScriptObject importNodeImpl(JavaScriptObject o,
49       JavaScriptObject importedNode, boolean deep) /*-{
50     // IE6 does not seem to need or want nodes to be imported
51     // as appends from different docs work perfectly
52     // and this method is not supplied until MSXML5.0
53     return importedNode;
54   }-*/
;
55   
56   protected native JavaScriptObject parseImpl(String JavaDoc contents) /*-{
57     var doc = this.@com.google.gwt.xml.client.impl.XMLParserImplIE6::createDocumentImpl()();
58     if(!doc.loadXML(contents)) {
59       var err = doc.parseError;
60       throw new Error("line " + err.line + ", char " + err.linepos + ":" + err.reason);
61     } else {
62       return doc;
63     }
64   }-*/
;
65
66 }
67
Popular Tags