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/04/27 17:29:48 UTC
cvs commit: xml-axis/java/src/org/apache/axis/message InputStreamBody.java DOMBody.java
gdaniels 01/04/27 08:29:48
Added: java/src/org/apache/axis/message InputStreamBody.java
DOMBody.java
Log:
Forgot to add these.
Revision Changes Path
1.1 xml-axis/java/src/org/apache/axis/message/InputStreamBody.java
Index: InputStreamBody.java
===================================================================
package org.apache.axis.message;
import java.io.*;
import java.util.*;
import org.apache.axis.encoding.*;
import org.xml.sax.*;
public class InputStreamBody extends SOAPBodyElement
{
protected InputStream inputStream;
public InputStreamBody(InputStream inputStream)
{
this.inputStream = inputStream;
}
public void output(SerializationContext context) throws IOException
{
try {
byte[] buf = new byte[ inputStream.available() ];
inputStream.read( buf );
String contents = new String(buf);
context.writeString(contents);
}
catch( IOException ex ) {
throw ex;
}
catch( Exception e ) {
e.printStackTrace( System.err );
}
}
}
1.1 xml-axis/java/src/org/apache/axis/message/DOMBody.java
Index: DOMBody.java
===================================================================
package org.apache.axis.message;
import java.io.*;
import java.util.*;
import org.apache.axis.encoding.*;
import org.apache.axis.utils.QName;
import org.xml.sax.helpers.AttributesImpl;
import org.w3c.dom.*;
public class DOMBody extends SOAPBodyElement
{
protected Element element;
public DOMBody(Element element)
{
this.element = element;
}
public void output(SerializationContext context) throws IOException
{
outputElement(element, context);
}
void outputElement(Element el, SerializationContext context)
throws IOException
{
AttributesImpl attributes = null;
NamedNodeMap attrMap = el.getAttributes();
if (attrMap.getLength() > 0) {
attributes = new AttributesImpl();
for (int i = 0; i < attrMap.getLength(); i++) {
}
}
QName qName = new QName(el.getNamespaceURI(), el.getTagName());
context.startElement(qName, attributes);
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child instanceof Element) {
outputElement((Element)child, context);
} else if (child instanceof Text) {
context.writeString(((Text)child).getData());
}
}
context.endElement();
}
}