use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.
the class WrappedHrefWriter method writeValue.
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
writer.open(prefix, localName);
WrappedHref wrappedHref = (WrappedHref) val;
if (wrappedHref != null && wrappedHref.getValue() != null) {
// TODO: Replace explicit namespace declaration with reference to constant
Element hrefEl = writer.begin(WebDavProtocol.NS_DAV.getPrefix(), "href").open();
hrefEl.writeText(wrappedHref.getValue());
hrefEl.close();
}
writer.close(prefix, localName);
}
use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.
the class AddressDataTypeListValueWriter method writeValue.
@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
if (val instanceof AddressDataTypeList) {
Element parent = writer.begin(prefix, localName).open();
AddressDataTypeList list = (AddressDataTypeList) val;
if (list != null) {
for (Pair<String, String> pair : list) {
Element child = writer.begin(prefix + ":address-data-type").open(false);
child.writeAtt("content-type", pair.getObject1());
child.writeAtt("version", pair.getObject2());
child.close();
}
}
parent.close();
} else {
if (val != null) {
throw new RuntimeException("Value is not correct type. Is a: " + val.getClass());
}
}
}
use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.
the class HrefListValueWriter method writeValue.
@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
if (val instanceof HrefList) {
Element outerEl = writer.begin(prefix, localName).open();
HrefList list = (HrefList) val;
if (list != null) {
for (String s : list) {
Element hrefEl = writer.begin(WebDavProtocol.DAV_PREFIX + ":href").open(false);
hrefEl.writeText(s);
hrefEl.close();
}
}
outerEl.close();
} else {
if (val != null) {
throw new RuntimeException("Value is not correct type. Is a: " + val.getClass());
}
}
}
use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.
the class PriviledgeListValueWriter method writeValue.
@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
if (val instanceof PriviledgeList) {
PriviledgeList list = (PriviledgeList) val;
Element outerEl = writer.begin(prefix, localName).open();
if (list != null) {
for (Priviledge p : list) {
String privilegeString = PriviledgeListValueWriter.priviledgeToStringMap.get(p);
if (privilegeString == null) {
continue;
}
Element privilegeEl = writer.begin(WebDavProtocol.DAV_PREFIX + ":privilege").open(false);
Element privilegeValueEl = privilegeEl.begin(WebDavProtocol.DAV_PREFIX, privilegeString);
privilegeValueEl.noContent();
privilegeEl.close();
}
}
outerEl.close();
} else {
if (val != null) {
throw new RuntimeException("Value is not correct type. Is a: " + val.getClass());
}
}
}
use of io.milton.http.XmlWriter.Element in project lobcder by skoulouzis.
the class PropFindResponseListWriter method writeValue.
@Override
public void writeValue(XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes) {
Element outerEl = writer.begin(prefix, localName).open();
PropFindResponseList list = (PropFindResponseList) val;
if (list != null) {
for (PropFindResponse s : list) {
propFindXmlGeneratorHelper.appendResponse(writer, s, nsPrefixes);
}
}
outerEl.close();
}
Aggregations