01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.aegis.xml;
19:
20: import javax.xml.namespace.QName;
21:
22: /**
23: * Writes messages to an output stream.
24: *
25: * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
26: */
27: public interface MessageWriter {
28: void writeValue(Object value);
29:
30: void writeValueAsInt(Integer i);
31:
32: void writeValueAsCharacter(Character char1);
33:
34: void writeValueAsDouble(Double double1);
35:
36: void writeValueAsLong(Long l);
37:
38: void writeValueAsFloat(Float f);
39:
40: void writeValueAsShort(Short short1);
41:
42: void writeValueAsBoolean(boolean b);
43:
44: MessageWriter getAttributeWriter(String name);
45:
46: MessageWriter getAttributeWriter(String name, String namespace);
47:
48: MessageWriter getAttributeWriter(QName qname);
49:
50: MessageWriter getElementWriter(String name);
51:
52: MessageWriter getElementWriter(String name, String namespace);
53:
54: MessageWriter getElementWriter(QName qname);
55:
56: String getPrefixForNamespace(String namespace);
57:
58: /**
59: * Get a prefix for a namespace. After calling this, the prefix returned is
60: * registered with the namespace. <p/> This method will make an attempt to
61: * use the hint prefix if possible. If the namespace is already registered
62: * or the hint is already registered with a different namespace then the
63: * behavior will be the same as the non-hint version.
64: *
65: * @param namespace the namespace to retrieve the prefix for
66: * @param hint the hint for the prefix.
67: * @return the prefix associated with the namespace
68: */
69: String getPrefixForNamespace(String namespace, String hint);
70:
71: /**
72: * Tells the MessageWriter that writing operations are completed so it can
73: * write the end element.
74: */
75: void close();
76:
77: /**
78: * As per <a href="http://www.w3.org/TR/xmlschema-1/#xsi_type">2.6.1</a> in
79: * XML Schema Part 1: "An element information item in an instance may,
80: * however, explicitly assert its type using the attribute
81: * <code>xsi:type</code>."
82: *
83: * @param type the QName of the type being referenced.
84: */
85: void writeXsiType(QName qn);
86:
87: void writeXsiNil();
88: }
|