01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.engines.xml;
06:
07: import com.sun.portal.rewriter.Translator;
08: import com.sun.portal.rewriter.engines.AbstractRewriter;
09: import com.sun.portal.rewriter.engines.PageContent;
10: import com.sun.portal.rewriter.engines.RewriterBroker;
11: import com.sun.portal.rewriter.engines.xml.parser.XMLParser;
12: import com.sun.portal.rewriter.util.Debug;
13:
14: /**
15: * Class to rewrite the XML Documents.
16: *
17: * @version 1.0 12/15/2001
18: * @author Modified by Raja Nagendra Kumar, Nagendra.Raja@sun.com ,Noble Paul noble.paul@sun.com
19: */
20: public final class XMLRewriter extends AbstractRewriter {
21: public static final String PROPERTY_IS_REWRITE_XSL = "IS_REWRITE_XSL";
22:
23: public XMLRewriter(final RewriterBroker aRewriterBroker) {
24: super (aRewriterBroker, XML_MIME);
25: }//constuctor
26:
27: public final void plugableRewriter(final PageContent aPageContent,
28: final Translator aTranslator) {
29: parseXML(aPageContent, aTranslator);
30: }//rewrite()
31:
32: private void parseXML(final PageContent aPageContent,
33: final Translator aTranslator) {
34:
35: try {
36: new XMLParser(aPageContent, getRuleSet(), aTranslator)
37: .parse();
38: } catch (Exception e) {
39: e.printStackTrace();
40: //Debug.recordOriginalPageWarning( "Unable to translate XML:", e );
41: Debug.recordOriginalPageWarning("PSRW_CSPR_0021", e);
42: aPageContent.getResultBuffer().delete(0,
43: aPageContent.getResultBuffer().length());
44: aPageContent.getResultBuffer().append(
45: aPageContent.getOriginalContent());
46: }
47:
48: }//parseXML()
49:
50: }//class XMLRewriter
|