You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/02/28 19:44:48 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/serialization AbstractTextSerializer.java
vgritsenko 2004/02/28 10:44:48
Modified: src/java/org/apache/cocoon/serialization
AbstractTextSerializer.java
Log:
update to work with avalon (similar to 2.2)
Revision Changes Path
1.7 +44 -44 cocoon-2.1/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
Index: AbstractTextSerializer.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractTextSerializer.java 3 Nov 2003 21:23:45 -0000 1.6
+++ AbstractTextSerializer.java 28 Feb 2004 18:44:48 -0000 1.7
@@ -197,15 +197,15 @@
}
/**
- * Uses the context to retrieve a default encoding for the serializers.
+ * Uses the context to retrieve a default encoding for the serializers.
*/
public void contextualize(Context context) throws ContextException {
String defaultEncoding = (String)context.get(Constants.CONTEXT_DEFAULT_ENCODING);
if (defaultEncoding != null) {
- this.format.setProperty(OutputKeys.ENCODING, defaultEncoding);
+ this.format.setProperty(OutputKeys.ENCODING, defaultEncoding);
}
- }
-
+ }
+
/**
* Set the configurations for this serializer.
*/
@@ -217,46 +217,46 @@
// outputBufferSize = bsc.getValueAsInteger(DEFAULT_BUFFER_SIZE);
// configure xalan
- Configuration cdataSectionElements = conf.getChild("cdata-section-elements");
- Configuration dtPublic = conf.getChild("doctype-public");
- Configuration dtSystem = conf.getChild("doctype-system");
- Configuration encoding = conf.getChild("encoding");
- Configuration indent = conf.getChild("indent");
- Configuration mediaType = conf.getChild("media-type");
- Configuration method = conf.getChild("method");
- Configuration omitXMLDeclaration = conf.getChild("omit-xml-declaration");
- Configuration standAlone = conf.getChild("standalone");
- Configuration version = conf.getChild("version");
-
- if (!cdataSectionElements.getLocation().equals("-")) {
- format.put(OutputKeys.CDATA_SECTION_ELEMENTS, cdataSectionElements.getValue());
- }
- if (!dtPublic.getLocation().equals("-")) {
- format.put(OutputKeys.DOCTYPE_PUBLIC, dtPublic.getValue());
- }
- if (!dtSystem.getLocation().equals("-")) {
- format.put(OutputKeys.DOCTYPE_SYSTEM, dtSystem.getValue());
- }
- if (!encoding.getLocation().equals("-")) {
- format.put(OutputKeys.ENCODING, encoding.getValue());
- }
- if (!indent.getLocation().equals("-")) {
- format.put(OutputKeys.INDENT, indent.getValue());
- }
- if (!mediaType.getLocation().equals("-")) {
- format.put(OutputKeys.MEDIA_TYPE, mediaType.getValue());
- }
- if (!method.getLocation().equals("-")) {
- format.put(OutputKeys.METHOD, method.getValue());
+ String cdataSectionElements = conf.getChild("cdata-section-elements").getValue(null);
+ String dtPublic = conf.getChild("doctype-public").getValue(null);
+ String dtSystem = conf.getChild("doctype-system").getValue(null);
+ String encoding = conf.getChild("encoding").getValue(null);
+ String indent = conf.getChild("indent").getValue(null);
+ String mediaType = conf.getChild("media-type").getValue(null);
+ String method = conf.getChild("method").getValue(null);
+ String omitXMLDeclaration = conf.getChild("omit-xml-declaration").getValue(null);
+ String standAlone = conf.getChild("standalone").getValue(null);
+ String version = conf.getChild("version").getValue(null);
+
+ if (cdataSectionElements != null) {
+ format.put(OutputKeys.CDATA_SECTION_ELEMENTS, cdataSectionElements);
+ }
+ if (dtPublic != null) {
+ format.put(OutputKeys.DOCTYPE_PUBLIC, dtPublic);
+ }
+ if (dtSystem != null) {
+ format.put(OutputKeys.DOCTYPE_SYSTEM, dtSystem);
+ }
+ if (encoding != null) {
+ format.put(OutputKeys.ENCODING, encoding);
+ }
+ if (indent != null) {
+ format.put(OutputKeys.INDENT, indent);
+ }
+ if (mediaType != null) {
+ format.put(OutputKeys.MEDIA_TYPE, mediaType);
+ }
+ if (method != null) {
+ format.put(OutputKeys.METHOD, method);
}
- if (!omitXMLDeclaration.getLocation().equals("-")) {
- format.put(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration.getValue());
+ if (omitXMLDeclaration != null) {
+ format.put(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration);
}
- if (!standAlone.getLocation().equals("-")) {
- format.put(OutputKeys.STANDALONE, standAlone.getValue());
+ if (standAlone != null) {
+ format.put(OutputKeys.STANDALONE, standAlone);
}
- if (!version.getLocation().equals("-")) {
- format.put(OutputKeys.VERSION, version.getValue());
+ if (version != null) {
+ format.put(OutputKeys.VERSION, version);
}
Configuration tFactoryConf = conf.getChild("transformer-factory", false);
@@ -447,7 +447,7 @@
// try to restore the qName. The map already contains the colon
if (null != eltUri && eltUri.length() != 0 && this.uriToPrefixMap.containsKey(eltUri)) {
- eltQName = (String) this.uriToPrefixMap.get(eltUri) + eltLocalName;
+ eltQName = this.uriToPrefixMap.get(eltUri) + eltLocalName;
}
if (this.hasMappings) {
// Add xmlns* attributes where needed
@@ -519,7 +519,7 @@
public void endElement(String eltUri, String eltLocalName, String eltQName) throws SAXException {
// try to restore the qName. The map already contains the colon
if (null != eltUri && eltUri.length() != 0 && this.uriToPrefixMap.containsKey(eltUri)) {
- eltQName = (String) this.uriToPrefixMap.get(eltUri) + eltLocalName;
+ eltQName = this.uriToPrefixMap.get(eltUri) + eltLocalName;
}
super.endElement(eltUri, eltLocalName, eltQName);
}