/** * Initializes the element mappings for this content handler.<p> * * Element mappings allow storing values from the XML content in other locations. * For example, if you have an element called "Title", it's likely a good idea to * store the value of this element also in the "Title" property of a XML content resource.<p> * * @param root the "mappings" element from the appinfo node of the XML content definition * @param contentDefinition the content definition the mappings belong to * @throws CmsXmlException if something goes wrong */ protected void initMappings(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException { Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(root, APPINFO_MAPPING); while (i.hasNext()) { // iterate all "mapping" elements in the "mappings" node Element element = i.next(); // this is a mapping node String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT); String maptoName = element.attributeValue(APPINFO_ATTR_MAPTO); String useDefault = element.attributeValue(APPINFO_ATTR_USE_DEFAULT); if ((elementName != null) && (maptoName != null)) { // add the element mapping addMapping(contentDefinition, elementName, maptoName, useDefault); } } }
/** * Initializes the element mappings for this content handler.<p> * * Element mappings allow storing values from the XML content in other locations. * For example, if you have an element called "Title", it's likely a good idea to * store the value of this element also in the "Title" property of a XML content resource.<p> * * @param root the "mappings" element from the appinfo node of the XML content definition * @param contentDefinition the content definition the mappings belong to * @throws CmsXmlException if something goes wrong */ protected void initMappings(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException { Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(root, APPINFO_MAPPING); while (i.hasNext()) { // iterate all "mapping" elements in the "mappings" node Element element = i.next(); // this is a mapping node String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT); String maptoName = element.attributeValue(APPINFO_ATTR_MAPTO); if ((elementName != null) && (maptoName != null)) { // add the element mapping addMapping(contentDefinition, elementName, maptoName); } } }