|
Xerces 3.1.1 API: Class BaseMarkupSerializer
|
Field Summary | |
protected java.lang.String |
|
protected java.lang.String |
|
The output format associated with this serializer. |
|
protected boolean |
|
protected java.util.Hashtable |
|
The printer used for printing text parts. |
|
protected boolean |
Constructor Summary | |
protected |
Method Summary | |
| |
| |
| |
void |
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
|
void |
int start,
int length)
|
protected void |
|
void |
int start,
int length)
|
void |
|
Must be called by a method about to print any type of content. |
|
void |
java.lang.String model)
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
java.lang.String localName,
java.lang.String rawName,
boolean preserveSpace)
Enter a new element state for the specified element. |
|
void |
java.lang.String publicId,
java.lang.String systemId)
|
Return the state of the current element. |
|
protected abstract java.lang.String |
|
protected java.lang.String |
|
void |
int start,
int length)
|
void |
java.lang.String value)
|
protected boolean |
|
Leave the current element state and return to the state of the parent element. |
|
void |
java.lang.String publicId,
java.lang.String systemId)
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
int start,
int length,
boolean preserveSpace,
boolean unescaped)
|
protected void |
boolean preserveSpace,
boolean unescaped)
|
void |
java.lang.String code)
|
boolean |
|
void |
|
void |
|
void |
|
protected abstract void |
|
protected void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
java.lang.String publicId,
java.lang.String systemId)
|
void |
|
void |
|
void |
java.lang.String uri)
|
void |
|
void |
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected boolean _started
protected java.util.Hashtable _prefixes
protected java.lang.String _docTypePublicId
protected java.lang.String _docTypeSystemId
protected boolean _indenting
Constructor Detail |
#init
.Method Detail |
throws java.io.IOException
throws java.io.IOException
throws java.io.IOException
public void setOutputByteStream(java.io.OutputStream output)
public void setOutputCharStream(java.io.Writer writer)
format
- The output format to usepublic boolean reset()
protected void prepare() throws java.io.IOException
public void serialize(Element elem) throws java.io.IOException
elem
- The element to serializepublic void serialize(DocumentFragment frag) throws java.io.IOException
elem
- The element to serializepublic void serialize(Document doc) throws java.io.IOException
doc
- The document to serializepublic void startDocument()
The SAX parser will invoke this method only once, before any
public void characters(char[] chars, int start, int length)
The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
Note that some parsers will report whitespace in element method rather than this one (validating parsers must do so).
public void ignorableWhitespace(char[] chars, int start, int length)
Validating Parsers must use this method to report each chunk of whitespace in element content (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.
SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
public void processingInstruction(java.lang.String target, java.lang.String code)
The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX parser must never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied. The data does not include any
wrapping another exception.public void comment(char[] chars, int start, int length)
This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
public void comment(java.lang.String text)
public void startCDATA()
The contents of the CDATA section will be reported through
public void endCDATA()
public void startNonEscaping()
public void endNonEscaping()
public void startPreserving()
public void endPreserving()
public void endDocument()
public void startEntity(java.lang.String name)
NOTE: entity references in attribute values -- and the start and end of the document entity -- are never reported.
The start and end of the external DTD subset are reported using the pseudo-name "[dtd]". All other events must be properly nested within start/end entity events.
Note that skipped entities will be reported through the event, which is part of the ContentHandler interface.
name
- The name of the entity. If it is a parameter
public void endEntity(java.lang.String name)
SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.
The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.
Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
locator
- An object that can return the location of
public void skippedEntity(java.lang.String name)
The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the and the properties.
name
- The name of the skipped entity. If it is a
parameter entity, the name will begin with '%', and if
it is the external DTD subset, it will be the string
wrapping another exception.public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute feature is true (the default).
There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.
Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the guaranteed.
There should never be start/endPrefixMapping events for the
public void endPrefixMapping(java.lang.String prefix)
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Any declarations are assumed to be in the internal subset event.
Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.
name
- The document type name.publicId
- The declared public identifier for the
external DTD subset, or null if none was declared.systemId
- The declared system identifier for the
public void endDTD()
public void elementDecl(java.lang.String name, java.lang.String model)
The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.
public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value)
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or a parenthesized token group with the separator "|" and all whitespace removed.
eName
- The name of the associated element.aName
- The name of the attribute.type
- A string representing the attribute type.valueDefault
- A string representing the attribute default
("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
none of these applies.value
- A string representing the attribute's default value,
public void internalEntityDecl(java.lang.String name, java.lang.String value)
Only the effective (first) declaration for each entity will be reported.
name
- The name of the entity. If it is a parameter
public void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Only the effective (first) declaration for each entity will be reported.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.publicId
- The declared public identifier of the entity, or
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
Note that the notation name corresponds to a notation It is up to the application to record the entity for later reference, if necessary.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
It is up to the application to record the notation for later reference, if necessary.
At least one of publicId and systemId must be non-null. If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application through this event.
There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.
name
- The notation name.publicId
- The notation's public identifier, or null if
none was given.systemId
- The notation's system identifier, or null if
protected void serializeNode(Node node)
protected void characters(java.lang.String text)
text
- The text to printunescaped
- True is should print unescapedprotected abstract java.lang.String getEntityRef(char ch)
ch
- Character valueprotected abstract void serializeElement(Element elem)
elem
- The element to serializeprotected void serializePreRoot()
protected final void printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped)
#printText(String)
with a call to #breakLine
for each new line. If spaces are not preserved, the text is
broken at space boundaries if longer than the line width;
Multiple spaces are printed as such, but spaces at beginning
of line are removed.text
- The text to printpreserveSpace
- Space preserving flagunescaped
- Print unescapedprotected final void printText(java.lang.String text, boolean preserveSpace, boolean unescaped)
protected void printDoctypeURL(java.lang.String url)
url
- The document type url to printprotected void printEscaped(char ch)
protected void printEscaped(java.lang.String source)
source
- The string to escapejava.lang.String localName, java.lang.String rawName, boolean preserveSpace)
protected boolean isDocumentState()
protected java.lang.String getPrefix(java.lang.String namespaceURI)
namespaceURI
- The namespace URI
|
Xerces 3.1.1 | ||||||||
PREV CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |