|
ModeShape Distribution 3.0.0.CR1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.xml.sax.ext.DefaultHandler2
org.modeshape.jcr.xml.NodeImportXmlHandler
@NotThreadSafe public class NodeImportXmlHandler
A simplified version of the graph xml import handler (from ModeShape 2.x) which is used for importing initial content into workspaces.
Nested Class Summary | |
---|---|
static class |
NodeImportXmlHandler.AttributeScoping
The choices for how attributes that have no namespace prefix should be assigned a namespace. |
class |
NodeImportXmlHandler.ImportElement
Element entries represent in-memory representations of the xml elements (either nodes or properties) encountered between a startElement(String, String, String, Attributes) and a
endElement(String, String, String) event. |
Field Summary | |
---|---|
protected PathFactory |
pathFactory
The reference to the PathFactory |
Constructor Summary | |
---|---|
NodeImportXmlHandler(NodeImportDestination destination)
Creates a new handler instance, using only an execution context and some default values. |
|
NodeImportXmlHandler(NodeImportDestination destination,
String nameAttribute,
String typeAttribute,
String typeAttributeValue,
NodeImportXmlHandler.AttributeScoping scoping)
Create a handler that parses an xml file. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
protected String |
createName(String uri,
String localName)
|
void |
endDocument()
|
void |
endElement(String uri,
String localName,
String name)
|
void |
endPrefixMapping(String prefix)
|
void |
startDocument()
|
void |
startElement(String uri,
String localName,
String name,
Attributes attributes)
|
void |
startPrefixMapping(String prefix,
String uri)
This method ensures that the namespace is registered with the registry , using the supplied prefix
to register the namespace if required. |
Methods inherited from class org.xml.sax.ext.DefaultHandler2 |
---|
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final PathFactory pathFactory
PathFactory
Constructor Detail |
---|
public NodeImportXmlHandler(NodeImportDestination destination)
destination
- a non-null NodeImportDestination
public NodeImportXmlHandler(NodeImportDestination destination, String nameAttribute, String typeAttribute, String typeAttributeValue, NodeImportXmlHandler.AttributeScoping scoping)
destination
- a non-null NodeImportDestination
which is expected to provide a valid context and to handle the
results of the import process.nameAttribute
- the name of the property whose value should be used for the names of the nodes (typically, this is
"jcr:name" or something equivalent); or null if the XML element name should always be used as the node nametypeAttribute
- the name of the property that should be set with the type of the XML element, or null if there is no
such propertytypeAttributeValue
- the value of the type property that should be used if the node has no nameAttribute
,
or null if the value should be set to the type of the XML elementscoping
- defines how to choose the namespace of attributes that do not have a namespace prefix; if null, the
DEFAULT_ATTRIBUTE_SCOPING
value is used
IllegalArgumentException
- if the destination reference is nullMethod Detail |
---|
public void startPrefixMapping(String prefix, String uri)
This method ensures that the namespace is registered with the registry
, using the supplied prefix
to register the namespace if required. Note that because this class does not really use the namespace prefixes to create
Name
objects, no attempt is made to match the XML namespace prefixes.
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
DefaultHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(String prefix)
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
protected String createName(String uri, String localName)
public void endElement(String uri, String localName, String name)
endElement
in interface ContentHandler
endElement
in class DefaultHandler
public void characters(char[] ch, int start, int length)
characters
in interface ContentHandler
characters
in class DefaultHandler
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
|
ModeShape Distribution 3.0.0.CR1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |