You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by lg...@apache.org on 2005/04/19 16:17:13 UTC
svn commit: r161894 -
cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java
Author: lgawron
Date: Tue Apr 19 07:17:13 2005
New Revision: 161894
URL: http://svn.apache.org/viewcvs?view=rev&rev=161894
Log:
svn props
Modified:
cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java (contents, props changed)
Modified: cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java?view=diff&r1=161893&r2=161894
==============================================================================
--- cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java (original)
+++ cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java Tue Apr 19 07:17:13 2005
@@ -1,70 +1,70 @@
-/*
- * Created on 2005-04-19
- */
-package org.apache.cocoon.template.jxtg.instruction;
-
-import java.util.Stack;
-
-import org.apache.cocoon.components.expression.ExpressionContext;
-import org.apache.cocoon.template.jxtg.environment.ExecutionContext;
-import org.apache.cocoon.template.jxtg.expression.JXTExpression;
-import org.apache.cocoon.template.jxtg.script.event.Event;
-import org.apache.cocoon.template.jxtg.script.event.StartElement;
-import org.apache.cocoon.template.jxtg.script.event.StartInstruction;
-import org.apache.cocoon.xml.AttributeAwareXMLConsumer;
-import org.apache.cocoon.xml.XMLConsumer;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-public class StartAttribute extends StartInstruction {
- private JXTExpression name;
- private JXTExpression value;
-
- public StartAttribute(StartElement raw, Attributes attrs, Stack stack)
- throws SAXException {
- super(raw);
-
- Locator locator = getLocation();
- String name = attrs.getValue("name");
- if (name == null) {
- throw new SAXParseException("parameter: \"name\" is required",
- locator, null);
- }
- this.name = JXTExpression.compileExpr(name, "parameter: \"name\": ",
- locator);
-
- String value = attrs.getValue("value");
- if (value == null)
- throw new SAXParseException("parameter: \"value\" is required",
- locator, null);
-
- this.value = JXTExpression.compileExpr(value, "parameter: \"value\": ",
- locator);
- }
-
- public Event execute(final XMLConsumer consumer,
- ExpressionContext expressionContext,
- ExecutionContext executionContext, MacroContext macroContext,
- Event startEvent, Event endEvent) throws SAXException {
-
- String nameStr = null;
- String valueStr = "";
- try {
- nameStr = this.name.getStringValue(expressionContext);
- valueStr = this.value.getStringValue(expressionContext);
- } catch (Exception exc) {
- throw new SAXParseException(exc.getMessage(), getLocation(), exc);
- }
- if (consumer instanceof AttributeAwareXMLConsumer) {
- AttributeAwareXMLConsumer c = (AttributeAwareXMLConsumer) consumer;
- c.attribute("", nameStr, nameStr, "CDATA", valueStr == null ? ""
- : valueStr);
- } else
- throw new SAXParseException("consumer is not attribute aware",
- getLocation());
- return getEndInstruction().getNext();
- }
-
-}
+/*
+ * Created on 2005-04-19
+ */
+package org.apache.cocoon.template.jxtg.instruction;
+
+import java.util.Stack;
+
+import org.apache.cocoon.components.expression.ExpressionContext;
+import org.apache.cocoon.template.jxtg.environment.ExecutionContext;
+import org.apache.cocoon.template.jxtg.expression.JXTExpression;
+import org.apache.cocoon.template.jxtg.script.event.Event;
+import org.apache.cocoon.template.jxtg.script.event.StartElement;
+import org.apache.cocoon.template.jxtg.script.event.StartInstruction;
+import org.apache.cocoon.xml.AttributeAwareXMLConsumer;
+import org.apache.cocoon.xml.XMLConsumer;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class StartAttribute extends StartInstruction {
+ private JXTExpression name;
+ private JXTExpression value;
+
+ public StartAttribute(StartElement raw, Attributes attrs, Stack stack)
+ throws SAXException {
+ super(raw);
+
+ Locator locator = getLocation();
+ String name = attrs.getValue("name");
+ if (name == null) {
+ throw new SAXParseException("parameter: \"name\" is required",
+ locator, null);
+ }
+ this.name = JXTExpression.compileExpr(name, "parameter: \"name\": ",
+ locator);
+
+ String value = attrs.getValue("value");
+ if (value == null)
+ throw new SAXParseException("parameter: \"value\" is required",
+ locator, null);
+
+ this.value = JXTExpression.compileExpr(value, "parameter: \"value\": ",
+ locator);
+ }
+
+ public Event execute(final XMLConsumer consumer,
+ ExpressionContext expressionContext,
+ ExecutionContext executionContext, MacroContext macroContext,
+ Event startEvent, Event endEvent) throws SAXException {
+
+ String nameStr = null;
+ String valueStr = "";
+ try {
+ nameStr = this.name.getStringValue(expressionContext);
+ valueStr = this.value.getStringValue(expressionContext);
+ } catch (Exception exc) {
+ throw new SAXParseException(exc.getMessage(), getLocation(), exc);
+ }
+ if (consumer instanceof AttributeAwareXMLConsumer) {
+ AttributeAwareXMLConsumer c = (AttributeAwareXMLConsumer) consumer;
+ c.attribute("", nameStr, nameStr, "CDATA", valueStr == null ? ""
+ : valueStr);
+ } else
+ throw new SAXParseException("consumer is not attribute aware",
+ getLocation());
+ return getEndInstruction().getNext();
+ }
+
+}
Propchange: cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/unsupported/template/trunk/java/org/apache/cocoon/template/jxtg/instruction/StartAttribute.java
------------------------------------------------------------------------------
svn:keywords = Id