Hi Support.
I have a problem with the Java library “aspose-word”, which can be reproduced with the latest version 24.4.
To reproduce the error, you have to create a Word document with a “CustomDocumentProperty” (see also the attached sample code) whose name begins with a digit (e.g.: “123”).
final Document wordDoc = new Document();
final CustomDocumentProperties customProps = wordDoc.getCustomDocumentProperties();
customProps.add("123", "name with starting digit generates invalid xml");
If you save the created document in WordML format, the result is an invalid Xml.
final SaveOptions format = SaveOptions.createSaveOptions(SaveFormat.WORD_ML);
format.setPrettyFormat(true);
wordDoc.save(outstream, format);
The xml then contains the following fragment:
<o:CustomDocumentProperties>
<o:123 dt:dt="string">name with starting digit generates invalid xml</o:123>
</o:CustomDocumentProperties>
According to the xml specification, the LocalPart of a QualifiedName (here: “123”) must not start with a digit. (“0-9” is not contained in NameStartChar).
https://www.w3.org/TR/2009/REC-xml-names-20091208/#ns-qualnames
https://www.w3.org/TR/2009/REC-xml-names-20091208/#NT-NCName
https://www.w3.org/TR/REC-xml/#NT-NameStartChar
Attachment:
SampleClass.zip (1,0 KB)
Thank you in advance.