|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--com.g11ntoolkit.strfile.LTXMLJSSFParser
Parses a JSString File in XML file format.
Uses SAX and processes the callbacks in the parsing lifecycle.
A G11NToolKit object is created or modified for each element in the file. When the parse is complete, there will be a StrFile object in memory with all of the appropriate objects within it. It will be ready to write out or process further.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See License Agreement.
| Field Summary | |
(package private) TokContext |
context
Contains the context information for each of the string blocks. |
(package private) boolean |
inJSStrBlock
Indicates that a string block is being processed. |
(package private) boolean |
inJSStrFile
Indicates that a string file is being processed. |
(package private) boolean |
inJSString
Indicates that a string is being processed. |
(package private) boolean |
inJSXLEntry
Indicates that a translation entry is being processed. |
(package private) JSStrFile |
jsstrfile
Contains the object representing the String File being processed. |
private static java.util.logging.Logger |
log
The log used for all messages from this class. |
protected static java.util.ResourceBundle |
mrb
Messages used by the tools and classes. |
(package private) java.lang.String |
sflocale
Contains the string file locale in a string form. |
(package private) int |
stridx
|
(package private) java.lang.String |
string
Contains the string entries for each of the string blocks. |
(package private) Token |
token
Contains the tokens for each of the string blocks. |
protected static java.util.ResourceBundle |
vrb
Constants and variables used by the tools and classes. |
private static java.util.ResourceBundle |
xrb
Constants, messages, and variables used by the tools and classes for XML processing. |
| Constructor Summary | |
LTXMLJSSFParser()
|
|
| Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Processes character data (within an element). |
void |
endDocument()
Processes the end of a Document parse. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String rawName)
Indicates the end of an element. |
void |
endPrefixMapping(java.lang.String prefix)
Processes the end of a prefix mapping. |
JSStrFile |
getJSStrFile()
Returns the JSStrFile object. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Processes whitespace that can be ignored in the originating document. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Processes a processing instruction (other than the XML declaration) when it is encountered. |
void |
setJSStrFile(JSStrFile aJSStrFile)
Set the JSStrFile object to the specified StrFile. |
protected org.xml.sax.Attributes |
sortAttributes(org.xml.sax.Attributes attrs)
Returns a sorted list of attributes. |
void |
startDocument()
Processes the start of a Document parse. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attrs)
Processes the occurrence of an actual element. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Processes the beginning of an XML Namespace prefix mapping. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
error, fatalError, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static java.util.logging.Logger log
protected static java.util.ResourceBundle mrb
protected static java.util.ResourceBundle vrb
private static java.util.ResourceBundle xrb
JSStrFile jsstrfile
Token token
TokContext context
java.lang.String string
java.lang.String sflocale
boolean inJSStrFile
boolean inJSStrBlock
boolean inJSXLEntry
boolean inJSString
int stridx
| Constructor Detail |
public LTXMLJSSFParser()
| Method Detail |
public void setJSStrFile(JSStrFile aJSStrFile)
JSStrFile object to the specified StrFile.
aJSStrFile - a JSStrFile specifying the JSStrFile object to use as the targetgetJSStrFile()public JSStrFile getJSStrFile()
setJSStrFile(com.g11ntoolkit.strfile.JSStrFile)
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlertarget - a String specifying the target of the PIdata - a String containing all data sent to the PI.
This typically looks like one or more attribute value pairs.
org.xml.sax.SAXException - when things go wrong
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
Although this typically occurs within the root element of an XML document, it can occur at any point within the document. Note that a prefix mapping on an element triggers this callback before the callback for the actual element itself () occurs.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
startPrefixMapping in interface org.xml.sax.ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.DefaultHandlerprefix - a String specifying the prefix used for the namespace being reporteduri - a String specifying the URI for the namespace being reported
org.xml.sax.SAXException - when things go wrong
public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
This is when the namespace reported in a callback is no longer available.startPrefixMapping(java.lang.String, java.lang.String)
endPrefixMapping in interface org.xml.sax.ContentHandlerendPrefixMapping in class org.xml.sax.helpers.DefaultHandlerprefix - a String specifying the prefix of the namespace being reported
org.xml.sax.SAXException - when things go wrong
public void startDocument()
throws org.xml.sax.SAXException
Called once when the document is first opened. Precedes all callbacks in all SAX Handlers.
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - when things go wrong
public void endDocument()
throws org.xml.sax.SAXException
Called once when the document is closed. This occurs after all callbacks in all SAX Handlers.
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - when things go wrong
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attrs)
throws org.xml.sax.SAXException
Includes the element's attributes, with the exception of XML vocabulary specific attributes, such as xmlns:[namespace prefix] and xsi:schemaLocation.
Code is added to this method for each element that has specific processing needs when it starts. Other code to handle the end of an element is in the method.endElement(java.lang.String, java.lang.String, java.lang.String)
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlernamespaceURI - a String specifying the namespace URI this element is associated with, or an empty StringlocalName - a String specifying the name of the element (with no namespace prefix, if one is present)rawName - a String specifying the XML 1.0 version of element name: [namespace prefix]:[localName]attrs - an Attributes object containing a list of attributes for this element
org.xml.sax.SAXException - when things go wrong
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String rawName)
throws org.xml.sax.SAXException
Shows that the </[element name]> tag has been reached. Note that the parser does not distinguish between empty elements and non-empty elements, so this occurs uniformly.
Code is added to this method for each element that has specific processing needs when it ends. Other code to handle the start of an element is in the method.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlernamespaceURI - a String specifying the namespace URI this element is associated with, or an empty StringlocalName - a String specifying the name of the element (with no namespace prefix, if one is present)rawName - a String specifying the XML 1.0 version of element name: [namespace prefix]:[localName]
org.xml.sax.SAXException - when things go wrong
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
We are only interested in character data if it is for a String or Comment element and the element is contained in an StrBlock element.
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerch - a char[] specifying a character array that contains the character datastart - an int specifying the index in the array where the data startslength - an int specifying the length of the string
org.xml.sax.SAXException - when things go wrong
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
Typically invoked only when validation is occurring in the parsing process.
ignorableWhitespace in interface org.xml.sax.ContentHandlerignorableWhitespace in class org.xml.sax.helpers.DefaultHandlerch - a char[] specifying a character array that contains the character datastart - an int specifying the index in the array where the data startslength - an int specifying the length of the ignorable white space
org.xml.sax.SAXException - when things go wrongprotected org.xml.sax.Attributes sortAttributes(org.xml.sax.Attributes attrs)
attrs - an Attributes object specifying the attributes to sort
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||