throw new RuntimeException(ie);
}
}
public StyledLayerDescriptor parseDescriptor(Node root) {
StyledLayerDescriptor sld = factory.createStyledLayerDescriptor();
// StyledLayer layer = null;
// LineSymbolizer symbol = factory.createLineSymbolizer();
NodeList children = root.getChildNodes();
final int length = children.getLength();
for (int i = 0; i < length; i++) {
Node child = children.item(i);
if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) {
continue;
}
String childName = child.getLocalName();
if (childName == null) {
childName = child.getNodeName();
}
if (childName.equalsIgnoreCase("Name")) {
sld.setName(getFirstChildValue(child));
} else if (childName.equalsIgnoreCase("Title")) {
sld.setTitle(getFirstChildValue(child));
} else if (childName.equalsIgnoreCase("Abstract")) {
sld.setAbstract(getFirstChildValue(child));
} else if (childName.equalsIgnoreCase("NamedLayer")) {
NamedLayer layer = parseNamedLayer(child);
sld.addStyledLayer(layer);
} else if (childName.equalsIgnoreCase("UserLayer")) {
StyledLayer layer = parseUserLayer(child);
sld.addStyledLayer(layer);
}
}
return sld;
}