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