Welcome to dbForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

SQLXML Namespaces

 
   Database Forums (Home) -> XML RSS
Next:  unknown sql operator  
Author Message
aowen355




Joined: Jul 05, 2005
Posts: 4



(Msg. 1) Posted: Tue Jul 05, 2005 1:37 pm
Post subject: SQLXML Namespaces

I am trying to extract information from an SQL database and convert it to an XML file. The schema for this xml file is defined in an xsd document.

For some reason though the outputted XML information looks like this <y0:Name xmlns:y0="http://www.ns.com/3.0">Test Text</y0:Name>

I dont understand why it is ammending the y0: information, I just want it to look like this
<Name>Test Text</Name>

I know this must have something to do with my xmlns definitions in the xsd file but i dont know how to correct this, can someone point me in the right direction please??

 >> Stay informed about: SQLXML Namespaces 
Back to top
Login to vote
Graeme Malcolm

External


Since: May 12, 2004
Posts: 83



(Msg. 2) Posted: Wed Jul 06, 2005 5:55 am
Post subject: Re: SQLXML Namespaces [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Your schema must have a default or target namespace declaration for the
http://www.ns.com/3.0 namespace. Semantically,
<y0:Name xmlns:y0="http://www.ns.com/3.0">Test Text</y0:Name>
is exactly the same as:
<Name xmlns="http://www.ns.com/3.0">Test Text</Name>
or even:
<mydata xmlns="http://www.ns.com/3.0">
<Name>Test Text</Name>
</mydata>

The way to "Fix" the namespace issue depends on how you're extracting the
data from SQL Server. Can you post a little more information, such as the
schema, the table defs, and any script you're using?

--
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group Ltd.
www.contentmaster.com


"aowen355" <UseLinkToEmail RemoveThis @dbForumz.com> wrote in message
news:4_826230_972918b7e86b589084aea48a1679c9d8@dbforumz.com...
I am trying to extract information from an SQL database and convert it
to an XML file. The schema for this xml file is defined in an xsd
document.

For some reason though the outputted XML information looks like this
<y0:Name xmlns:y0="http://www.ns.com/3.0">Test Text</y0:Name>

I dont understand why it is ammending the y0: information, I just want
it to look like this
<Name>Test Text</Name>

I know this must have something to do with my xmlns definitions in the
xsd file but i dont know how to correct this, can someone point me in
the right direction please??

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/XML-SQL-Namespaces-ftopict237713.html
Visit Topic URL to contact author (reg. req'd). Report abuse:
http://www.dbforumz.com/eform.php?p=826230

 >> Stay informed about: SQLXML Namespaces 
Back to top
Login to vote
aowen355




Joined: Jul 05, 2005
Posts: 4



(Msg. 3) Posted: Wed Jul 06, 2005 7:54 am
Post subject: Re: SQLXML Namespaces [Login to view extended thread Info.]

ok, here is more information:
Code:

<xsd:schema xmlns:sql="urn:schemas-microsoft-com:mapping-schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:j="http://www.ns.com/3.0" elementFormDefault="unqualified" attributeFormDefault="unqualified">

<xsd:annotation>
<xsd:appinfo>
<!--to keep this short, i am only showing one relationship, my file has several-->
<sql:relationship name="MasterData" parent="P_INCID_ENTITY_TAB" parent-key="MSTR_NO" child="P_MSTR_TAB" child-key="MSTR_NO"/>
</xsd:annotation>
</xsd:appinfo>
<xsd:import namespace="http://www.ns.com/3.0" schemaLocation="ao/3.0/sch1.xsd"/>

<xsd:element name="I_REPORT" sql:relation="P_INCID_ENTITY_TAB" >
<xsd:complexType>
 <xsd:sequence>
<xsd:element name="LocationStreet" sql:is-constant="1">
<xsd:complexType>
<xsd:sequence>
     <xsd:element ref="j:StreetNumberText"   sql:field="Primary_Street_Num" sql:relation="P_INCID_TAB" sql:relationship="MasterData"/>
     <xsd:element ref="j:StreetName" sql:field="Primary_Street_Name" sql:relation="P_INCID_TAB" sql:relationship="MasterData"/>  </xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complex type>


The place where I am having the problem is the output from the two element ref lines. (j:StreetNumberText and j:StreetName)
There is more to this code, but i think this shows the needed info, let me know if you need more.
Thank you so very much

-Andrew
 >> Stay informed about: SQLXML Namespaces 
Back to top
Login to vote
Graeme Malcolm

External


Since: May 12, 2004
Posts: 83



(Msg. 4) Posted: Thu Jul 07, 2005 7:55 am
Post subject: Re: Re: SQLXML Namespaces [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

So, actually the results are correct - you've returned elements in the
http://www.ns.com/3.0 namespace in the midst of elements in no specific
namespace, so SQLXML has declared an arbitrary prefix for the namespace and
used it. The actual prefix is irrelevant - You've used "j" in the schema,
SQLXML has used "y0" in the results, and in any code that you use to process
the results you can declare any prefix you like and the XML parser will
match the elements based on the namespace.

Cheers,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group Ltd.
www.contentmaster.com


"aowen355" <DoNotEmail RemoveThis @dbForumz.com> wrote in message
news:4_827127_fc06dd1e6a5dbca855cb665b09a575ca@dbforumz.com...
"" wrote:
> Your schema must have a default or target namespace
> declaration for the
> http://www.ns.com/3.0 namespace. Semantically,
> <y0:Name xmlns:y0="http://www.ns.com/3.0">Test Text</y0:Name>
> is exactly the same as:
> <Name xmlns="http://www.ns.com/3.0">Test Text</Name>
> or even:
> <mydata xmlns="http://www.ns.com/3.0">
> <Name>Test Text</Name>
> </mydata>
>
> The way to "Fix" the namespace issue depends on how you're
> extracting the
> data from SQL Server. Can you post a little more information,
> such as the
> schema, the table defs, and any script you're using?
>
> --
> Graeme Malcolm
> Principal Technologist
> Content Master
> - a member of CM Group Ltd.
> www.contentmaster.com
>
>
> "aowen355" <UseLinkToEmail RemoveThis @dbForumz.com> wrote in message
> news:4_826230_972918b7e86b589084aea48a1679c9d8@dbforumz.com...
> I am trying to extract information from an SQL database and
> convert it
> to an XML file. The schema for this xml file is defined in an
> xsd
> document.
>
> For some reason though the outputted XML information looks
> like this
> <y0:Name xmlns:y0="http://www.ns.com/3.0">Test Text</y0:Name>
>
> I dont understand why it is ammending the y0: information, I
> just want
> it to look like this
> <Name>Test Text</Name>
>
> I know this must have something to do with my xmlns
> definitions in the
> xsd file but i dont know how to correct this, can someone
> point me in
> the right direction please??
>
> --
> Posted using the http://www.dbforumz.com interface, at
> author's request
> Articles individually checked for conformance to usenet
> standards
> Topic URL:
> http://www.dbforumz.com/XML-SQL-Namespaces-ftopict237713.html
> Visit Topic URL to contact author (reg. req'd). Report abuse:
>
> http://www.dbforumz.com/eform.php?p=826230

ok, here is more information:

<xsd:schema xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:j="http://www.ns.com/3.0" elementFormDefault="unqualified"
attributeFormDefault="unqualified">

<xsd:annotation>
<xsd:appinfo>
<!--to keep this short, i am only showing one relationship, my file
has several-->
<sql:relationship name="MasterData" parent="P_INCID_ENTITY_TAB"
parent-key="MSTR_NO" child="P_MSTR_TAB" child-key="MSTR_NO"/>
</xsd:annotation>
</xsd:appinfo>
<xsd:import namespace="http://www.ns.com/3.0"
schemaLocation="ao/3.0/sch1.xsd"/>

<xsd:element name="I_REPORT" sql:relation="P_INCID_ENTITY_TAB" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LocationStreet" sql:is-constant="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="j:StreetNumberText"
sql:field="Primary_Street_Num" sql:relation="P_INCID_TAB"
sql:relationship="MasterData"/>
<xsd:element ref="j:StreetName"
sql:field="Primary_Street_Name" sql:relation="P_INCID_TAB"
sql:relationship="MasterData"/> </xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complex type>

The place where I am having the problem is the output from the two
element ref lines. (j:StreetNumberText and j:StreetName)
There is more to this code, but i think this shows the needed info,
let me know if you need more.
Thank you so very much

-Andrew
 >> Stay informed about: SQLXML Namespaces 
Back to top
Login to vote
aowen355




Joined: Jul 05, 2005
Posts: 4



(Msg. 5) Posted: Thu Jul 07, 2005 8:47 am
Post subject: Re: Re: SQLXML Namespaces [Login to view extended thread Info.]

ok...i see what you are saying...
Is there a way though that I can strip the name space prefix on the actual data, more or less for aesthetics i guess? I am trying to create a way for interoperability. So basically this file can be sent to anyone with the correct stylesheet and it will display the correct results. It is kind of confusing.
I guess I am kind of confused as to why SQLXML adds the Y0, instead of J or nothing at all.
I am using SQL 2000, if i were to get SQL2005 would this be any different?
Maybe I am just being picky, or weird.....
 >> Stay informed about: SQLXML Namespaces 
Back to top
Login to vote
aowen355




Joined: Jul 05, 2005
Posts: 4



(Msg. 6) Posted: Thu Jul 07, 2005 10:11 am
Post subject: Re: Re: SQLXML Namespaces [Login to view extended thread Info.]

After looking this over, I better understand what is happening

Just for the fact of well-formatted XML output, i would just like a way to get rid of the namespace info in front of the certain lines, but i guess if theres no way to do that its ok
 >> Stay informed about: SQLXML Namespaces 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
namespaces - OK, one question, why do I see URLs appearing in namespace definitions? OK, two questions - does that mean my local XML system is going to actually try to read from that URL location at any time? I *gather* it is a matter of making sure your namespace....

multiple xml namespaces - I have an xml document with nested fragments, each with their own default namespace. My xquery select statement fails because I can only declare one default namespace. Has anyone encountered this issue before? Am I overlooking something?

use sql:variable to declare xml namespaces in stored proce.. - Is there a way to use sql:variable to declare xml namespaces? For example: declare @namespace as nvarchar(50); set @namespace = "microsoft.com" select @validXml.query(' declare default elemant namespace ''sql:variable("@namespace&...

2000 = SQLXML 2005 = ??? (what is SQLXML replaced with in .. - Does anyone know what to use now instead of SQLXML to simply output XML over HTTP? I don't need any WSDL at this stage although it would be nice, just after outputting XML directly from the server over HTTP. Any suggestions and or tutorials would be muc...

SQLXML and XSL and VB.NET - I can find an example on how I call a stored proc and return XML and attach a stylesheet to it and render the HTML to the page using vb.net. I would like to display reports this way. If there is a simpler way to do the same thing let me know. I'm open to...
   Database Forums (Home) -> XML All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]