Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,26 @@ public static void replaceNamespacePrefixes(
final String oldPrefix = currentResolver.getNamespaceURI2PrefixMap().get(currentUri);

if (StringUtils.isNotEmpty(oldPrefix)) {
// Can we perform the prefix substitution?
validatePrefixSubstitutionIsPossible(oldPrefix, newPrefix, currentResolver);

if (mavenLog.isDebugEnabled()) {
mavenLog.debug("Subtituting namespace prefix [" + oldPrefix + "] with [" + newPrefix
+ "] in file [" + currentResolver.getSourceFilename() + "].");
}

// Get the Document of the current schema file.
if (generatedSchemaFileDocument == null) {
generatedSchemaFileDocument = parseXmlToDocument(generatedSchemaFile);
if (newPrefix.equals(oldPrefix)) {
mavenLog.warn("The namespace prefix [" + oldPrefix + "] is already present in file [" + currentResolver.getSourceFilename() + "]. Skipping substitution for this prefix.");
} else {
// Can we perform the prefix substitution?
validatePrefixSubstitutionIsPossible(oldPrefix, newPrefix, currentResolver);

if (mavenLog.isDebugEnabled()) {
mavenLog.debug("Subtituting namespace prefix [" + oldPrefix + "] with [" + newPrefix
+ "] in file [" + currentResolver.getSourceFilename() + "].");
}

// Get the Document of the current schema file.
if (generatedSchemaFileDocument == null) {
generatedSchemaFileDocument = parseXmlToDocument(generatedSchemaFile);
}

// Replace all namespace prefixes within the provided document.
process(generatedSchemaFileDocument.getFirstChild(), true,
new ChangeNamespacePrefixProcessor(oldPrefix, newPrefix));
}

// Replace all namespace prefixes within the provided document.
process(generatedSchemaFileDocument.getFirstChild(), true,
new ChangeNamespacePrefixProcessor(oldPrefix, newPrefix));
}
}
}
Expand Down
Loading