@NotThreadSafe public class NodeImportXmlHandler extends DefaultHandler2
| Modifier and Type | Class and Description |
|---|---|
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. |
| Modifier and Type | Field and Description |
|---|---|
protected String |
multiValueSeparator
The separator string used for determining multi-valued properties
|
protected PathFactory |
pathFactory
The reference to the
PathFactory |
| Constructor and Description |
|---|
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,
String multiValueSeparator,
NodeImportXmlHandler.AttributeScoping scoping)
Create a handler that parses an xml file.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntityerror, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, unparsedEntityDecl, warningprotected final PathFactory pathFactory
PathFactoryprotected String multiValueSeparator
public NodeImportXmlHandler(NodeImportDestination destination)
destination - a non-null NodeImportDestinationpublic NodeImportXmlHandler(NodeImportDestination destination, String nameAttribute, String typeAttribute, String typeAttributeValue, String multiValueSeparator, 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 elementmultiValueSeparator - the string that should be used a separator for creating multi-valued properties.scoping - defines how to choose the namespace of attributes that do not have a namespace prefix; if null, the
DEFAULT_ATTRIBUTE_SCOPING value is used @throws IllegalArgumentException if the destination reference is
nullpublic 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 ContentHandlerstartPrefixMapping in class DefaultHandlerDefaultHandler.startPrefixMapping(java.lang.String, java.lang.String)public void endPrefixMapping(String prefix)
endPrefixMapping in interface ContentHandlerendPrefixMapping in class DefaultHandlerpublic void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandlerSAXExceptionpublic void endElement(String uri, String localName, String name)
endElement in interface ContentHandlerendElement in class DefaultHandlerpublic void characters(char[] ch,
int start,
int length)
characters in interface ContentHandlercharacters in class DefaultHandlerpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class DefaultHandlerSAXExceptionpublic void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class DefaultHandlerSAXExceptionCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.