File: CopyAction.java

package info (click to toggle)
lib-xt-java 0.19990725-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,224 kB
  • ctags: 2,133
  • sloc: java: 9,665; makefile: 54; xml: 28
file content (39 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.jclark.xsl.tr;

import com.jclark.xsl.om.*;

class CopyAction implements Action {
  private Action content;

  CopyAction(Action content) {
    this.content = content;
  }

  public void invoke(ProcessContext context, Node sourceNode, Result result) throws XSLException {
    switch (sourceNode.getType()) {
    case Node.ROOT:
      content.invoke(context, sourceNode, result);
      break;
    case Node.TEXT:
      result.characters(sourceNode.getData());
      break;
    case Node.ATTRIBUTE:
      result.attribute(sourceNode.getName(), sourceNode.getData());
      break;
    case Node.PROCESSING_INSTRUCTION:
      result.processingInstruction(sourceNode.getName().toString(),
	                           sourceNode.getData());
      break;
    case Node.COMMENT:
      result.comment(sourceNode.getData());
      break;
    case Node.ELEMENT:
      result.startElement(sourceNode.getName(),
			  sourceNode.getNamespacePrefixMap());
      if (content != null)
	content.invoke(context, sourceNode, result);
      result.endElement(sourceNode.getName());
      break;
    }
  }
}