108 try { |
108 try { |
109 visitor.startDocument(); |
109 visitor.startDocument(); |
110 visitor.on(grammar); |
110 visitor.on(grammar); |
111 visitor.endDocument(); |
111 visitor.endDocument(); |
112 } catch (XMLWriterException e) { |
112 } catch (XMLWriterException e) { |
113 throw (XMLStreamException) e.getCause(); |
113 if (e.getCause() instanceof XMLStreamException) { |
|
114 throw (XMLStreamException) e.getCause(); |
|
115 } else { |
|
116 throw new XMLStreamException(e); |
|
117 } |
114 } |
118 } |
115 } |
119 } |
116 |
120 |
117 /** |
121 /** |
118 * Prints XML fragment for the given pattern. |
122 * Prints XML fragment for the given pattern. |
121 */ |
125 */ |
122 public void print(DPattern pattern) throws XMLStreamException { |
126 public void print(DPattern pattern) throws XMLStreamException { |
123 try { |
127 try { |
124 pattern.accept(visitor); |
128 pattern.accept(visitor); |
125 } catch (XMLWriterException e) { |
129 } catch (XMLWriterException e) { |
126 throw (XMLStreamException) e.getCause(); |
130 if (e.getCause() instanceof XMLStreamException) { |
|
131 throw (XMLStreamException) e.getCause(); |
|
132 } else { |
|
133 throw new XMLStreamException(e); |
|
134 } |
127 } |
135 } |
128 } |
136 } |
129 |
137 |
130 /** |
138 /** |
131 * Prints XML fragment for the given name class. |
139 * Prints XML fragment for the given name class. |
134 */ |
142 */ |
135 public void print(NameClass nc) throws XMLStreamException { |
143 public void print(NameClass nc) throws XMLStreamException { |
136 try { |
144 try { |
137 nc.accept(ncVisitor); |
145 nc.accept(ncVisitor); |
138 } catch (XMLWriterException e) { |
146 } catch (XMLWriterException e) { |
139 throw (XMLStreamException) e.getCause(); |
147 if (e.getCause() instanceof XMLStreamException) { |
|
148 throw (XMLStreamException) e.getCause(); |
|
149 } else { |
|
150 throw new XMLStreamException(e); |
|
151 } |
140 } |
152 } |
141 } |
153 } |
142 |
154 |
143 public void print(Node node) throws XMLStreamException { |
155 public void print(Node node) throws XMLStreamException { |
144 domPrinter.print(node); |
156 domPrinter.print(node); |