Class XmlReader
- java.lang.Object
-
- org.apache.sling.jcr.contentloader.internal.readers.XmlReader
-
- All Implemented Interfaces:
ContentReader
public class XmlReader extends Object implements 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 aXmlReader.FileDescription
<nt:file>
element.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
XmlReader.AttributeMap
Utility class for dealing with attributes from KXmlParser.protected static class
XmlReader.FileDescription
Represents a reference to a file that is to be loaded into the repository.protected static class
XmlReader.NodeDescription
protected static class
XmlReader.PropertyDescription
-
Field Summary
-
Fields inherited from interface org.apache.sling.jcr.contentloader.ContentReader
PROPERTY_EXTENSIONS, PROPERTY_TYPES
-
-
Constructor Summary
Constructors Constructor Description XmlReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.
-
-
-
Method Detail
-
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:
ContentReader.parse(URL, org.apache.sling.jcr.contentloader.ContentCreator)
-
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
-
-