Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

importXMLBuilder removes xmlns:xsi attribute #24

Open
yasarutkuu opened this issue Jun 9, 2022 · 2 comments
Open

importXMLBuilder removes xmlns:xsi attribute #24

yasarutkuu opened this issue Jun 9, 2022 · 2 comments

Comments

@yasarutkuu
Copy link

Hi,

I am trying to import some XMLBuilder2 node into another XMLBuilder2. But while doing this, i faced with this.

When i call below method, it drops xmlns:xsi attribute from elementNode. Have you any idea about this? @jmurty

builder.importXMLBuilder(elementNode);
@yasarutkuu
Copy link
Author

@balerilhan

@jmurty
Copy link
Owner

jmurty commented Jun 14, 2022

Hi @yasarutkuu the import method uses the standard Document#importNode method behind the scenes here:

Node importedNode = getDocument().importNode(
builder.getDocument().getDocumentElement(), true);
this.xmlNode.appendChild(importedNode);

So what you are seeing is most likely standard (mis)behaviour of the underlying XML import approach, rather than anything specific to XMLBuilder2.

I'd recommend looking to see if you can find a better way of importing element nodes that don't drop xmlns:xsi and do that instead via the underlying objects available from #getDocument or #getElement. Or perhaps hack around it by checking for this attribute before the import and re-adding it again afterwards?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants