I'm working with open xml documents, and I'm trying to validate an xml
doc against the published standards (http://openxmldeveloper.org/
archive/2006/09/12/641.aspx), I'm using the file called dml-chart.xsd.
It imports namespaces from several of the other xsd files in the
collection.
Now I'm pretty confident that these are well-formed XSD files, but
when I do:
xsd_file = File.join(xsd_file_path,"dml-chart.xsd")
xsd = Nokogiri::XML::Schema(File.read(xsd_file))
I get the error message:
Nokogiri::XML::SyntaxError: element decl. '{http://
schemas.openxmlformats.org/drawingml/2006/chart}txPr', attribute
'type': The QName value '{http://schemas.openxmlformats.org/drawingml/
2006/main}CT_TextBody' does not resolve to a(n) type definition.
So the parser doesn't seem to understand the namespaces in the
document. Does anyone have any ideas how to load up a schema which has
namespaces and attributes defined in other files?
thanks in advance for any clues that anyone can provide
Les
Try loading the schema like this:
xsd = Nokogiri::XML::Schema(File.open(xsd_file))
When you just read from memory, nokogiri doesn't know the source of
the xsd file. If you pass it an open file handle, it can figure it
out.
If that doesn't work, please send in some code that I can try. Then
we can fix the problem for sure. :-)
--
Aaron Patterson
http://tenderlovemaking.com/
I'm not sure how to upload code for you to look at. The dml-chart.xsd
file I'm loading is too large to include in a post, and because it
refers to namespaces defined in several other files, it takes a
collection of files just to define the schema. The collection is at
the link in the original post... sorry to point you to that but I'm
not sure how else to show you the information.
Many thanks, Aaron, for your interest and quick response, and hopeful
that you can provide insight. Because of the subject (open xml
document schema files), I'm sure the solution will be of interest to
others in the future.
Les
On Feb 6, 3:55 pm, Aaron Patterson <aaron.patter...@gmail.com> wrote:
Are you sure that dml-chart.xsd is the correct xsd file to load? Even
xmllint throws processing errors when I tell it to use that xsd file.
There is a dml-baseStylesheet.xsd that seems to load ok. Maybe that
one includes the chart styles?
Also, if you're sure dml-chart.xsd is the correct file to use, could
you send me links for where you got that info? It may give me clues
as to how to get this to work.
> I'm not sure how to upload code for you to look at. The dml-chart.xsd
> file I'm loading is too large to include in a post, and because it
> refers to namespaces defined in several other files, it takes a
> collection of files just to define the schema. The collection is at
> the link in the original post... sorry to point you to that but I'm
> not sure how else to show you the information.
>
> Many thanks, Aaron, for your interest and quick response, and hopeful
> that you can provide insight. Because of the subject (open xml
> document schema files), I'm sure the solution will be of interest to
> others in the future.
No problem. We're here to help. :-)
If dml-chart.xsd is not included-in or referenced-by any of the other
files, and only includes or references other xsd files in the
collection, shouldn't it properly parse as a schema if it's well-
formed?
What I can' t understand is that it imports namespaces from dml-
text.xsd, and explicitly specifies that schemaLocation, but
Nokogiri::XML::Schema(file_handle_of_dml-chart.xsd) throws an error
that suggests it's not able to resolve the attribute
type="a:CT_TextBody" on the element with name="txPr" (line 387) even
though this is not the first such attribute in the a: namespace,
defined in dml-text.xsd, that it had encountered (e.g. line 386). It
presumably WAS able to resolve the qname of the attribute on line 386.
many thanks for your continuing help and interest
Les
On Feb 7, 11:49 am, Aaron Patterson <aaron.patter...@gmail.com> wrote: