xml won't validate, having trouble with namespaces
up vote
1
down vote
favorite
I'm about to pull my hair out trying to figure out why this won't validate. I keep getting the error
cvc-elt.1: Cannot find the declaration of element 'ret'. [13]
Before I was getting the error on schemaLocation and it was telling me the URIs needed to be the same length or something but I fixed that by making schemaLocation, target, and targetNamespace the same.
But it still can't find my "ret" element declaration and I can't find out why. Now I'm not very good at namespaces, I don't understand them as well as everything else.
Any help would be much appreciated to figure out how to fix this error.
Oh also my .xsd file is named "ret" and so is my first element. I don't think that's causing an issue but so it doesn't confuse anyone. It's just a requirement I have.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:My.Namespace"
xmlns:target="urn:My.Namespace ret.xsd"
elementFormDefault="qualified"
>
<xs:element name="ret">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="feed" />
<xs:element ref="doc-copyright" />
</xs:sequence>
<xs:attribute fixed="1.0" name="version" type="xs:string" />
<xs:attribute name="date" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
This is part of my .xsd file
<?xml version="1.0" encoding="UTF-8"?>
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.w3schools.com"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
This is the part of the xml file that won't validate. If I need to post more I can. It is pretty long though. I'm wondering if this error is because My.Namespace isn't a valid namespace? I just don't understand.
xml xsd
add a comment |
up vote
1
down vote
favorite
I'm about to pull my hair out trying to figure out why this won't validate. I keep getting the error
cvc-elt.1: Cannot find the declaration of element 'ret'. [13]
Before I was getting the error on schemaLocation and it was telling me the URIs needed to be the same length or something but I fixed that by making schemaLocation, target, and targetNamespace the same.
But it still can't find my "ret" element declaration and I can't find out why. Now I'm not very good at namespaces, I don't understand them as well as everything else.
Any help would be much appreciated to figure out how to fix this error.
Oh also my .xsd file is named "ret" and so is my first element. I don't think that's causing an issue but so it doesn't confuse anyone. It's just a requirement I have.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:My.Namespace"
xmlns:target="urn:My.Namespace ret.xsd"
elementFormDefault="qualified"
>
<xs:element name="ret">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="feed" />
<xs:element ref="doc-copyright" />
</xs:sequence>
<xs:attribute fixed="1.0" name="version" type="xs:string" />
<xs:attribute name="date" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
This is part of my .xsd file
<?xml version="1.0" encoding="UTF-8"?>
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.w3schools.com"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
This is the part of the xml file that won't validate. If I need to post more I can. It is pretty long though. I'm wondering if this error is because My.Namespace isn't a valid namespace? I just don't understand.
xml xsd
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm about to pull my hair out trying to figure out why this won't validate. I keep getting the error
cvc-elt.1: Cannot find the declaration of element 'ret'. [13]
Before I was getting the error on schemaLocation and it was telling me the URIs needed to be the same length or something but I fixed that by making schemaLocation, target, and targetNamespace the same.
But it still can't find my "ret" element declaration and I can't find out why. Now I'm not very good at namespaces, I don't understand them as well as everything else.
Any help would be much appreciated to figure out how to fix this error.
Oh also my .xsd file is named "ret" and so is my first element. I don't think that's causing an issue but so it doesn't confuse anyone. It's just a requirement I have.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:My.Namespace"
xmlns:target="urn:My.Namespace ret.xsd"
elementFormDefault="qualified"
>
<xs:element name="ret">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="feed" />
<xs:element ref="doc-copyright" />
</xs:sequence>
<xs:attribute fixed="1.0" name="version" type="xs:string" />
<xs:attribute name="date" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
This is part of my .xsd file
<?xml version="1.0" encoding="UTF-8"?>
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.w3schools.com"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
This is the part of the xml file that won't validate. If I need to post more I can. It is pretty long though. I'm wondering if this error is because My.Namespace isn't a valid namespace? I just don't understand.
xml xsd
I'm about to pull my hair out trying to figure out why this won't validate. I keep getting the error
cvc-elt.1: Cannot find the declaration of element 'ret'. [13]
Before I was getting the error on schemaLocation and it was telling me the URIs needed to be the same length or something but I fixed that by making schemaLocation, target, and targetNamespace the same.
But it still can't find my "ret" element declaration and I can't find out why. Now I'm not very good at namespaces, I don't understand them as well as everything else.
Any help would be much appreciated to figure out how to fix this error.
Oh also my .xsd file is named "ret" and so is my first element. I don't think that's causing an issue but so it doesn't confuse anyone. It's just a requirement I have.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:My.Namespace"
xmlns:target="urn:My.Namespace ret.xsd"
elementFormDefault="qualified"
>
<xs:element name="ret">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="feed" />
<xs:element ref="doc-copyright" />
</xs:sequence>
<xs:attribute fixed="1.0" name="version" type="xs:string" />
<xs:attribute name="date" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
This is part of my .xsd file
<?xml version="1.0" encoding="UTF-8"?>
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.w3schools.com"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
This is the part of the xml file that won't validate. If I need to post more I can. It is pretty long though. I'm wondering if this error is because My.Namespace isn't a valid namespace? I just don't understand.
xml xsd
xml xsd
edited Nov 10 at 7:32
marc_s
567k12810961246
567k12810961246
asked Nov 10 at 3:45
Saiba
336
336
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
In your schema, you said that your elements will be bound to the urn:My.Namespace
when you have @targetNamespace="urn:My.Namespace"
.
But your instance XML document has a "ret" element that is bound to the http://www.w3schools.com
namespace.
In order for it to be schema valid, it must be bound to the urn:Ny.Namespace
namespace.
Change it to:
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:My.Namespace"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
and then deal with the other validation issues (no feed, doc-copyright, @version, or @date)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
In your schema, you said that your elements will be bound to the urn:My.Namespace
when you have @targetNamespace="urn:My.Namespace"
.
But your instance XML document has a "ret" element that is bound to the http://www.w3schools.com
namespace.
In order for it to be schema valid, it must be bound to the urn:Ny.Namespace
namespace.
Change it to:
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:My.Namespace"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
and then deal with the other validation issues (no feed, doc-copyright, @version, or @date)
add a comment |
up vote
0
down vote
accepted
In your schema, you said that your elements will be bound to the urn:My.Namespace
when you have @targetNamespace="urn:My.Namespace"
.
But your instance XML document has a "ret" element that is bound to the http://www.w3schools.com
namespace.
In order for it to be schema valid, it must be bound to the urn:Ny.Namespace
namespace.
Change it to:
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:My.Namespace"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
and then deal with the other validation issues (no feed, doc-copyright, @version, or @date)
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
In your schema, you said that your elements will be bound to the urn:My.Namespace
when you have @targetNamespace="urn:My.Namespace"
.
But your instance XML document has a "ret" element that is bound to the http://www.w3schools.com
namespace.
In order for it to be schema valid, it must be bound to the urn:Ny.Namespace
namespace.
Change it to:
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:My.Namespace"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
and then deal with the other validation issues (no feed, doc-copyright, @version, or @date)
In your schema, you said that your elements will be bound to the urn:My.Namespace
when you have @targetNamespace="urn:My.Namespace"
.
But your instance XML document has a "ret" element that is bound to the http://www.w3schools.com
namespace.
In order for it to be schema valid, it must be bound to the urn:Ny.Namespace
namespace.
Change it to:
<ret
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:My.Namespace"
xsi:schemaLocation="urn:My.Namespace ret.xsd">
</ret>
and then deal with the other validation issues (no feed, doc-copyright, @version, or @date)
answered Nov 10 at 5:14
Mads Hansen
43.6k1093119
43.6k1093119
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235833%2fxml-wont-validate-having-trouble-with-namespaces%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown