Re: Validation not occuring
- From: lists@xxxxxxxxxxxxxx
- Date: 18 Dec 2006 21:55:40 -0800
One more question. We want to also view the XML file tranformed by an
XSL file in a browser. However, from what I understand, it's not
allowed (under XSLT 1.0) to match on a default namespace without an
explicit prefix. Is this true?
In that case, is the only solution to include the specific prefix
(i.e., "girder") and then include that prefix infront of every element?
In otherwords, the XML would look something like this:
<girder:BRASS_GIRDER_GUI xmlns:girder="GirderGUI-Save-7.0.0.xsd">
<girder:FILE_TYPE>Save</girder:FILE_TYPE>
<girder:VERSION>0.0.0.0</girder:VERSION>
<girder:ADMINISTRATION>
u.s.w...
the XSD would remain the same as it did in the original post, and the
XSL file would also match on the girder prefix?
Thanks,
Matt.
lists@xxxxxxxxxxxxxx wrote:
Martin,
that fixed the issue. Thanks a lot for your help.
Matt.
Martin Honnen wrote:
<BRASS_GIRDER_GUI xmlns:girder="GirderGUI-Save-7.0.0.xsd">
You have a namespace declaration that binds the prefix girder to the
namespace URI GirderGUI-Save-7.0.0.xsd. However the XML does not seem to
use that prefix at all, as the elements you show do not use that prefix
in their names. That means that the BRASS_GIRDER_GUI element and its
descendant elements below are in _no namespace_ and not in the namespace
with the name GirderGUI-Save-7.0.0.xsd.
<FILE_TYPE>Save</FILE_TYPE>
<VERSION>0.0.0.0</VERSION>
<ADMINISTRATION>
<PROJECT_ID>Example</PROJECT_ID>
<PROJECT_TITLE>LRFR Example A1</PROJECT_TITLE>
...........
Here is the relevant XSD file. Note that the PROJECT_TITLE element
below has been altered.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="GirderGUI-Save-7.0.0.xsd"
elementFormDefault="qualified"
targetNamespace="GirderGUI-Save-7.0.0.xsd">
That schema however defines elements in its target namespace
GirderGUI-Save-7.0.0.xsd. So to have elements in that namespace in your
XML sample above you need e.g.
<BRASS_GIRDER_GUI xmlns="GirderGUI-Save-7.0.0.xsd">
so that the namespace declaration applies to the element and its desendants.
The validating XML parser looks at the root element of the instance
document and its namespace to look for a matching schema. In your case
it does not find one and then only emits a warning about that.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.
- Follow-Ups:
- Re: Validation not occuring
- From: Martin Honnen
- Re: Validation not occuring
- References:
- Validation not occuring
- From: lists
- Re: Validation not occuring
- From: Martin Honnen
- Re: Validation not occuring
- From: lists
- Re: Validation not occuring
- From: Martin Honnen
- Re: Validation not occuring
- From: lists
- Validation not occuring
- Prev by Date: Re: Validation not occuring
- Next by Date: Re: Using ProcessSchemaLocation
- Previous by thread: Re: Validation not occuring
- Next by thread: Re: Validation not occuring
- Index(es):
Relevant Pages
|