Re: Validation not occuring

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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/

.



Relevant Pages

  • Re: master / detail datagrid...
    ... Macromedia uses their prefix in the exact same way an XML ... A patent on the other hand can be obtained but unlike the paltry ... and an XML Namespace is the equivalent of a short musical ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: node() method ... xmlns
    ... error near 'declare namespace', expected string literal." ... You have saved me a ton of time and effort in understanding tsql xml ... prefix to qualify element names in your expression. ...
    (microsoft.public.sqlserver.xml)
  • RE: XmlDocument.SelectSingleNode XPathException
    ... The "xmlns:sns="http://www.test.org/sub"</a>;>" in the xml itself provides the ... > As for using XmlNamespaceManager to help executing XPATH in xmldocument ... > When there is namespace in an xml document to scope elements in different ... > name of an element is actually it's namespaceURI(not prefix) combined with ...
    (microsoft.public.dotnet.xml)
  • Re: Need help with Xpath
    ... XML, I define "ns1" as local prefix for the NS. ... XmlNamespaceManager nsMgr = new XmlNamespaceManager; ... >> XPath queries are namespace aware. ...
    (microsoft.public.dotnet.xml)
  • Re: Namespace Prefixes
    ... Does your "party" object to the use of a target namespace or just the ... You can work with XML documents without the target ... namespace and prefix by using custom XML pipelines so long as you don't have ... others want an xml document with no target namespace ...
    (microsoft.public.biztalk.general)