1 /*
2 * Copyright (c) 2004 World Wide Web Consortium,
3 *
4 * (Massachusetts Institute of Technology, European Research Consortium for
5 * Informatics and Mathematics, Keio University). All Rights Reserved. This
6 * work is distributed under the W3C(r) Software License [1] in the hope that
7 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11 */
13 // File: http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/ls.idl
15 #ifndef _LS_IDL_
16 #define _LS_IDL_
18 #include "dom.idl"
19 #include "events.idl"
20 #include "traversal.idl"
22 #pragma prefix "dom.w3c.org"
23 module ls
24 {
26 typedef Object LSInputStream;
28 typedef Object LSOutputStream;
30 typedef Object LSReader;
32 typedef Object LSWriter;
34 typedef dom::DOMString DOMString;
35 typedef dom::DOMConfiguration DOMConfiguration;
36 typedef dom::Node Node;
37 typedef dom::Document Document;
38 typedef dom::Element Element;
40 interface LSParser;
41 interface LSSerializer;
42 interface LSInput;
43 interface LSOutput;
44 interface LSParserFilter;
45 interface LSSerializerFilter;
47 exception LSException {
48 unsigned short code;
49 };
50 // LSExceptionCode
51 const unsigned short PARSE_ERR = 81;
52 const unsigned short SERIALIZE_ERR = 82;
55 interface DOMImplementationLS {
57 // DOMImplementationLSMode
58 const unsigned short MODE_SYNCHRONOUS = 1;
59 const unsigned short MODE_ASYNCHRONOUS = 2;
61 LSParser createLSParser(in unsigned short mode,
62 in DOMString schemaType)
63 raises(dom::DOMException);
64 LSSerializer createLSSerializer();
65 LSInput createLSInput();
66 LSOutput createLSOutput();
67 };
69 interface LSParser {
70 readonly attribute DOMConfiguration domConfig;
71 attribute LSParserFilter filter;
72 readonly attribute boolean async;
73 readonly attribute boolean busy;
74 Document parse(in LSInput input)
75 raises(dom::DOMException,
76 LSException);
77 Document parseURI(in DOMString uri)
78 raises(dom::DOMException,
79 LSException);
81 // ACTION_TYPES
82 const unsigned short ACTION_APPEND_AS_CHILDREN = 1;
83 const unsigned short ACTION_REPLACE_CHILDREN = 2;
84 const unsigned short ACTION_INSERT_BEFORE = 3;
85 const unsigned short ACTION_INSERT_AFTER = 4;
86 const unsigned short ACTION_REPLACE = 5;
88 Node parseWithContext(in LSInput input,
89 in Node contextArg,
90 in unsigned short action)
91 raises(dom::DOMException,
92 LSException);
93 void abort();
94 };
96 interface LSInput {
97 // Depending on the language binding in use,
98 // this attribute may not be available.
99 attribute LSReader characterStream;
100 attribute LSInputStream byteStream;
101 attribute DOMString stringData;
102 attribute DOMString systemId;
103 attribute DOMString publicId;
104 attribute DOMString baseURI;
105 attribute DOMString encoding;
106 attribute boolean certifiedText;
107 };
109 interface LSResourceResolver {
110 LSInput resolveResource(in DOMString type,
111 in DOMString namespaceURI,
112 in DOMString publicId,
113 in DOMString systemId,
114 in DOMString baseURI);
115 };
117 interface LSParserFilter {
119 // Constants returned by startElement and acceptNode
120 const short FILTER_ACCEPT = 1;
121 const short FILTER_REJECT = 2;
122 const short FILTER_SKIP = 3;
123 const short FILTER_INTERRUPT = 4;
125 unsigned short startElement(in Element elementArg);
126 unsigned short acceptNode(in Node nodeArg);
127 readonly attribute unsigned long whatToShow;
128 };
130 interface LSSerializer {
131 readonly attribute DOMConfiguration domConfig;
132 attribute DOMString newLine;
133 attribute LSSerializerFilter filter;
134 boolean write(in Node nodeArg,
135 in LSOutput destination)
136 raises(LSException);
137 boolean writeToURI(in Node nodeArg,
138 in DOMString uri)
139 raises(LSException);
140 DOMString writeToString(in Node nodeArg)
141 raises(dom::DOMException,
142 LSException);
143 };
145 interface LSOutput {
146 // Depending on the language binding in use,
147 // this attribute may not be available.
148 attribute LSWriter characterStream;
149 attribute LSOutputStream byteStream;
150 attribute DOMString systemId;
151 attribute DOMString encoding;
152 };
154 interface LSProgressEvent : events::Event {
155 readonly attribute LSInput input;
156 readonly attribute unsigned long position;
157 readonly attribute unsigned long totalSize;
158 };
160 interface LSLoadEvent : events::Event {
161 readonly attribute Document newDocument;
162 readonly attribute LSInput input;
163 };
165 interface LSSerializerFilter : traversal::NodeFilter {
166 readonly attribute unsigned long whatToShow;
167 };
168 };
170 #endif // _LS_IDL_