Skip to content

Commit

Permalink
DomReader: COrrectly inherit root namespace context
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydamage committed Feb 2, 2021
1 parent 713f581 commit 4809d50
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -78,8 +78,9 @@ List<RootXNodeImpl> readObjects() throws SchemaException {
return Collections.singletonList(read());
} else {
List<RootXNodeImpl> rv = new ArrayList<>();
PrismNamespaceContext context = rootContext.childContext(DOMUtil.getNamespaceDeclarationsNonNull(root));
for (Element child : DOMUtil.listChildElements(root)) {
rv.add(new DomReader(child, schemaRegistry, rootContext).read());
rv.add(new DomReader(child, schemaRegistry, context.inherited()).read());
}
return rv;
}
Expand All @@ -101,18 +102,18 @@ private boolean rootIsNotObjectsMarker() {
* Reads the content of the element.
*
* @param knownElementName Pre-fetched element name. Might be null (this is expected if storeElementName is true).
* @param rootContext2
* @param parentContext
*/
@NotNull
private XNodeImpl readElementContent(@NotNull Element element, QName knownElementName, PrismNamespaceContext rootContext2, boolean storeElementName) throws SchemaException {
private XNodeImpl readElementContent(@NotNull Element element, QName knownElementName, PrismNamespaceContext parentContext, boolean storeElementName) throws SchemaException {
XNodeImpl node;

QName xsiType = DOMUtil.resolveXsiType(element);
QName elementName = knownElementName != null ? knownElementName : DOMUtil.getQName(element);

// FIXME: read namespaces
Map<String, String> localNamespaces = DOMUtil.getNamespaceDeclarationsNonNull(element);
PrismNamespaceContext localNsCtx = rootContext2.childContext(localNamespaces);
PrismNamespaceContext localNsCtx = parentContext.childContext(localNamespaces);

Element valueChild = DOMUtil.getMatchingChildElement(element, valueElementName);
if (valueChild != null) {
Expand Down

0 comments on commit 4809d50

Please sign in to comment.