{
throw new XMPException("Property name requires schema namespace",
XMPError.BADPARAM);
}
XMPPath expPath = XMPPathParser.expandXPath(schemaNS, propName);
XMPNode propNode = XMPNodeUtils.findNode(xmpImpl.getRoot(), expPath, false, null);
if (propNode != null)
{
if (doAllProperties
|| !Utils.isInternalProperty(expPath.getSegment(XMPPath.STEP_SCHEMA)
.getName(), expPath.getSegment(XMPPath.STEP_ROOT_PROP).getName()))
{
XMPNode parent = propNode.getParent();
parent.removeChild(propNode);
if (parent.getOptions().isSchemaNode() && !parent.hasChildren())
{
// remove empty schema node
parent.getParent().removeChild(parent);
}
}
}
}
else if (schemaNS != null && schemaNS.length() > 0)
{
// Remove all properties from the named schema. Optionally include
// aliases, in which case
// there might not be an actual schema node.
// XMP_NodePtrPos schemaPos;
XMPNode schemaNode = XMPNodeUtils.findSchemaNode(xmpImpl.getRoot(), schemaNS, false);
if (schemaNode != null)
{
if (removeSchemaChildren(schemaNode, doAllProperties))
{
xmpImpl.getRoot().removeChild(schemaNode);
}
}
if (includeAliases)
{
// We're removing the aliases also. Look them up by their
// namespace prefix.
// But that takes more code and the extra speed isn't worth it.
// Lookup the XMP node
// from the alias, to make sure the actual exists.
XMPAliasInfo[] aliases = XMPMetaFactory.getSchemaRegistry().findAliases(schemaNS);
for (int i = 0; i < aliases.length; i++)
{
XMPAliasInfo info = aliases[i];
XMPPath path = XMPPathParser.expandXPath(info.getNamespace(), info
.getPropName());
XMPNode actualProp = XMPNodeUtils
.findNode(xmpImpl.getRoot(), path, false, null);
if (actualProp != null)
{