2
* Copyright 1999-2004 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
* $Id: VarNameCollector.java,v 1.5 2004/02/16 20:32:33 minchau Exp $
19
package org.apache.xalan.templates;
21
import java.util.Vector;
23
import org.apache.xml.utils.QName;
24
import org.apache.xpath.ExpressionOwner;
25
import org.apache.xpath.XPathVisitor;
26
import org.apache.xpath.operations.Variable;
29
* This class visits variable refs in an XPath and collects their QNames.
31
public class VarNameCollector extends XPathVisitor
33
Vector m_refs = new Vector();
36
* Reset the list for a fresh visitation and collection.
40
m_refs.removeAllElements(); //.clear();
44
* Get the number of variable references that were collected.
45
* @return the size of the list.
47
public int getVarCount()
53
* Tell if the given qualified name occurs in
54
* the list of qualified names collected.
56
* @param refName Must be a valid qualified name.
57
* @return true if the list contains the qualified name.
59
boolean doesOccur(QName refName)
61
return m_refs.contains(refName);
65
* Visit a variable reference.
66
* @param owner The owner of the expression, to which the expression can
67
* be reset if rewriting takes place.
68
* @param var The variable reference object.
69
* @return true if the sub expressions should be traversed.
71
public boolean visitVariableRef(ExpressionOwner owner, Variable var)
73
m_refs.addElement(var.getQName());
2
* Licensed to the Apache Software Foundation (ASF) under one
3
* or more contributor license agreements. See the NOTICE file
4
* distributed with this work for additional information
5
* regarding copyright ownership. The ASF licenses this file
6
* to you under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
10
* http://www.apache.org/licenses/LICENSE-2.0
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
19
* $Id: VarNameCollector.java 468643 2006-10-28 06:56:03Z minchau $
21
package org.apache.xalan.templates;
23
import java.util.Vector;
25
import org.apache.xml.utils.QName;
26
import org.apache.xpath.ExpressionOwner;
27
import org.apache.xpath.XPathVisitor;
28
import org.apache.xpath.operations.Variable;
31
* This class visits variable refs in an XPath and collects their QNames.
33
public class VarNameCollector extends XPathVisitor
35
Vector m_refs = new Vector();
38
* Reset the list for a fresh visitation and collection.
42
m_refs.removeAllElements(); //.clear();
46
* Get the number of variable references that were collected.
47
* @return the size of the list.
49
public int getVarCount()
55
* Tell if the given qualified name occurs in
56
* the list of qualified names collected.
58
* @param refName Must be a valid qualified name.
59
* @return true if the list contains the qualified name.
61
boolean doesOccur(QName refName)
63
return m_refs.contains(refName);
67
* Visit a variable reference.
68
* @param owner The owner of the expression, to which the expression can
69
* be reset if rewriting takes place.
70
* @param var The variable reference object.
71
* @return true if the sub expressions should be traversed.
73
public boolean visitVariableRef(ExpressionOwner owner, Variable var)
75
m_refs.addElement(var.getQName());