473,383 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Could someone help me out with my namespace problems in my XSD

Could someone help me out with the following?

I've got
1)an xml file
2)an xsl
3)a schema

My namespaces are as follow

molecular_db.xml
<database
xmlns="http://www.mine.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mine.com mdb_schema.xsd"

mdb_schema.xsd
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mine.com"
targetNamespace="http://www.mine.com"
elementFormDefault="qualified">

dB_ss.xsl
<xsl:stylesheet version = "1.0"
xmlns="http://www.mine.com"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"


When I try it out in XMLWriter I keep getting an error that states I
can't use xs:element in the context defined as
xsi:schemaLocation="http://www.mine.com mdb_schema.xsd".

Hence, all I get for output are the headers I defined in the xsl. Take
away the xsd declarations and everything is fine. Better yet, take-away
the xmlns declaration in my xml file and it doesn't look for the xsd and
the file displays fine, headers and data all formatted by the xsl.
What's wrong with my file and how do I fix it?

Jan 20 '06 #1
5 1452


Mike_August wrote:

My namespaces are as follow

molecular_db.xml
<database
xmlns="http://www.mine.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mine.com mdb_schema.xsd"
>


mdb_schema.xsd
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mine.com"
targetNamespace="http://www.mine.com"
elementFormDefault="qualified">

dB_ss.xsl
<xsl:stylesheet version = "1.0"
xmlns="http://www.mine.com"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"


If your XSLT stylesheet is supposed to have XPath expressions and match
patterns matching any of the elements in the http://www.mine.com
namespace then you need a prefix e.g.
xmlns:pf="http://www.mine.com"
bound to the namespace URI and then use that prefix e.g.
<xsl:template match="pf:database">
That has to happen in the XSLT stylesheet only so no change to the XML
or schema is needed.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 20 '06 #2
Martin Honnen wrote:


Mike_August wrote:

My namespaces are as follow

molecular_db.xml
<database
xmlns="http://www.mine.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mine.com mdb_schema.xsd"
>


mdb_schema.xsd
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mine.com"
targetNamespace="http://www.mine.com"
elementFormDefault="qualified">

dB_ss.xsl
<xsl:stylesheet version = "1.0"
xmlns="http://www.mine.com"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

If your XSLT stylesheet is supposed to have XPath expressions and match
patterns matching any of the elements in the http://www.mine.com
namespace then you need a prefix e.g.
xmlns:pf="http://www.mine.com"
bound to the namespace URI and then use that prefix e.g.
<xsl:template match="pf:database">
That has to happen in the XSLT stylesheet only so no change to the XML
or schema is needed.

I'm not using a template. Besides if I change xsl:stylesheet to
xsl:template match="pf:database: and place mlns:pf="http://www.mine.com"
in my database xml file then I just get a 'xsl:stylesheet' does not
match start tag 'xsl:template'. And so this does not solve the problem.

Mike
Jan 20 '06 #3


Mike_August wrote:

I'm not using a template. Besides if I change xsl:stylesheet to
xsl:template match="pf:database: and place mlns:pf="http://www.mine.com"
in my database xml file then I just get a 'xsl:stylesheet' does not
match start tag 'xsl:template'. And so this does not solve the problem.


So your XSLT stylesheet is empty besides the xsl:stylesheet element?
Surely you have
xsl:template
instructions in your XSLT stylesheet? Hmm, indeed you have only
<xsl:template match="/">
but of course I wrote the above as an example and explictly mentioned
XPath expressions and match patterns.
The advice is correct, the stylesheet needs to bind a prefix to the
namespace URI and the XPath expressions need to use that e.g.
<xsl:for-each select="pf:database/pf:molecule">
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 20 '06 #4
Martin Honnen wrote:


Mike_August wrote:

I'm not using a template. Besides if I change xsl:stylesheet to
xsl:template match="pf:database: and place mlns:pf="http://www.mine.com"
in my database xml file then I just get a 'xsl:stylesheet' does not
match start tag 'xsl:template'. And so this does not solve the problem.

So your XSLT stylesheet is empty besides the xsl:stylesheet element?
Surely you have
xsl:template
instructions in your XSLT stylesheet? Hmm, indeed you have only
<xsl:template match="/">
but of course I wrote the above as an example and explictly mentioned
XPath expressions and match patterns.
The advice is correct, the stylesheet needs to bind a prefix to the
namespace URI and the XPath expressions need to use that e.g.
<xsl:for-each select="pf:database/pf:molecule">


Right, did you check your advice on my file? I'll check it out soon. So
I'm supposed to apply the pf namespace for all elements, or just the
for-each tags?
Jan 22 '06 #5


Mike_August wrote:

So
I'm supposed to apply the pf namespace for all elements, or just the
for-each tags?


Any XPath expression to match/select elements in that namespace needs to
have prefix:localname and not simply localname.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Ryan Paul | last post by:
I've spent a lot of time using python, and personally, I feel like it is vastly superior when compared to languages like java, and c++, but there are still a few things that detract from its...
2
by: Martin Magnusson | last post by:
I'm including a library in my program that I have wrapped in a namespace, since it contains typdefes that clash with my own. Like this: namespace OPT{ #include "OPT/NLP.h" #include "OPT/NLF.h"...
2
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
1
by: amir | last post by:
Hi, When compiling a page in VS2005 this morning I received 101 messages regarding schema problems in my web.config file. When I go to view an aspx page in my IIS, IE just displays a blank...
3
by: sjt003 | last post by:
I have been developing web apps in Visual Studio 2003, but since the other developers in my office don't use Visual Studio, I may have to stop too unless there is an efficient way for them to...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: Sky | last post by:
Hi, Like many others, I've search the newsgroups and KB's and none quite seem to be the problem I am encountering. The problem is as follows: 1) I originally created an ASP.Net Web...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
4
by: karen.homersham | last post by:
Just working through Apress Pro ASP NET.2.0.E Commerce in C Sharp. I am having problems compiling the following: using System; using System.Collections.Generic; using System.Text; namespace...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.