473,382 Members | 1,349 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,382 software developers and data experts.

Issue in validating xml file with xsd

3
I have an A.xml file which I am trying to validate with an A.xsd file.

Hi All,

A.xsd file inturn imports B.xsd and C.xsd.

In A.xsd I have an element named "Account".
Account is of type tpAccount which is declared in B.xsd.

<xs:complexType name="Message">
<xs:sequence>
<xs:choice>
<xs:element name="Account" type="B:tpAccount"/>
</xs:choice>
<xs:sequence>
</xs:complexType>

Type tpAccount has a chiled element named Result.
Element Result is of type tpResult.tpresult is declared in C.xsd.

Type tpAccount is defined B.xsd as follows.

<xs:complexType name="tpAccount">
<xs:sequence>
<xs:element name="Result" type="C:tpResult" />
</xs:sequence>
</xs:complexType>


Type tpResult is defined C.xsd as follow.

<xs:complexType name="tpResult">
<xs:sequence>
<xs:element name="AccountGroup" type="enumResultObjects">
</xs:element>
</xs:sequence>
<xs:complexType>


The A.xml file which I am validating with A.xsd is has section as follows.

<Account>
<Result>
<AccountGroup>someinfo</AccountGroup>
</Result>
</Account>

Now when I validate the A.xml file it gives me error "The element 'Account" has invalid child element 'Result".

Whereas the schema has Result defiend as the child of element of the element Account.

Any inputs on this issue would be helpful.
Jul 27 '07 #1
2 1397
jkmyoung
2,057 Expert 2GB
My guess is a namespace issue
Do you have xmlns: , targetNamespace, and/or elementFormDefault="qualified" in your schema root in your B.xsd,?
Jul 27 '07 #2
mehuls
3
My guess is a namespace issue
Do you have xmlns: , targetNamespace, and/or elementFormDefault="qualified" in your schema root in your B.xsd,?
I tried adding xmlns and target namespace in B.xsd.It's working fine now.

Thanks a lot for the input.
Jul 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Jack Kaufmann | last post by:
I am trying to verify a datagrid in which there must be an entry in both columns of any new row, and those values must be greater than the corresponding values in the previous row. It is pretty...
1
by: Christian | last post by:
Hi, I load an Xml-file "customers.xml" into a DataSet (works fine) but then how do I validate it against a schema (e.g. customers.xsd) ? my customers.xml: <?xml version="1.0"...
1
by: Andy | last post by:
I am having some trouble validating XML using the XmlValidatingReader. I have created some xml and used the visual studio to generate the schema. So I am confident that the xml and schema match. ...
2
by: Chris Dunaway | last post by:
I have a form with a textbox and numerous panels, buttons and other controls. I have handled the textbox Validating and Validated events. The textbox will hold a filename. In the validating...
0
by: Sam | last post by:
Hi, I have a grid on which the Validating event contains a pop up that prompts the user for yes or no. If the user click yes the event is cancel otherwise it's not (e.Cancel = True vs e.Cancel =...
1
by: Chris Lieb | last post by:
I have an XML Schema file that I know is correct becuase I currently use it in a VB6 program to validate XML documents. Also, if I load an XML file into VS2005 that is not valid against this...
1
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I've noticed that controls do not raise a Validating event if they are contained in a ToolStripDropDown via a ToolStripControlHost item. Please run the following sample and follow the instructions...
7
by: dmorand | last post by:
I'm having an issue validating that the "Add" button was selected..... <cfform name="NEW_FORM" action="systemSubmit.cfm"> <tr><td colspan=2 align="center"><h4>Submit New System</h4></td></tr>...
11
Dormilich
by: Dormilich | last post by:
Hello, I'm trying to validate my XML files against a DTD with PHP 5 and it spits out element order errors (see below). the files validate in FF (once I set the used entities in the local DTD part,...
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.