Hello all,
I'm trying to put together a schema that would allow inline SVG
elements, but I'm having a lot of trouble making this work.
The main problem seems to be coming from the SVG schema
(from http://www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd )
I am loading documents like this:
DocumentBuilderFactory factory = new
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl();
factory.setFeature("http://apache.org/xml/features/validation/schema",
true);
factory.setFeature("http://xml.org/sax/features/validation", true);
factory.setFeature("http://xml.org/sax/features/namespaces", true);
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(source);
Even trying to validate a little document like this:
<?xml version="1.0" encoding="UTF-8"?>
<svg:svg height="10cm" width="11cm" viewBox="0 0 1100 1000"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2000/svg svg.xsd ">
<svg:rect x="1" y="1" width="1098" height="998" fill="none"
stroke="blue" stroke-width="2" />
</svg:svg>
leads to an impressive array of errors (at the end of this email).
Is there a problem with my configuration? Is there a problem with the
SVG schema? Is a working SVG schema available from anywhere else?
Without a working SVG schema is it possible to define an schema that
allows inline SVG content similar to this:
<xs:complexType name="mapEntryType">
<xs:sequence>
<xs:element ref="svg:svg" />
</xs:sequence>
</xs:complexType>
Thanks in advance for any help,
Benjamin Keil.
[Error] svg.xsd:344:61: s4s-att-not-allowed: Attribute 'type' cannot
appear in element 'attribute'.
[Error] xlink.xsd:21:55: s4s-att-not-allowed: Attribute 'use' cannot
appear in element 'attribute'.
[Error] xlink.xsd:22:58: s4s-att-not-allowed: Attribute 'use' cannot
appear in element 'attribute'.
[Error] xlink.xsd:23:56: s4s-att-not-allowed: Attribute 'use' cannot
appear in element 'attribute'.
[Error] svg.xsd:845:63: s4s-att-not-allowed: Attribute 'type' cannot
appear in element 'attribute'.
[Error] xlink.xsd:20:55: s4s-att-not-allowed: Attribute 'use' cannot
appear in element 'attribute'.
[Error] svg.xsd:1108:107: cvc-pattern-valid: Value 'xMidYMid meet' is
not facet-valid with respect to pattern
'(\s*("none"|x("Min"|"Mid"|"Max")y("Min"|"Mid"|"Max"))\s+("meet"|"slice")?\s*)'
for type 'PreserveAspectRatioSpecType'.
[Error] svg.xsd:1108:107: a-props-correct.2: Invalid value constraint
value 'xMidYMid meet' in attribute 'preserveAspectRatio'.
[Error] svg.xsd:1294:107: cvc-pattern-valid: Value 'xMidYMid meet' is
not facet-valid with respect to pattern
'(\s*("none"|x("Min"|"Mid"|"Max")y("Min"|"Mid"|"Max"))\s+("meet"|"slice")?\s*)'
for type 'PreserveAspectRatioSpecType'.
[Error] svg.xsd:1294:107: a-props-correct.2: Invalid value constraint
value 'xMidYMid meet' in attribute 'preserveAspectRatio'.
[Error] svg.xsd:1299:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1326:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1356:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1399:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1425:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1454:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1480:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1507:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1535:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1560:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1856:107: cvc-pattern-valid: Value 'xMidYMid meet' is
not facet-valid with respect to pattern
'(\s*("none"|x("Min"|"Mid"|"Max")y("Min"|"Mid"|"Max"))\s+("meet"|"slice")?\s*)'
for type 'PreserveAspectRatioSpecType'.
[Error] svg.xsd:1856:107: a-props-correct.2: Invalid value constraint
value 'xMidYMid meet' in attribute 'preserveAspectRatio'.
[Error] svg.xsd:1874:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1878:63: s4s-att-not-allowed: Attribute 'type' cannot
appear in element 'attribute'.
[Error] svg.xsd:1895:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:1935:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:2036:107: cvc-pattern-valid: Value 'xMidYMid meet' is
not facet-valid with respect to pattern
'(\s*("none"|x("Min"|"Mid"|"Max")y("Min"|"Mid"|"Max"))\s+("meet"|"slice")?\s*)'
for type 'PreserveAspectRatioSpecType'.
[Error] svg.xsd:2036:107: a-props-correct.2: Invalid value constraint
value 'xMidYMid meet' in attribute 'preserveAspectRatio'.
[Error] svg.xsd:2054:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:2162:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:2316:71: ct-props-correct.4: Error for type
'feFuncRType'. Duplicate attribute uses with the same name and target
namespace are specified. Name of duplicate attribute use is 'type'.
[Error] svg.xsd:2335:71: ct-props-correct.4: Error for type
'feFuncGType'. Duplicate attribute uses with the same name and target
namespace are specified. Name of duplicate attribute use is 'type'.
[Error] svg.xsd:2354:71: ct-props-correct.4: Error for type
'feFuncBType'. Duplicate attribute uses with the same name and target
namespace are specified. Name of duplicate attribute use is 'type'.
[Error] svg.xsd:2374:71: ct-props-correct.4: Error for type
'feFuncAType'. Duplicate attribute uses with the same name and target
namespace are specified. Name of duplicate attribute use is 'type'.
[Error] svg.xsd:2692:107: cvc-pattern-valid: Value 'xMidYMid meet' is
not facet-valid with respect to pattern
'(\s*("none"|x("Min"|"Mid"|"Max")y("Min"|"Mid"|"Max"))\s+("meet"|"slice")?\s*)'
for type 'PreserveAspectRatioSpecType'.
[Error] svg.xsd:2692:107: a-props-correct.2: Invalid value constraint
value 'xMidYMid meet' in attribute 'preserveAspectRatio'.
[Error] svg.xsd:2734:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:2792:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] svg.xsd:2936:57: cos-all-limited.1.2: An 'all' model group must
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and
that particle must be part of a pair which constitutes the '{'content
type'}' of a complex type definition.
[Error] xlink.xsd:45:55: s4s-att-not-allowed: Attribute 'use' cannot
appear in element 'attribute'.
[Error] xlink.xsd:46:53: s4s-att-not-allowed: Attribute 'use' cannot
appear in element 'attribute'.
|