Trouble validating SVG document

I have an SVG document where the openeing SVG element is: <svg version="1.0" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="497.611" height="591.554" viewBox="0 0 497.611 591.554" style="overflow:visible;enable-background:new 0 0 497.611 591.554;" xml:space="preserve"> Validation fails on each of the xmlns attributes. This should be valid. The errors look like: SystemID: /home/bv6679/Development/images/HSVG/99571_97YA_17.svg Engine name: Xerces Severity: error Description: Attribute "xmlns:x" must be declared for element type "svg". Start location: 29:21 End location: 29:42 Any ideas?

Hi Tim, I will assume that the entities like "&ns_ai;" used in the attribute values are defined in the DTD declaration used to validate the SVG file. The problem is that SVG files are validated against DTD grammars. DTD is not namespace aware, it sees namespace binding attributes like "xmlns:x" like simple attribute names which need to be declared in the DTD in order to be recognized. For example in the DTD used by default by Oxygen to validate DTDs the <svg> root element is defined as having the following attributes: <!ATTLIST svg xmlns CDATA #FIXED "http://www.w3.org/2000/svg" xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink" %stdAttrs; %testAttrs; %langSpaceAttrs; externalResourcesRequired %Boolean; #IMPLIED class %ClassList; #IMPLIED style %StyleSheet; #IMPLIED %PresentationAttributes-All; viewBox %ViewBoxSpec; #IMPLIED preserveAspectRatio %PreserveAspectRatioSpec; 'xMidYMid meet' zoomAndPan (disable | magnify) 'magnify' %graphicsElementEvents; %documentEvents; version %Number; #FIXED "1.0" x %Coordinate; #IMPLIED y %Coordinate; #IMPLIED width %Length; #IMPLIED height %Length; #IMPLIED contentScriptType %ContentType; "text/ecmascript" contentStyleType %ContentType; "text/css" > So if you do not add an attribute definition for "xmlns:x" in the attributes list, the DTD will think the attribute is undefined. Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 10/14/2010 4:50 PM, Reaves, Timothy wrote:
I have an SVG document where the openeing SVG element is: <svg version="1.0" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="497.611" height="591.554" viewBox="0 0 497.611 591.554" style="overflow:visible;enable-background:new 0 0 497.611 591.554;" xml:space="preserve">
Validation fails on each of the xmlns attributes. This should be valid. The errors look like: SystemID: /home/bv6679/Development/images/HSVG/99571_97YA_17.svg Engine name: Xerces Severity: error Description: Attribute "xmlns:x" must be declared for element type "svg". Start location: 29:21 End location: 29:42
Any ideas? _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

On Thursday, October 14, 2010, 3:50:50 PM, Timothy wrote: RT> I have an SVG document where the openeing SVG element is: RT> <svg version="1.0" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" RT> xmlns:graph="&ns_graphs;" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" RT> width="497.611" height="591.554" viewBox="0 0 497.611 591.554" RT> style="overflow:visible;enable-background:new 0 0 497.611 591.554;" RT> xml:space="preserve"> So, this has come from Adobe Illustrator, and it declares two Adobe namespaces as well as the SVG and XLink namespaces. It does that via entity declarations in the internal DTD subset. I assume that your file still has these. If you are using a DTD for validation, since DTDs are not namespace aware you will need to declare the namespace declarations (DTDs consider these to be attributes); either in the internal DTD subset or in your local copy of the SVG DTD. -- Chris Lilley Technical Director, Interaction Domain W3C Graphics Activity Lead, Fonts Activity Lead Co-Chair, W3C Hypertext CG Member, CSS, WebFonts, SVG Working Groups
participants (3)
-
Chris Lilley
-
Radu Coravu
-
Reaves, Timothy