Class XmlReader
java.lang.Object
org.apache.sling.jcr.contentloader.internal.readers.XmlReader
- All Implemented Interfaces:
ContentReader
This reader reads an xml file defining the content. The xml format should
have this format:
<node> <name>the name of the node</name> <primaryNodeType>type</primaryNodeType> <mixinNodeTypes> <mixinNodeType>mixtype1</mixinNodeType> <mixinNodeType>mixtype2</mixinNodeType> </mixingNodeTypes> <properties> <property> <name>propName</name> <value>propValue</value> or <values> <value/> for multi value properties </values> <type>propType</type> </property> <!-- more properties --> </properties> <nodes> <!-- child nodes --> <node> .. </node> </nodes> </node>If you want to include a binary file in your loaded content, you may specify it using a
XmlReader.FileDescription
<nt:file>
element.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Utility class for dealing with attributes from KXmlParser.protected static final class
Represents a reference to a file that is to be loaded into the repository.protected static final class
protected static final class
-
Field Summary
Fields inherited from interface org.apache.sling.jcr.contentloader.ContentReader
PROPERTY_EXTENSIONS, PROPERTY_TYPES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
activate()
void
parse
(InputStream ins, ContentCreator creator) Read the content from the input stream and create the content using the provided content creator.void
parse
(URL url, ContentCreator creator) Read the content from the URL and create the content using the provided content creator.
-
Constructor Details
-
XmlReader
public XmlReader()
-
-
Method Details
-
activate
protected void activate() -
parse
public void parse(URL url, ContentCreator creator) throws IOException, javax.jcr.RepositoryException Description copied from interface:ContentReader
Read the content from the URL and create the content using the provided content creator.- Specified by:
parse
in interfaceContentReader
- Parameters:
url
- The input stream.- Throws:
IOException
- If anything goes wrong.javax.jcr.RepositoryException
- See Also:
-
parse
public void parse(InputStream ins, ContentCreator creator) throws IOException, javax.jcr.RepositoryException Description copied from interface:ContentReader
Read the content from the input stream and create the content using the provided content creator.- Specified by:
parse
in interfaceContentReader
- Parameters:
ins
- the input stream.- Throws:
IOException
- If anything goes wrong.javax.jcr.RepositoryException
-