[xml] Validating and XIncludes



Hi,

I don't know if this is a bug in libxml2 or not, it could be just that
I'm trying to do something that isn't possible with XIncludes and DTD
based validation...

Anyway, I thought I'd try to get an opinion on the outside chance that it
is a bug. I've observed this behaviour in both 2.6.10 and 2.6.16.

I'm trying to validate a document which uses XIncludes. The following
error message is produced when I use xmllint:

xmllint --xinclude --noout --postvalid generic_open.xml
generic_open.xml:13: element service_bundle: validity error : Element service_bundle content does not follow 
the DTD, expecting (service_bundle* | service* | xi:include*), got (service_bundle service service service 
service service service service service service service service service service service service service 
service service service service service service service service service service service service service 
service service service service service service service service service )
generic_open.xml:13: element service_bundle: validity error : No declaration for attribute xmlns:xi of 
element service_bundle
file:/var/svc/profile/name_service.xml:11: element service_bundle: validity error : No declaration for 
attribute base of element service_bundle
Document generic_open.xml does not validate

The appropriate part of generic_open.xml is:

     1  <?xml version='1.0'?>
     2  <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
     3  <!--
     4      Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
     5      Use is subject to license terms.
     6
     7      ident       "@(#)generic_open.xml   1.15    04/09/29 SMI"
     8
     9      Default service profile, containing a typical set of active service
    10      instances.
    11  -->
    12  <service_bundle type='profile' name='generic_open'
    13           xmlns:xi='http://www.w3.org/2003/XInclude' >
    14    <!--
    15        Include name service profile, as set by system id tools.
    16    -->
    17    <xi:include href='file:/var/svc/profile/name_service.xml' />
    18
...

/var/svc/profile/name_service.xml is:

     1  <?xml version='1.0'?>
     2  <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
     3  <!--
     4      Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
     5      Use is subject to license terms.
     6
     7      ident       "@(#)ns_files.xml       1.1     04/07/15 SMI"
     8
     9      Service profile to activate local files.
    10  -->
    11  <service_bundle type='profile' name='default'>
    12  </service_bundle>

I could include details of the DTD, but I think it's probably surplus to
requirements.

The puzzling parts of the above are:

1. Why does the error message say that the DTD isn't followed at line 13?
2. What can't it find a declaration for xmlns:xi?
3. What on earth is attribute base of element service_bundle?

This DTD wasn't written by me, it was produced by a colleague - so I can't
go into details of why it is structured like it is. However, I would like
to know if this is a bug in libxml2 or if we are trying to do something
which is completely wrong.

Thanks for any insights,

Gary

-- 
Gary Pennington
Solaris Kernel Development,
Sun Microsystems
Gary Pennington sun com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]