@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 static String |
DEFAULT_MULTI_VALUE_SEPARATOR
The default multi-valued delimiter string.
|
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, startEntity
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning
protected static final String DEFAULT_MULTI_VALUE_SEPARATOR
protected final PathFactory pathFactory
PathFactory
protected String multiValueSeparator
public NodeImportXmlHandler(NodeImportDestination destination)
destination
- a non-null NodeImportDestination
public 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 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
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
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.