You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by il...@apache.org on 2012/04/27 14:53:59 UTC

svn commit: r1331399 - in /cocoon/subprojects/cocoon-xml/trunk: ./ src/main/java/org/apache/cocoon/xml/sax/ParamSAXBuffer.java src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java

Author: ilgrosso
Date: Fri Apr 27 12:53:58 2012
New Revision: 1331399

URL: http://svn.apache.org/viewvc?rev=1331399&view=rev
Log:
[COCOON3-64] Moving ParamSAXBuffer from C3's I18nTRansformer to its own place

Added:
    cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXBuffer.java
      - copied unchanged from r1330671, cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/xml/sax/ParamSAXBuffer.java
    cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java   (with props)
Modified:
    cocoon/subprojects/cocoon-xml/trunk/   (props changed)

Propchange: cocoon/subprojects/cocoon-xml/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 27 12:53:58 2012
@@ -0,0 +1 @@
+target

Added: cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java?rev=1331399&view=auto
==============================================================================
--- cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java (added)
+++ cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java Fri Apr 27 12:53:58 2012
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cocoon.xml.sax;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * SAX buffer which passes only the content of the document element to the content handler. An element with an arbitrary
+ * local name can be used the wrapper element.
+ */
+public class ParamSAXFragmentBuffer extends ParamSAXBuffer {
+
+    private static final long serialVersionUID = -9153292487513611344L;
+
+    private int depth = 0;
+
+    @Override
+    public void startDocument() throws SAXException {
+    }
+
+    @Override
+    public void endDocument() throws SAXException {
+    }
+
+    @Override
+    public void startElement(final String namespaceURI, final String localName, final String qName,
+            final Attributes atts) throws SAXException {
+
+        if (this.depth > 0) {
+            super.startElement(namespaceURI, localName, qName, atts);
+        }
+        this.depth++;
+    }
+
+    @Override
+    public void endElement(final String namespaceURI, final String localName, final String qName)
+            throws SAXException {
+
+        this.depth--;
+        if (this.depth > 0) {
+            super.endElement(namespaceURI, localName, qName);
+        }
+    }
+}

Propchange: cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: cocoon/subprojects/cocoon-xml/trunk/src/main/java/org/apache/cocoon/xml/sax/ParamSAXFragmentBuffer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain