BizTalk Server General - Referencing the xml: namespace in BTS2004

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > April 2004 > Referencing the xml: namespace in BTS2004





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Referencing the xml: namespace in BTS2004
vsiwc

2004-04-23, 4:35 pm

I need to validate XML documents where some of the elements carry the xml:lang attribute (see http://www.w3.org/XML/1998/namespace). My starting point is the DTD below. I add this as a generated item to get the xsd below. This xsd fails validation, wit
h error message:

C:...<snip>...xsd Node "<Schema>" - Schema reference "xml.xsd" is not a valid reference or does not exist in the current project."

The only workaround I found was to add a file "xml.xsd" to the project, even if it's completely empty. TurboXML suggested taking out schemaLocation="xml.xsd" but BTS2004 still wouldn't validate that.

Is there a better way?

Wil

DTD:
<!ELEMENT root (Name , Age)><!ATTLIST root xml:lang CDATA #REQUIRED ><!ELEMENT Name (#PCDATA)><!ELEMENT Age (#PCDATA)>


xsd:
<?xml version="1.0" encoding="utf-16"?><xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import schemaLocation="xml.xsd" namespace="http://www.w3.org/XML/1998/namespace" /><xs:element name="Age" type="xs:string" /><
xs:element name="root"><xs:complexType><xs:sequence><xs:element ref="Name" /><xs:element ref="Age" /></xs:sequence><xs:attribute ref="xml:lang" /></xs:complexType></xs:element><xs:element name="Name" type="xs:string" /></xs:schema>
Shaheer Abubucker

2004-04-28, 5:36 pm

Wil,

I looked into this and you can get the xml.xsd that you need from
http://www.w3.org/2001/xml.xsd

This is the xsd file that contains the definitions for xml:lang, xml:base,
and xml:space and references XMLSchemas.dtd which references doctypes.dtd.
This gives you everything you need to use xml:lang.

After saving this file to your project folder, you will have to change the
"XMLSchema.dtd" in the second line to
"http://www.w3.org/2001/XMLSchema.dtd" so that you don't need the
referenced files locally..

You need to then add the xml.xsd file to your project. You should then be
able to validate your xsd file and also xml.xsd and you should now be able
to build with no errors.

I also generated the following XML instance and validated it against the
DTD (using XML Spy) and the generated XSD (in BTS 2004) to verify that the
generated XSD was equivalent to the original DTD.

<?xml version="1.0" encoding="UTF-8" ?>
<root xml:lang="en">
<Name>Text</Name>
<Age>Text</Age>
</root>

Thanks,
Shaheer Abubucker
Microsoft Biztalk Server Team
This posting is provided "AS IS" with no warranties,and confers no rights.
Subscribe at
http://support.microsoft.com/defaul...msdn/nospam.asp
&SD=msdn



--------------------
| Thread-Topic: Referencing the xml: namespace in BTS2004
| X-Tomcat-NG: microsoft.public.biztalk.general
|
| I need to validate XML documents where some of the elements carry the
xml:lang attribute (see http://www.w3.org/XML/1998/namespace). My starting
point is the DTD below. I add this as a generated item to get the xsd
below. This xsd fails validation, with error message:

C:...<snip>...xsd Node "<Schema>" - Schema reference "xml.xsd" is not a
valid reference or does not exist in the current project."

The only workaround I found was to add a file "xml.xsd" to the project,
even if it's completely empty. TurboXML suggested taking out
schemaLocation="xml.xsd" but BTS2004 still wouldn't validate that.

Is there a better way?

Wil

DTD:
<!ELEMENT root (Name , Age)><!ATTLIST root xml:lang CDATA #REQUIRED
><!ELEMENT Name (#PCDATA)><!ELEMENT Age (#PCDATA)>



xsd:
<?xml version="1.0" encoding="utf-16"?><xs:schema
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import
schemaLocation="xml.xsd" namespace="http://www.w3.org/XML/1998/namespace"
/><xs:element name="Age" type="xs:string" /><xs:element
name="root"><xs:complexType><xs:sequence><xs:element ref="Name"
/><xs:element ref="Age" /></xs:sequence><xs:attribute ref="xml:lang"
/></xs:complexType></xs:element><xs:element name="Name" type="xs:string"
/></xs:schema>
|

vsiwc

2004-04-30, 5:35 pm

Re-posting without the attachment, 120KB appears to be too much to post.
=================
Thanx a ton Shaheer, this gets me 75% of the way there. The other 25%
appears to have to do with the fact that BTS2004 is treating the xml:
namesace as any other namespace instead of the reserved namespace the W3C
intended. Take a look at a sample message I'm getting out of a schema
(ignore the values, they're all made up):

<ns0:SIF_Message Version="1.1"
xmlns:ns1="http://www.w3.org/XML/1998/namespace"
xmlns:ns0=http://visualsi.com/B2BSolution>
<ns0:SIF_Ack>
<ns0:SIF_Status>
<ns0:SIF_Data>
<ns0:SIF_Message Version="1.1" />
</ns0:SIF_Data>
</ns0:SIF_Status>
</ns0:SIF_Ack>
<ns0:SIF_Event>
<ns0:SIF_ObjectData>
<ns0:Assessment ns1:lang="en">
<ns0:Title>lunguw</ns0:Title>
<ns0:AssessmentType>Meshuaw</ns0:AssessmentType>
<ns0:AssessmentInstanceForm>lunguw, gaeplu</ns0:AssessmentInstanceForm>
<ns0:AssessmentComment>82</ns0:AssessmentComment>
<ns0:PauseFlag>641</ns0:PauseFlag>
<ns0:Objective>8/10/1990</ns0:Objective>
<ns0:Rubric>
<ns0:Criterion>M</ns0:Criterion>
</ns0:Rubric>
</ns0:Assessment>
</ns0:SIF_ObjectData>
</ns0:SIF_Event>
</ns0:SIF_Message>

What I had expected was for only one namespace to be defined
(xmlns=http://visualsi.com/B2BSolution), for all the tags to be namespace
unqualified, except for the "lang" attribute qualified to the special xml:
namespace (which doesn't need an xmlns declaration).

I am sure the xml above will break some of my clients' applications. Is
there any hope of "improving" on it? I am including in this posting to the
newsgroup a zip of my project and a file drop directory.

Thanx!

Wil

"Shaheer Abubucker" <shaheera@online.microsoft.com> wrote in message
news:JvJIddWLEHA.928@cpmsftngxa10.phx.gbl...
> Wil,
>
> I looked into this and you can get the xml.xsd that you need from
> http://www.w3.org/2001/xml.xsd
>
> This is the xsd file that contains the definitions for xml:lang, xml:base,
> and xml:space and references XMLSchemas.dtd which references doctypes.dtd.
> This gives you everything you need to use xml:lang.
>
> After saving this file to your project folder, you will have to change the
> "XMLSchema.dtd" in the second line to
> "http://www.w3.org/2001/XMLSchema.dtd" so that you don't need the
> referenced files locally..
>
> You need to then add the xml.xsd file to your project. You should then be
> able to validate your xsd file and also xml.xsd and you should now be able
> to build with no errors.
>
> I also generated the following XML instance and validated it against the
> DTD (using XML Spy) and the generated XSD (in BTS 2004) to verify that the
> generated XSD was equivalent to the original DTD.
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <root xml:lang="en">
> <Name>Text</Name>
> <Age>Text</Age>
> </root>
>
> Thanks,
> Shaheer Abubucker
> Microsoft Biztalk Server Team
> This posting is provided "AS IS" with no warranties,and confers no rights.
> Subscribe at
>

http://support.microsoft.com/defaul...msdn/nospam.asp
> &SD=msdn
>
>
>
> --------------------
> | Thread-Topic: Referencing the xml: namespace in BTS2004
> | X-Tomcat-NG: microsoft.public.biztalk.general
> |
> | I need to validate XML documents where some of the elements carry the
> xml:lang attribute (see http://www.w3.org/XML/1998/namespace). My

starting
> point is the DTD below. I add this as a generated item to get the xsd
> below. This xsd fails validation, with error message:
>
> C:...<snip>...xsd Node "<Schema>" - Schema reference "xml.xsd" is not a
> valid reference or does not exist in the current project."
>
> The only workaround I found was to add a file "xml.xsd" to the project,
> even if it's completely empty. TurboXML suggested taking out
> schemaLocation="xml.xsd" but BTS2004 still wouldn't validate that.
>
> Is there a better way?
>
> Wil
>
> DTD:
> <!ELEMENT root (Name , Age)><!ATTLIST root xml:lang CDATA #REQUIRED
>
>
> xsd:
> <?xml version="1.0" encoding="utf-16"?><xs:schema
> elementFormDefault="qualified"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import
> schemaLocation="xml.xsd" namespace="http://www.w3.org/XML/1998/namespace"
> /><xs:element name="Age" type="xs:string" /><xs:element
> name="root"><xs:complexType><xs:sequence><xs:element ref="Name"
> /><xs:element ref="Age" /></xs:sequence><xs:attribute ref="xml:lang"
> /></xs:complexType></xs:element><xs:element name="Name" type="xs:string"
> /></xs:schema>
> |
>







Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com