org.apache.cocoon.pipeline.util.AttributesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cocoon-pipeline Show documentation
Show all versions of cocoon-pipeline Show documentation
The core of Cocoon 3. A Servlet API independent implementation of pipelines.
/*
* 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.pipeline.util;
import org.xml.sax.Attributes;
/**
* A helper Class creating SAX Attributes
*
* @version $Id: AttributesImpl.java 699327 2008-09-26 14:01:35Z reinhard $
*/
public class AttributesImpl extends org.xml.sax.helpers.AttributesImpl {
/**
* Constructor
*/
public AttributesImpl() {
super();
}
/**
* Constructor
*/
public AttributesImpl(Attributes attr) {
super(attr);
}
/**
* Add an attribute of type CDATA with empty Namespace to the end of the list.
*
*
* For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the
* responsibility of the application.
*
*
* @param localName The local name.
* @param value The attribute value.
*/
public void addCDATAAttribute(String localName, String value) {
this.addAttribute("", localName, localName, AttributeTypes.CDATA, value);
}
/**
* Add an attribute of type CDATA with the namespace to the end of the list.
*
*
* For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the
* responsibility of the application.
*
*
* @param namespace The namespace.
* @param localName The local name.
* @param value The attribute value.
*/
public void addCDATAAttribute(String namespace, String localName, String value) {
this.addAttribute(namespace, localName, localName, AttributeTypes.CDATA, value);
}
/**
* Add an attribute of type CDATA to the end of the list.
*
*
* For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the
* responsibility of the application.
*
*
* @param uri The Namespace URI, or the empty string if none is available or Namespace processing is not being
* performed.
* @param localName The local name, or the empty string if Namespace processing is not being performed.
* @param qName The qualified (prefixed) name, or the empty string if qualified names are not available.
* @param value The attribute value.
*/
public void addCDATAAttribute(String uri, String localName, String qName, String value) {
this.addAttribute(uri, localName, qName, AttributeTypes.CDATA, value);
}
/**
* Remove an attribute
*/
public void removeAttribute(String localName) {
final int index = this.getIndex(localName);
if (index != -1) {
this.removeAttribute(index);
}
}
/**
* Remove an attribute
*/
public void removeAttribute(String uri, String localName) {
final int index = this.getIndex(uri, localName);
if (index != -1) {
this.removeAttribute(index);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy