KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > platform > xml > XMLPlatform


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.platform.xml;
23
24 import java.net.URL JavaDoc;
25 import org.w3c.dom.Document JavaDoc;
26 import org.w3c.dom.Node JavaDoc;
27 import org.w3c.dom.NodeList JavaDoc;
28 import org.w3c.dom.Text JavaDoc;
29 import org.xml.sax.ErrorHandler JavaDoc;
30
31 public interface XMLPlatform {
32
33     /**
34      * Creates a new document.
35      * @return the new document
36      * @throws XMLPlatformException
37      */

38     public Document JavaDoc createDocument() throws XMLPlatformException;
39
40     /**
41      * Creates a new document with the specified public and system
42      * identifiers in the DOCTYPE, and adds a root element with the
43      * specified name.
44      * @param name the name of the root element
45      * publicIdentifier the public identifier
46      * systemIdentifier the system identifier
47      * @return the new document
48      * @throws XMLPlatformException
49      */

50     public Document JavaDoc createDocumentWithPublicIdentifier(String JavaDoc name, String JavaDoc publicIdentifier, String JavaDoc systemIdentifier) throws XMLPlatformException;
51
52     /**
53      * Creates a new document with the specified system identifier in
54      * the DOCTYPE, and adds a root element with the specified name.
55      * @param name the name of the root element
56      * systemIdentifier the system identifier
57      * @return the new document
58      * @throws XMLPlatformException
59      */

60     public Document JavaDoc createDocumentWithSystemIdentifier(String JavaDoc name, String JavaDoc systemIdentifier) throws XMLPlatformException;
61
62     /**
63      * Check to see if the text node represents a whitespace node.
64      * @param text a potential whitespace node
65      * @return if the text node represents a whitespace node.
66      */

67     public boolean isWhitespaceNode(Text JavaDoc text);
68
69     /**
70      * Return the namespace URI for the specified namespace prefix
71      * relative to the context node.
72      * @param contextNode the node to be looking for the namespace
73      * URI
74      * namespacePrefix the namespace prefix
75      * @return the namespace URI for the specified prefix
76      * @throws XMLPlatformException
77      */

78     public String JavaDoc resolveNamespacePrefix(Node JavaDoc contextNode, String JavaDoc namespacePrefix) throws XMLPlatformException;
79
80     /**
81      * Execute advanced XPath statements that are required for TopLink EIS.
82      * @param contextNode the node relative to which the XPath
83      * statement will be executed.
84      * xPath the XPath statement
85      * namespaceResolver used to resolve namespace prefixes
86      * to the corresponding namespace URI
87      * @return the XPath result
88      * @throws XMLPlatformException
89      */

90     public NodeList JavaDoc selectNodesAdvanced(Node JavaDoc contextNode, String JavaDoc xPath, XMLNamespaceResolver xmlNamespaceResolver) throws XMLPlatformException;
91
92     /**
93      * Execute advanced XPath statements that are required for TopLink EIS.
94      * @param contextNode
95      * @param xPath
96      * @param xmlNamespaceResolver
97      * @return
98      * @throws XMLPlatformException
99      */

100     public Node JavaDoc selectSingleNodeAdvanced(Node JavaDoc contextNode, String JavaDoc xPath, XMLNamespaceResolver xmlNamespaceResolver) throws XMLPlatformException;
101
102     /**
103      * Return a concrete implementation of the XML parser abstraction that is
104      * compatible with the XML Platform.
105      * @return a platform specific XML parser
106      */

107     public XMLParser newXMLParser();
108
109     /**
110      * Return a concrete implementation of the XML transformer abstraction that is
111      * compatible with the XML Platform.
112      * @return a platform specific XML transfomer
113      */

114     public XMLTransformer newXMLTransformer();
115
116     /**
117      * Validate the document against the XML Schema
118      * @param document the document to be validated
119      * xmlSchemaURL the XML Schema
120      * errorHandler a mechanism for selectively ignoring errors
121      * @return true if the document is valid, else false
122      * @throws XMLPlatformException
123      */

124     public boolean validateDocument(Document JavaDoc document, URL JavaDoc xmlSchemaURL, ErrorHandler JavaDoc errorHandler) throws XMLPlatformException;
125 }
126
Popular Tags