| Method from org.apache.cocoon.transformation.FilterTransformer Detail: |
public void characters(char[] c,
int start,
int len) throws SAXException {
if (!this.skip) {
super.contentHandler.characters(c,start,len);
}
}
|
public void comment(char[] ch,
int start,
int len) throws SAXException {
if (!this.skip) {
super.lexicalHandler.comment(ch, start, len);
}
}
|
public void endCDATA() throws SAXException {
if (!this.skip) {
super.lexicalHandler.endCDATA();
}
}
|
public void endElement(String uri,
String name,
String raw) throws SAXException {
if (this.foundIt && name.equals(this.parentName)) {
// FIXME: VG: This will fail on XML like:
// < parent >
// < element >
// < parent >
super.contentHandler.endElement("", BLOCK, BLOCK);
super.contentHandler.endElement(uri, name, raw);
this.foundIt = false;
this.skip = false;
} else if (!this.skip) {
super.contentHandler.endElement(uri,name,raw);
}
}
|
public void endEntity(String name) throws SAXException {
if (!this.skip) {
super.lexicalHandler.endEntity( name);
}
}
|
public Serializable getKey() {
return this.elementName + '< " + this.count + ' >" + this.blocknr;
}
Generate the unique key.
This key must be unique inside the space of this component.
This method must be invoked before the generateValidity() method. |
public SourceValidity getValidity() {
return NOPValidity.SHARED_INSTANCE;
}
Generate the validity object.
Before this method can be invoked the generateKey() method
must be invoked. |
public void processingInstruction(String target,
String data) throws SAXException {
if (!this.skip) {
super.contentHandler.processingInstruction(target, data);
}
}
|
public void setup(SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters) throws IOException, SAXException, ProcessingException {
this.counter=0;
this.currentBlocknr=0;
this.skip=false;
this.foundIt=false;
this.parentName=null;
this.elementName = parameters.getParameter(ELEMENT, "");
this.count = parameters.getParameterAsInteger(COUNT, DEFAULT_COUNT);
this.blocknr = parameters.getParameterAsInteger(BLOCKNR, DEFAULT_BLOCK);
if (this.elementName == null || this.elementName.length() == 0 || this.count == 0) {
throw new ProcessingException("FilterTransformer: both "+ ELEMENT + " and " +
COUNT + " parameters need to be specified");
}
}
BEGIN SitemapComponent methods |
public void startCDATA() throws SAXException {
if (!this.skip) {
super.lexicalHandler.startCDATA();
}
}
|
public void startElement(String uri,
String name,
String raw,
Attributes attributes) throws SAXException {
if (name.equalsIgnoreCase(elementName)) {
this.foundIt = true;
this.counter++;
if (this.counter < = (this.count*(this.blocknr)) && this.counter > (this.count*(this.blocknr-1))) {
this.skip = false;
} else {
this.skip = true;
}
if (this.currentBlocknr != (int)Math.ceil((float)this.counter/this.count)) {
this.currentBlocknr = (int)Math.ceil((float)this.counter/this.count);
AttributesImpl attr = new AttributesImpl();
attr.addAttribute("", BLOCKID, BLOCKID, "CDATA", String.valueOf(this.currentBlocknr));
if (this.counter < this.count) {
super.contentHandler.startElement("", BLOCK, BLOCK, attr);
} else {
// fix Bugzilla Bug 13904, check if counter == 1
// in this case there is no startElement("", BLOCK, BLOCK)
// written, yet
if (this.counter > 1) {
super.contentHandler.endElement("", BLOCK, BLOCK);
}
super.contentHandler.startElement("", BLOCK, BLOCK, attr);
}
}
} else if (!this.foundIt) {
this.parentName = name;
}
if (!this.skip) {
super.contentHandler.startElement(uri,name,raw,attributes);
}
}
BEGIN SAX ContentHandler handlers |
public void startEntity(String name) throws SAXException {
if (!this.skip) {
super.lexicalHandler.startEntity(name);
}
}
|