Class NQXML::Tokenizer
In: nqxml/tokenizer.rb
Parent: Object
Methods
column    each    eof?    line    new    nextAttributeList    nextBangTag    nextBracketToken    nextCdata    nextChar    nextComment    nextDeclSep    nextDoctype    nextElementDecl    nextEntity    nextEntityTag    nextExternalId    nextName    nextNotation    nextProcessingInstruction    nextPublicIdLiteral    nextQuotedLiteral    nextTag    nextTagAttributes    nextText    normalizeAttributeValue    peekChar    peekMatches?    replaceAllRefsButParams    replaceOnlyEntityRefs    replaceParamRefs    resolveSystemLiteral    restOfProcessingInstruction    restOfXMLDecl    skipChar    skipSpaces    textUpTo   
Public Class methods
new(stringFileOrURI)
Public Instance methods
eof?()
line()

Returns the line number within the XML.

column()

Returns the column number within the current line of XML.

replaceOnlyEntityRefs(str)

Replace general entity refs, but not predefined and character refs. Returns the replacement string if any substitutions were performed. If not, returns nil to signal end of recursive replacement.

replaceAllRefsButParams(str)

Replace character, predefined, and general entity refs.

replaceParamRefs(str)

Parse character refs and parameter refs at the same time, but not general entity refs.

peekMatches?(str)

Returns true if str matches the beginning of the current position in input stream.

peekChar()
nextChar(n = 1)
skipChar(n = 1)
skipSpaces()
textUpTo(str, strIsRegex, errorIfNotFound)

Returns text up to but not including specified string or regexp. Positions text cursor after the text found.

nextName()

Returns the next legal XML name. Will raise an exception if the next available character is not legal.

nextQuotedLiteral(tagName)
nextPublicIdLiteral(tagName)

Returns a PUBLIC id literal, which is different from a "simple" quoted literal.

normalizeAttributeValue(str)

Normalize the attribute value using the rules in section 3.3.3 of the XML spec, "Attribute-Value Normalization".

nextTagAttributes(typeName, name)

Returns hash of attributes. If no attributes, returns empty hash. If error, raises an exception.

restOfXMLDecl(name, input, sourceStartPos)
restOfProcessingInstruction(name, input, sourceStartPos)
nextProcessingInstruction()
nextDeclSep()

Handle declsep (parameter entity reference) inside DOCTYPE. Unlike most next* methods, we don't return an entity. Instead we replace the declsep (parameter entity reference) and create a new input stream containing the replacement text.

nextComment()
nextCdata()
nextExternalId(tagName)

Return next PUBLIC or SYSTEM external id. Returns nil if the next word is not either 'PUBLIC' or 'SYSTEM'.

resolveSystemLiteral(externalId)

Given an external ID, retrieve it, parse it (unless NDATA), and absorb the entities found.

nextEntityTag()
nextElementDecl()
nextAttributeList()
nextNotation()
nextDoctype()

'<!DOCTYPE' (name) (external-id)?

      ( '[' (markupdecl | declsep)* ']' )? '>'
nextBangTag()
nextTag()
nextBracketToken()
nextText()
nextEntity()

Used by each().

each() {|nextEntity()| ...}

The main token generator