use of org.apache.axiom.core.stream.StreamException in project webservices-axiom by apache.
the class ContentHandlerXmlHandler method endElement.
public void endElement() throws StreamException {
try {
String elementQName = elementNameStack.pop();
String elementLocalName = elementNameStack.pop();
String elementURI = elementNameStack.pop();
contentHandler.endElement(elementURI, elementLocalName, elementQName);
for (int i = bindings - 1; i >= scopeStack[depth - 1]; i--) {
contentHandler.endPrefixMapping(prefixStack[i]);
}
bindings = scopeStack[--depth];
} catch (SAXException ex) {
throw new StreamException(ex);
}
}
use of org.apache.axiom.core.stream.StreamException in project webservices-axiom by apache.
the class SAXReader method proceed.
@Override
public boolean proceed() throws StreamException {
XMLReader reader = source.getXMLReader();
XmlHandlerContentHandler contentHandler = new XmlHandlerContentHandler(handler, expandEntityReferences);
reader.setContentHandler(contentHandler);
reader.setDTDHandler(contentHandler);
try {
reader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
} catch (SAXException ex) {
// Ignore
}
try {
reader.setProperty("http://xml.org/sax/properties/declaration-handler", contentHandler);
} catch (SAXException ex) {
// Ignore
}
try {
reader.parse(source.getInputSource());
} catch (IOException ex) {
throw new StreamException(ex);
} catch (SAXException ex) {
throw new StreamException(ex);
}
return true;
}
use of org.apache.axiom.core.stream.StreamException in project webservices-axiom by apache.
the class Serializer method attributeDecl.
/**
* Report an attribute type declaration.
*
* <p>Only the effective (first) declaration for an attribute will
* be reported. The type will be one of the strings "CDATA",
* "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
* "ENTITIES", or "NOTATION", or a parenthesized token group with
* the separator "|" and all whitespace removed.</p>
*
* @param eName The name of the associated element.
* @param aName The name of the attribute.
* @param type A string representing the attribute type.
* @param valueDefault A string representing the attribute default
* ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
* none of these applies.
* @param value A string representing the attribute's default value,
* or null if there is none.
* @exception StreamException The application may raise an exception.
*/
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws StreamException {
try {
DTDprolog();
writer.write("<!ATTLIST ");
writer.write(eName);
writer.write(' ');
writer.write(aName);
writer.write(' ');
writer.write(type);
if (valueDefault != null) {
writer.write(' ');
writer.write(valueDefault);
}
//writer.write(" ");
//writer.write(value);
writer.write(">\n");
} catch (IOException ex) {
throw new StreamException(ex);
}
}
use of org.apache.axiom.core.stream.StreamException in project webservices-axiom by apache.
the class Serializer method unparsedEntityDecl.
public void unparsedEntityDecl(String name, String pubID, String sysID, String notationName) throws StreamException {
try {
DTDprolog();
writer.write("<!ENTITY ");
writer.write(name);
if (pubID != null) {
writer.write(" PUBLIC \"");
writer.write(pubID);
} else {
writer.write(" SYSTEM \"");
writer.write(sysID);
}
writer.write("\" NDATA ");
writer.write(notationName);
writer.write(" >\n");
} catch (IOException ex) {
throw new StreamException(ex);
}
}
use of org.apache.axiom.core.stream.StreamException in project webservices-axiom by apache.
the class Serializer method startCDATASection.
@Override
public void startCDATASection() throws StreamException {
closeStartTag();
try {
writer.write("<![CDATA[");
} catch (IOException ex) {
throw new StreamException(ex);
}
switchContext(CDATA_SECTION);
}
Aggregations