15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/* 25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Licensed to the Apache Software Foundation (ASF) under one 35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * or more contributor license agreements. See the NOTICE file 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * distributed with this work for additional information 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * regarding copyright ownership. The ASF licenses this file 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * to you under the Apache License, Version 2.0 (the "License"); 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * you may not use this file except in compliance with the License. 85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * You may obtain a copy of the License at 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * http://www.apache.org/licenses/LICENSE-2.0 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 125c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu * Unless required by applicable law or agreed to in writing, software 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * distributed under the License is distributed on an "AS IS" BASIS, 14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * See the License for the specific language governing permissions and 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * limitations under the License. 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/* 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * $Id: SerializerTrace.java 468654 2006-10-28 07:09:23Z minchau $ 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)package org.apache.xml.serializer; 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)import org.xml.sax.Attributes; 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/** 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * This interface defines a set of integer constants that identify trace event 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * types. 285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @xsl.usage internal 305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)public interface SerializerTrace { 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated when a document begins. 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_STARTDOCUMENT = 1; 395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated when a document ends. 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_ENDDOCUMENT = 2; 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated when an element begins (after the attributes have been processed but before the children have been added). 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_STARTELEMENT = 3; 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated when an element ends, after it's children have been added. 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_ENDELEMENT = 4; 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * Event type generated for character data (CDATA and Ignorable Whitespace have their own events). 57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public static final int EVENTTYPE_CHARACTERS = 5; 595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /** 615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated for ignorable whitespace (I'm not sure how much this is actually called. 62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6; 64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated for processing instructions. 675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_PI = 7; 695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated after a comment has been added. 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_COMMENT = 8; 74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /** 76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * Event type generate after an entity ref is created. 77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_ENTITYREF = 9; 795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated after CDATA is generated. 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_CDATA = 10; 845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated when characters might be written to an output stream, 875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * but these characters never are. They will ultimately be written out via 885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * EVENTTYPE_OUTPUT_CHARACTERS. This type is used as attributes are collected. 895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Whenever the attributes change this event type is fired. At the very end 905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * however, when the attributes do not change anymore and are going to be 915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * ouput to the document the real characters will be written out using the 925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * EVENTTYPE_OUTPUT_CHARACTERS. 935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11; 955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Event type generated when characters are written to an output stream. 985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12; 1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 101010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) 1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Tell if trace listeners are present. 1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) * @return True if there are trace listeners 1065c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu */ 1075c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu public boolean hasTraceListeners(); 1085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 110010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * Fire startDocument, endDocument events. 1115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 1125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param eventType One of the EVENTTYPE_XXX constants. 113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */ 1145c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu public void fireGenerateEvent(int eventType); 1155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) /** 1175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Fire startElement, endElement events. 1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 1195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param eventType One of the EVENTTYPE_XXX constants. 1205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param name The name of the element. 1215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param atts The SAX attribute list. 1225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 1235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public void fireGenerateEvent(int eventType, String name, Attributes atts); 1245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 1265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Fire characters, cdata events. 1275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param eventType One of the EVENTTYPE_XXX constants. 1295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param ch The char array from the SAX event. 130010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @param start The start offset to be used in the char array. 1311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * @param length The end offset to be used in the chara array. 132116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch */ 133116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch public void fireGenerateEvent(int eventType, char ch[], int start, int length); 1345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 1365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Fire processingInstruction events. 1375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 1385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param eventType One of the EVENTTYPE_XXX constants. 1395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param name The name of the processing instruction. 1405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param data The processing instruction data. 1415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 1425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public void fireGenerateEvent(int eventType, String name, String data); 1435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 1465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Fire comment and entity ref events. 1475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 1485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param eventType One of the EVENTTYPE_XXX constants. 1495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param data The comment or entity ref data. 1505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 1515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public void fireGenerateEvent(int eventType, String data); 1525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 1545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)