ezvcard.io
Class XCardReader

java.lang.Object
  extended by ezvcard.io.XCardReader
All Implemented Interfaces:
IParser

public class XCardReader
extends Object
implements IParser

Unmarshals XML-encoded vCards into VCard objects.

Author:
Michael Angstadt
See Also:
RFC 6351

Nested Class Summary
static class XCardReader.XCardNamespaceContext
          Namespace context to use for xCard XPath expressions.
 
Field Summary
static XCardReader.XCardNamespaceContext nsContext
           
 
Constructor Summary
XCardReader(Document document)
           
XCardReader(File file)
           
XCardReader(InputStream in)
           
XCardReader(Reader reader)
           
XCardReader(String xml)
           
 
Method Summary
 CompatibilityMode getCompatibilityMode()
          Deprecated. 
 List<String> getWarnings()
          Gets the warnings from the last vCard that was unmarshalled.
 VCard readNext()
          Reads the next vCard.
 void registerExtendedType(Class<? extends VCardType> clazz)
          Registers an extended type class.
 void setCompatibilityMode(CompatibilityMode compatibilityMode)
          Deprecated. 
 void unregisterExtendedType(Class<? extends VCardType> clazz)
          Removes an extended type class that was previously registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nsContext

public static final XCardReader.XCardNamespaceContext nsContext
Constructor Detail

XCardReader

public XCardReader(String xml)
            throws SAXException
Parameters:
xml - the XML string to read the vCards from
Throws:
SAXException - if there's a problem parsing the XML

XCardReader

public XCardReader(InputStream in)
            throws SAXException,
                   IOException
Parameters:
in - the input stream to read the vCards from
Throws:
IOException - if there's a problem reading from the input stream
SAXException - if there's a problem parsing the XML

XCardReader

public XCardReader(File file)
            throws SAXException,
                   IOException
Parameters:
file - the file to read the vCards from
Throws:
IOException - if there's a problem reading from the file
SAXException - if there's a problem parsing the XML

XCardReader

public XCardReader(Reader reader)
            throws SAXException,
                   IOException
Parameters:
reader - the reader to read the vCards from
Throws:
IOException - if there's a problem reading from the reader
SAXException - if there's a problem parsing the XML

XCardReader

public XCardReader(Document document)
Parameters:
document - the XML document to read the vCards from
Method Detail

getCompatibilityMode

@Deprecated
public CompatibilityMode getCompatibilityMode()
Deprecated. 

Gets the compatibility mode. Used for customizing the unmarshalling process based on the application that generated the vCard.

Returns:
the compatibility mode

setCompatibilityMode

@Deprecated
public void setCompatibilityMode(CompatibilityMode compatibilityMode)
Deprecated. 

Sets the compatibility mode. Used for customizing the unmarshalling process based on the application that generated the vCard.

Parameters:
compatibilityMode - the compatibility mode

registerExtendedType

public void registerExtendedType(Class<? extends VCardType> clazz)
Description copied from interface: IParser
Registers an extended type class.

Specified by:
registerExtendedType in interface IParser
Parameters:
clazz - the extended type class to register (MUST have a public, no-arg constructor)

unregisterExtendedType

public void unregisterExtendedType(Class<? extends VCardType> clazz)
Description copied from interface: IParser
Removes an extended type class that was previously registered.

Specified by:
unregisterExtendedType in interface IParser
Parameters:
clazz - the extended type class to remove (MUST have a public, no-arg constructor)

getWarnings

public List<String> getWarnings()
Description copied from interface: IParser
Gets the warnings from the last vCard that was unmarshalled. This list is reset every time a new vCard is read.

Specified by:
getWarnings in interface IParser
Returns:
the warnings or empty list if there were no warnings

readNext

public VCard readNext()
Description copied from interface: IParser
Reads the next vCard.

Specified by:
readNext in interface IParser
Returns:
the next vCard or null if there are no more


Copyright © 2012-2013. All Rights Reserved.