Hello, I have a very big XML file, that I would like to chop a bit and then process every chunk separately, but I do not know how to handle the xsi:noNamespaceSchemaLocation attribute because now if I try to ignore it, I get an error.
First how I divide the big XML into smaller ones (query No. 1):
XML is much bigger in real life, it's just an example.
Then I try to get some stuff from one of the smaller ones (query No. 2):
And I get an error Undeclared namespace prefix: xsi.
I tried declaring namespace like written in documentation, no luck, my guess of course that I am doing it wrong, so if someone could show me how to do that, I would be very grateful.
Also bonus question, maybe there is a way to easily remove said attribute from XML using SA?
I am using SA12 if that matters.
What exactly are you trying to do? With openxml() you should be able to filter a big XML file directly (via XPath and/or a WHERE clause), so you should not need to split up the XML document beforehand by yourself. This is somewhat comparable to a SELECT statement on a big table where you can restrict the result set by using an appropriate WHERE clause instead of removing rows from the table...
So I would suggest to not modify the XML document but to use a WHERE clause to then filter the generated result set.
In case you want to shorten the XML document (primarily for testing/development) and it does contain very many "<INDIVIDUAL\>" nodes, you might be more successful if you remove most of them but preserve the underlying document structure including the root. That should prevent the namespace error, too.
As to the "xsi:noNamespaceSchemaLocation" attribute: AFAIK openxml() does not validate the schema at all, so that attribute should not matter here. To cite from the docs: