Re: [oXygen-user] Trouble validating SVG document

Hi Tim, W3C describes the content of a <svg> document in a schema-independent way. From what I know there are also XML Schemas which can be used to validate SVG files. Indeed the usual way to validate a SVG file is by using the DTDs but DTD as a grammar specification is not namespace aware and understands constructs like "xmlns:x" as usual attributes. Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 10/14/2010 6:00 PM, Reaves, Timothy wrote:
I'm confused then. From http://www.w3.org/TR/SVG/struct.html#SVGElement they reference to follow what is outlined http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-decl .
"
An example namespace declaration, which associates the namespace prefix *edi* with the namespace name |http://ecommerce.example.org/schema|:
<x xmlns:edi='http://ecommerce.example.org/schema'> <!-- the"edi" prefix is bound tohttp://ecommerce.example.org/schema for the"x" element and contents --> </x>
"
So the W3C is recommending something that is invalid?
On Thu, Oct 14, 2010 at 10:56 AM, Radu Coravu <radu_coravu@sync.ro <mailto:radu_coravu@sync.ro>> wrote:
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 <mailto:oXygen-user@oxygenxml.com> > http://www.oxygenxml.com/mailman/listinfo/oxygen-user
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com <mailto:oXygen-user@oxygenxml.com> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (1)
-
Radu Coravu