We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The namespace declaration attribute has an incorrect 'namespaceURI': 'http://www.w3.org/2000/xmlns/'

Next code throws error “The namespace declaration attribute has an incorrect ‘namespaceURI’: ‘http://www.w3.org/2000/xmlns/’”:

Document document = new Document(“some file name”);
var taggedContent = document.TaggedContent;

at System.Xml.XmlDocument.AddAttrXmlName(String prefix, String localName, String namespaceURI, IXmlSchemaInfo schemaInfo) in //src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 246
at System.Xml.XmlDocument.CreateAttribute(String prefix, String localName, String namespaceURI) in /
/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 1077
at System.Xml.XmlDocument.CreateAttribute(String name) in //src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 621
at System.Xml.XmlElement.SetAttribute(String name, String value) in /
/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlElement.cs:line 292
at #=zjQRU3Ao6xrQglQDRuDAyxDoJwXDnliF5fgby7_8=.#=zK0TKl6M=()
at #=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU=.#=zO7BbkWdjmvny(XmlWriter #=z2SoVpeo=, #=znW6c6Kz1bkIt6JQavitBbpbULd53Eoll4VBbe7g= #=z4CBTcAA=)
at #=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU=.#=zO7BbkWdjmvny(Stream #=zpCqxRiM=, Int32 #=zS9olONc=)
at #=zvtO6Ng$WpwYB54ImeHA3xachkgcINUx$g3YrQuY=.#=zAXS20pc=(#=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU= #=znMMS7AE=, Boolean #=zzXFX2oqk_4XT)
at #=zvtO6Ng$WpwYB54ImeHA3xachkgcINUx$g3YrQuY=.#=z3eVHLp4ztRSz(#=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU= #=zK1Y9$H4=)
at #=zuTuMyEuDuO0yqfG15EVOd7ocgYLG.#=z41mhV3jKGcJ1()
at #=zuTuMyEuDuO0yqfG15EVOd7ocgYLG…ctor(Document #=z_UAyEcE=)
at #=zHfMpHx8S3XPVBqRdjpgWwigKIRkX…ctor(Document #=z_UAyEcE=)
at Aspose.Pdf.Document.get_TaggedContent()

The error has occurred once on different files. Unfortunately it cannot be reproduced. Can you suggest any possible reasons?

Tech stack: Aspose.PDF 22.11.0, .Net 5
OS: CentOS 8

Hi @asposeuuups
I correctly understood that the error occurred once and is no longer reproduced. Even if you try to repeat everything the same way?

Yes, I have not found a way to reproduce it.

Can you provide a file with which this exactly happened?

I have added one of the files with which there was a problem. However, the problem does not seem to be related to a specific file, but rather to a situation when many files are being processed at the same time.
Dogovir _Test vid 17.03.2022.docx (16.9 KB)

Doesn’t it turn out that one document is processed in several threads/processes? This feature is not supported by the library.

We’re actually creating a document from a MemoryStream, so it’s a new document every time.
I added a very simplified version of the code first, it actually looks something like this:

private byte[] TestMethod(byte[] pdfDocIn)
    using (var pdfDocStream = new MemoryStream())
        pdfDocStream.Write(pdfDocIn, 0, pdfDocIn.Length);
        pdfDocStream.Seek(0, SeekOrigin.Begin);
        using (var pdfDoc = new Aspose.Pdf.Document(pdfDocStream))
            var taggedContent = document.TaggedContent;
			//some another code
        return pdfDocStream.ToArray();

Thanks for the code snippet. We will try to reproduce the problem

Do I understand correctly that the call to the method TestMethod is carried out as follows?

var result = TestMethod(File.ReadAllBytes(myDir + "Dogovir _Test vid 17.03.2022.docx"));