Search in sources :

Example 1 with XCardElement

use of ezvcard.io.xml.XCardElement in project ez-vcard by mangstadt.

the class VCardPropertyScribe method writeXml.

/**
 * Marshals a property's value to an XML element (xCard).
 * @param property the property
 * @param element the property's XML element.
 * @throws SkipMeException if the property should not be written to the data
 * stream
 */
public final void writeXml(T property, Element element) {
    XCardElement xCardElement = new XCardElement(element);
    _writeXml(property, xCardElement);
}
Also used : XCardElement(ezvcard.io.xml.XCardElement)

Example 2 with XCardElement

use of ezvcard.io.xml.XCardElement in project ez-vcard by mangstadt.

the class VCardPropertyScribe method parseXml.

/**
 * Unmarshals a property's value from an XML document (xCard).
 * @param element the property's XML element
 * @param parameters the parsed para
 * @param context the parse contextmeters
 * @return the unmarshalled property
 * @throws CannotParseException if the marshaller could not parse the
 * property's value
 * @throws SkipMeException if the property should not be added to the final
 * {@link VCard} object
 */
public final T parseXml(Element element, VCardParameters parameters, ParseContext context) {
    T property = _parseXml(new XCardElement(element), parameters, context);
    property.setParameters(parameters);
    return property;
}
Also used : XCardElement(ezvcard.io.xml.XCardElement)

Example 3 with XCardElement

use of ezvcard.io.xml.XCardElement in project ez-vcard by mangstadt.

the class XmlScribe method _parseXml.

@Override
protected Xml _parseXml(XCardElement element, VCardParameters parameters, ParseContext context) {
    Xml xml = new Xml(element.element());
    // remove the <parameters> element
    Element root = xml.getValue().getDocumentElement();
    for (Element child : XmlUtils.toElementList(root.getChildNodes())) {
        if ("parameters".equals(child.getLocalName()) && VCardVersion.V4_0.getXmlNamespace().equals(child.getNamespaceURI())) {
            root.removeChild(child);
        }
    }
    return xml;
}
Also used : Xml(ezvcard.property.Xml) XCardElement(ezvcard.io.xml.XCardElement) Element(org.w3c.dom.Element)

Aggregations

XCardElement (ezvcard.io.xml.XCardElement)3 Xml (ezvcard.property.Xml)1 Element (org.w3c.dom.Element)1