Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Fri Feb 15, 2013 9:40 am

i have a problem with the method appendHTML(), specifically with the w3 validation. It can happen that sometimes there is not valid html (For example: <p>Text....<p></ p></ p>),and then the page is in error:

Code: Select all
The element 'p' in namespace 'http://www.w3.org/1999/xhtml' has invalid child element 'p' in namespace 'http://www.w3.org/1999/xhtml'. List of possible elements expected: 'http://www.w3.org/1999/xhtml:a http://www.w3.org/1999/xhtml:br http://www.w3.org/1999/xhtml:span http://www.w3.org/1999/xhtml:bdo http://www.w3.org/1999/xhtml:object http://www.w3.org/1999/xhtml:applet http://www.w3.org/1999/xhtml:img http://www.w3.org/1999/xhtml:map http://www.w3.org/1999/xhtml:iframe http://www.w3.org/1999/xhtml:tt http://www.w3.org/1999/xhtml:i http://www.w3.org/1999/xhtml:b http://www.w3.org/1999/xhtml:u http://www.w3.org/1999/xhtml:s http://www.w3.org/1999/xhtml:strike http://www.w3.org/1999/xhtml:big http://www.w3.org/1999/xhtml:small http://www.w3.org/1999/xhtml:font http://www.w3.org/1999/xhtml:basefont http://www.w3.org/1999/xhtml:em http://www.w3.org/1999/xhtml:strong http://www.w3.org/1999/xhtml:dfn http://www.w3.org/1999/xhtml:code http://www.w3.org/1999/xhtml:q http://www.w3.org/1999/xhtml:samp http://www.w3.org/1999/xhtml:kbd http://www.w3.org/1999/xhtml:var http://www.w3.org/1999/xhtml:cite http://www.w3.org/1999/xhtml:abbr http://www.w3.org/1999/xhtml:acronym http://www.w3....

My question is whether it is possible to bypass this control or manage it in some way ?
In addition, there is a method to check if the text is OK or not to w3 validation? So we can periodically clean the database without the user crashed the system

Thank you

Posts: 20
Joined: Thu Sep 27, 2012 9:01 am

Sun Feb 17, 2013 9:19 am


Thanks for your inquiry.
It looks like your html code is not well-form. You can try this code
Code: Select all
doc.XHTMLValidateOption = Spire.Doc.Documents.XHTMLValidationType.None;

before calling AppendHTML() method. But I'm afraid that this error will occur still. Because the tag </ p> cann't be parsed. It means that you need to correct your html code. You can try
Code: Select all
html = Regex.Replace(html, @"\</\s*(\w+)\s*\>", "</$1>");

or other regex to fix it.

Technical Support / Developer,
e-iceblue Support Team
User avatar

Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Wed Feb 20, 2013 7:37 am


Had your problem been solved? Please tell us if you still have the problem.

Best Regards,
E-iceblue support team
User avatar

Posts: 2539
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc