Re: [oXygen-user] Trouble validating SVG document

Thanks for all the info; I now understand what is going on. On Fri, Oct 15, 2010 at 7:31 AM, Chris Lilley <chris@w3.org> wrote:
On Friday, October 15, 2010, 11:03:26 AM, Radu wrote:
RC> Hi Tim,
RC> W3C describes the content of a <svg> document in a schema-independent way. RC> From what I know there are also XML Schemas which can be used to RC> validate SVG files.
Yes.
Going forward, W3C plans to use RelaxNG to define the SVG grammar (and to recommend NVDL for portioning out a multi-namespace document such that the SVG parts are validated to the SVG RNG).
RC> Indeed the usual way to validate a SVG file is by using the DTDs but DTD RC> as a grammar specification is not namespace aware and understands RC> constructs like "xmlns:x" as usual attributes.
Yes.
It should not, but DTDs predate namespaces and are not aware of namespace declarations.
RC> Radu Coravu RC> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger RC> http://www.oxygenxml.com
RC> 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|<http://ecommerce.example.org/schema%7C> :
<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>
"
Yes, that is fine.
So the W3C is recommending something that is invalid?
No. Its only invalid if using a substandard validation mechanism (DTDs). Namespace-aware schema languages such as W3C XML Schema or RelaxNG have no problem with namespace declarations.
The definition of a conforming SVG fragment is here http://www.w3.org/TR/SVG/conform.html#ConformingSVGDocuments
If you want to use extensions in other namespaces and also want the instances to be DTD valid, this part of the SVG specification explains how to do that http://www.w3.org/TR/SVG/extend.html#PrivateElementsAndAttribute
Lastly, if using SVG files generated by Adobe Illustrator, it is wise to check the output settings and ensure that the 'round trip' option is not set (it includes an entire, base64-encoded PDF file into the SVG) and to ensure that any Adobe extensions are a) desired b) actually used Often, namespace declarations will be present but not actually used.
A useful program to take SVG generated by various authoring tools and tidy it up is Scour http://www.codedread.com/scour/
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
RC> _______________________________________________ RC> oXygen-user mailing list RC> oXygen-user@oxygenxml.com RC> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
-- 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 (1)
-
Reaves, Timothy