public void deserialize(XmlSchemaObject schemaObject,
QName name,
Node node) {
// we just attach the raw node either to the meta map of
// elements or the attributes
Map metaInfoMap = schemaObject.getMetaInfoMap();
if (metaInfoMap == null) {
metaInfoMap = new HashMap();
}
if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
if (name.getNamespaceURI().equals(Constants.XMLNS_ATTRIBUTE_NS_URI)) {
return;
}
Map attribMap;
if (metaInfoMap.containsKey(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES)) {
attribMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);
} else {
attribMap = new HashMap();
metaInfoMap.put(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES, attribMap);
}
attribMap.put(name, node);
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
Map elementMap;
if (metaInfoMap.containsKey(Constants.MetaDataConstants.EXTERNAL_ELEMENTS)) {
elementMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ELEMENTS);
} else {
elementMap = new HashMap();
metaInfoMap.put(Constants.MetaDataConstants.EXTERNAL_ELEMENTS, elementMap);
}
elementMap.put(name, node);
}
//subsequent processing takes place only if this map is not empty
if (!metaInfoMap.isEmpty() && schemaObject.getMetaInfoMap() == null) {
schemaObject.setMetaInfoMap(metaInfoMap);
}
}
|