org.w3c.rdf.implementation.syntax.strawman
Class StrawmanParser
java.lang.Object
|
+--org.w3c.rdf.util.xml.GenericParser
|
+--org.w3c.rdf.implementation.syntax.strawman.StrawmanParser
- All Implemented Interfaces:
- DocumentHandler, DTDHandler, EntityResolver, RDFParser
- public class StrawmanParser
- extends GenericParser
A parser for a simplified syntax for RDF. Supports arbitrary XML files.
Uses three control attributes:
rdf:instance
: specifes that a tag denotes an instance of a class
rdf:for
: specifes the subject URI of the property
rdf:resource
: specifes the object URI of the property
Methods inherited from class org.w3c.rdf.util.xml.GenericParser |
_endElement, _main, _startElement, addError, addWarning, createParser, doctype, endDocument, getInputSource, getNamespaces, getQualifiedName, getQualifiedName, getSourceURI, ignorableWhitespace, initXMLParser, notationDecl, parse, preserveWhiteSpace, processingInstruction, resolveEntity, setDocumentLocator, setErrorHandler, startDocument, unparsedEntityDecl, updateNamespaceStack |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REVISION
public static final java.lang.String REVISION
RDF_INSTANCE
public static final java.lang.String RDF_INSTANCE
RDF_RESOURCE
public static final java.lang.String RDF_RESOURCE
RDF_FOR
public static final java.lang.String RDF_FOR
StrawmanParser
public StrawmanParser()
StrawmanParser
public StrawmanParser(boolean useDigests,
boolean warn)
startElement
public void startElement(java.lang.String name,
AttributeList al)
throws SAXException
- Description copied from interface:
DocumentHandler
- Receive notification of the beginning of an element.
The Parser will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
endElement() event for every startElement() event (even when the
element is empty). All of the element's content will be
reported, in order, before the corresponding endElement()
event.
If the element name has a namespace prefix, the prefix will
still be attached. Note that the attribute list provided will
contain only attributes with explicit values (specified or
defaulted): #IMPLIED attributes will be omitted.
- Overrides:
startElement
in class GenericParser
- Following copied from interface:
org.xml.sax.DocumentHandler
- Parameters:
name
- The element type name.atts
- The attributes attached to the element, if any.- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.- See Also:
DocumentHandler.endElement(java.lang.String)
,
AttributeList
endElement
public void endElement(java.lang.String name)
throws SAXException
- Description copied from interface:
DocumentHandler
- Receive notification of the end of an element.
The SAX parser will invoke this method at the end of every
element in the XML document; there will be a corresponding
startElement() event for every endElement() event (even when the
element is empty).
If the element name has a namespace prefix, the prefix will
still be attached to the name.
- Overrides:
endElement
in class GenericParser
- Following copied from interface:
org.xml.sax.DocumentHandler
- Parameters:
name
- The element type name- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.
updateDigest
protected void updateDigest(StrawElement current,
StrawArc arc)
throws DigestException
createStatement
protected void createStatement(Resource subject,
Resource predicate,
RDFNode object)
throws ModelException
- Overrides:
createStatement
in class GenericParser
characters
public void characters(char[] ch,
int start,
int length)
throws SAXException
- Description copied from interface:
DocumentHandler
- Receive notification of character data.
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 using the
ignorableWhitespace() method rather than this one (validating
parsers must do so).
- Overrides:
characters
in class GenericParser
- Following copied from interface:
org.xml.sax.DocumentHandler
- Parameters:
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.- See Also:
DocumentHandler.ignorableWhitespace(char[], int, int)
,
Locator
createElement
protected Element createElement()
- Overrides:
createElement
in class GenericParser
main
public static void main(java.lang.String[] args)
throws java.lang.Exception