You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/06/13 23:13:19 UTC
cvs commit: xml-axis/java/src/org/apache/axis/message/events EndPrefixEvent.java StartPrefixEvent.java
gdaniels 01/06/13 14:13:19
Modified: java/src/org/apache/axis/message ElementRecorder.java
SAXOutputter.java
Added: java/src/org/apache/axis/message/events EndPrefixEvent.java
StartPrefixEvent.java
Log:
Record prefix mapping events, and fix inverted args in SAXOutputter.
Revision Changes Path
1.8 +24 -2 xml-axis/java/src/org/apache/axis/message/ElementRecorder.java
Index: ElementRecorder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/ElementRecorder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElementRecorder.java 2001/06/12 15:43:14 1.7
+++ ElementRecorder.java 2001/06/13 21:13:12 1.8
@@ -83,7 +83,28 @@
if (DEBUG_LOG)
System.out.println("New ElementRecorder " + this);
}
-
+
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException
+ {
+ if (DEBUG_LOG) {
+ System.err.println("(rec) startMapping ['" + prefix + "'->'" +
+ uri + "']");
+ }
+
+ _events.addElement(new StartPrefixEvent(prefix, uri));
+ }
+
+ public void endPrefixMapping(String prefix)
+ throws SAXException
+ {
+ if (DEBUG_LOG) {
+ System.err.println("(rec) endMapping ['" + prefix + "']");
+ }
+
+ _events.addElement(new EndPrefixEvent(prefix));
+ }
+
public void startElement(String namespace, String localName,
String qName, Attributes attributes)
throws SAXException
@@ -93,7 +114,8 @@
localName + "]");
}
- _events.addElement(new StartElementEvent(namespace, localName, qName, attributes));
+ _events.addElement(new StartElementEvent(namespace, localName,
+ qName, attributes));
if (nextHandler != null)
nextHandler.startElement(namespace, localName, qName, attributes);
1.2 +1 -1 xml-axis/java/src/org/apache/axis/message/SAXOutputter.java
Index: SAXOutputter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SAXOutputter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SAXOutputter.java 2001/04/26 22:53:40 1.1
+++ SAXOutputter.java 2001/06/13 21:13:13 1.2
@@ -26,7 +26,7 @@
}
public void startPrefixMapping(String p1, String p2) throws SAXException {
- context.registerPrefixForURI(p2, p1);
+ context.registerPrefixForURI(p1,p2);
}
public void endPrefixMapping(String p1) throws SAXException {
1.1 xml-axis/java/src/org/apache/axis/message/events/EndPrefixEvent.java
Index: EndPrefixEvent.java
===================================================================
package org.apache.axis.message.events;
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.apache.axis.encoding.SerializationContext;
import java.io.IOException;
/** An <code>EndPrefixEvent</code>
*
* @author Glen Daniels (gdaniels@macromedia.com)
*/
public class EndPrefixEvent implements SAXEvent
{
String _prefix;
public EndPrefixEvent(String prefix)
{
_prefix = prefix;
}
public void publishToHandler(ContentHandler handler) throws SAXException
{
handler.endPrefixMapping(_prefix);
}
public void output(SerializationContext context) throws IOException
{
context.endPrefix(_prefix);
}
public String toString()
{
return "[EndPrefixEvent " + _prefix + " ]";
}
}
1.1 xml-axis/java/src/org/apache/axis/message/events/StartPrefixEvent.java
Index: StartPrefixEvent.java
===================================================================
package org.apache.axis.message.events;
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.apache.axis.encoding.SerializationContext;
import java.io.IOException;
/** An <code>StartPrefixEvent</code>
*
* @author Glen Daniels (gdaniels@macromedia.com)
*/
public class StartPrefixEvent implements SAXEvent
{
String _namespace;
String _prefix;
public StartPrefixEvent(String prefix, String namespaceURI)
{
_prefix = prefix;
_namespace = namespaceURI;
}
public void publishToHandler(ContentHandler handler) throws SAXException
{
handler.startPrefixMapping(_prefix, _namespace);
}
public void output(SerializationContext context) throws IOException
{
context.registerPrefixForURI(_prefix, _namespace);
}
public String toString()
{
return "[StartPrefixEvent " + _prefix + "->" + _namespace + " ]";
}
}