use of com.dexels.navajo.adapter.xmlmap.TagMap in project navajo by Dexels.
the class TmlToXmlMap method appendProperty.
private final void appendProperty(Property p, TagMap parent) throws UserException {
TagMap property = new TagMap();
property.setCompact(true);
property.setName(p.getName());
property.setText(p.getValue());
parent.setChild(property);
}
use of com.dexels.navajo.adapter.xmlmap.TagMap in project navajo by Dexels.
the class TmlToXmlMap method appendMessages.
private final void appendMessages(Message m, TagMap parent) throws UserException {
if (!m.getMode().equals(Message.MSG_MODE_IGNORE)) {
// Check for array messages. Only append array children
TagMap child;
if (!m.getType().equals(Message.MSG_TYPE_ARRAY)) {
child = new TagMap();
child.setCompact(true);
child.setName(m.getName());
parent.setChild(child);
} else {
child = parent;
}
List<Property> allProperties = m.getAllProperties();
for (int i = 0; i < allProperties.size(); i++) {
appendProperty(allProperties.get(i), child);
}
List<Message> allMessages = m.getAllMessages();
for (int i = 0; i < allMessages.size(); i++) {
appendMessages(allMessages.get(i), child);
}
}
}
use of com.dexels.navajo.adapter.xmlmap.TagMap in project navajo by Dexels.
the class XMLMap method main.
public static void main(String[] args) throws Exception {
XMLMap xml = new XMLMap();
xml.setStart("xml");
TagMap district = new TagMap();
district.setName("district");
xml.setChild(district);
district.setName("DISTRIKTJE");
district.setName("WERKT DIT NOG STEEDS");
logger.info("child = {}", xml.getChildTag("district", 0));
TagMap n = new TagMap();
n.setName("apenoot");
n.setText("Achterlijke");
district.setChild(n);
Binary b = xml.getContent();
xml.setChildName("district");
TagMap kind = xml.getChild();
logger.info("kind = {}", kind.getName());
StringWriter sw = new StringWriter();
b.writeBase64(sw);
logger.info("Result: {}", sw);
}
use of com.dexels.navajo.adapter.xmlmap.TagMap in project navajo by Dexels.
the class XMLMap method parseXML.
private void parseXML(XMLElement e) throws UserException {
String startName = e.getName();
this.setName(startName);
// parse attributes
Iterator<String> attrib_enum = e.enumerateAttributeNames();
while (attrib_enum.hasNext()) {
String key = attrib_enum.next();
String value = e.getStringAttribute(key);
if (this.attributes == null) {
this.attributes = new HashMap<String, String>();
}
this.attributes.put(key, value);
}
// parse children.
Vector<XMLElement> v = e.getChildren();
for (int i = 0; i < v.size(); i++) {
XMLElement child = v.get(i);
TagMap childTag = TagMap.parseXMLElement(child, this.compact);
childTag.setCompact(this.compact);
this.setChild(childTag);
}
// Check for text node.
if (e.getContent() != null && !e.getContent().equals("")) {
this.setText(e.getContent());
}
}
Aggregations