all groups > dotnet xml > february 2006 >
You're in the

dotnet xml

group:

Xml space and ms-data interpretation different in VS2005


Xml space and ms-data interpretation different in VS2005 adgnews NO[at]SPAM gmail.com
2/27/2006 5:11:06 AM
dotnet xml:
I have a problem converting a program from Vb.net VS2003 to VS2005. I
process a xml-file with an inline schema. In 2003 no problem. In 2005 I
have 2 problems:

1) BIG space="preserve" problem.
Suddenly the spaces are a problem during processing (The following text
is not allowed in this context: ' '). Without the space="preserve" (or
default) it works okay, but what to do now since I can't influence the
dataformat.

2) SMALLER xml-msdata/IsDataSet problem.
As long as there is a reference to the xml-msdata namespace in the file
the VS2005 designers can't correctly display the data in the xml-file.
Saw that the designer tools have changed, but I expect a previously
correct file should produce te same output as in VS2003. Now I only get
an empty row with 5 columns that should have data about present
relationships (file has nog relations but is as simple as 123).

The lines in the file that produce the strange behaviour are right at
the start:
<?xml version = "1.0" encoding="UTF-8" standalone="yes"?>
<VFPData xml:space="preserve">
<xsd:schema id="VFPData" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="VFPData" msdata:IsDataSet="true">
Re: Xml space and ms-data interpretation different in VS2005 Zafar Abbas
3/8/2006 8:21:37 AM
Could you share the code and XML/XSD data that you are using?

[quoted text, click to view]

Re: Xml space and ms-data interpretation different in VS2005 adjo
3/9/2006 6:37:57 AM
Simple version here. 'View datagrid' in VS2005 gives error that xmldoc
is wellformed but contains structure the dataview cannot display. The
text ' ' is not allowed. Change the word "preserve" in line 2 in
"default" and the problem is gone.

<?xml version="1.0" encoding="utf-8" ?>
<VFPData xml:space="preserve">
<xsd:schema id="VFPData" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="VFPData" >
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="exp_results">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id1" type="xsd:int" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<exp_results>
<id1>1</id1>
</exp_results>
</VFPData>
Re: Xml space and ms-data interpretation different in VS2005 Zafar Abbas
3/9/2006 3:07:06 PM
That's because xml:space="preserve" makes all whitespaces in the document
tobe treated as significant.whitespaces. Since the content model you define
for type VFPData is ElementOnly, you can not be significant whitespaces in
there. If you want to validate whitespaces (and text) within the content of
your type, then you should put mixed="true" attribyte on the <complexType>
tag.

[quoted text, click to view]

AddThis Social Bookmark Button