org.apache.sling.jcr.contentloader.internal.readers
Class XmlReader

java.lang.Object
  extended by 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 a <nt:file> element.


Nested Class Summary
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
static ImportProvider PROVIDER
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROVIDER

public static final ImportProvider PROVIDER
Method Detail

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 interface ContentReader
Parameters:
url - The input stream.
Throws:
IOException
javax.jcr.RepositoryException
See Also:
ContentReader.parse(URL, org.apache.sling.jcr.contentloader.internal.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 interface ContentReader
Parameters:
ins - the input stream.
Throws:
IOException
javax.jcr.RepositoryException


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.