Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » XML Validation via local XSD file
XML Validation via local XSD file [message #220173] Thu, 04 September 2008 20:26 Go to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Hello,

I have a problem in my RCP application where we use the webtools xml
editor and validation. We are moving from DTD to XSD for xml validation.
We use XStream to render out our java objects to xml and need a way to
validate them using XSD. So...we now use JAXB to render out the class xsd
files. So now i have the xml and the xsd. Next, I want to be able to
click on an xml file in the rcp project navigator and click validate.
Then I want the xml to be validated with a local xsd file. When i get the
xml file to link to the xsd file, i get "cvc-elt.1: Cannot find the
declaration of element". After doing some research, it looks like i need
to enable namespace-aware(ness) and have no idea how to turn that on.
This is long and confusing..i apologize for that, but if anyone could help
me out, that would be great!

Ideally I would like to use uri for a local namespace maybe using this
extension: org.eclipse.wst.xml.core.catalogContributions but so far I
haven't found much documentation on this. Does this allow my RCP app to
register an XSD file to a local uri and then allow me to put that uri in
my xml file? Clearly i need help.

Thanks!
Re: XML Validation via local XSD file [message #220182 is a reply to message #220173] Thu, 04 September 2008 21:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

For JAXB you need to setup a NamespacePrefixMapper, so and set the
appropriate namespaces, otherwise JAXB won't write out and XML with the
appropriate namespaces. Also, be very careful with JAXB or any XML
Databinding (except possibily EMF's XML schema support, it rocks!), as
you can still write invalid XML even though it the classes were
generated from the XSD. Also becareful that xsi:types aren't being
included in your XML as it acts as substitution groups, and overrides
definitions at that level.

http://fisheye5.cenqua.com/browse/~raw,r=1.16/jaxb-architect ure-document/www/doc/com/sun/xml/bind/marshaller/NamespacePr efixMapper.html

As the cataLogContributions does allow you to register the XSD and
include it in a plugin so that it corresponds to a specific namespace.
It's handy if you know the XSD isn't going to change all the time.

A sample definition is:

<extension
point="org.eclipse.wst.xml.core.catalogContributions">
<catalogContribution>
<uri
id="org.w3c.xinclude"
name="http://www.w3.org/2001/XInclude"
uri="xslt-schemas/xinclude.xsd">
</uri>
</catalogContribution>
</extension>

This includes the xinclude.xsd stored in the xslt-schemas directory of
the plugin. and it assigns it the Xinclude namespace.

Dave


JavaJ wrote:
> Hello,
>
> I have a problem in my RCP application where we use the webtools xml
> editor and validation. We are moving from DTD to XSD for xml
> validation. We use XStream to render out our java objects to xml and
> need a way to validate them using XSD. So...we now use JAXB to render
> out the class xsd files. So now i have the xml and the xsd. Next, I
> want to be able to click on an xml file in the rcp project navigator and
> click validate. Then I want the xml to be validated with a local xsd
> file. When i get the xml file to link to the xsd file, i get
> "cvc-elt.1: Cannot find the declaration of element". After doing some
> research, it looks like i need to enable namespace-aware(ness) and have
> no idea how to turn that on. This is long and confusing..i apologize
> for that, but if anyone could help me out, that would be great!
>
> Ideally I would like to use uri for a local namespace maybe using this
> extension: org.eclipse.wst.xml.core.catalogContributions but so far I
> haven't found much documentation on this. Does this allow my RCP app to
> register an XSD file to a local uri and then allow me to put that uri in
> my xml file? Clearly i need help.
>
> Thanks!
>
Re: XML Validation via local XSD file [message #220191 is a reply to message #220173] Thu, 04 September 2008 21:09 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Here is how i referenced the xsd file both ways:


<Application-array xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../conf/schemas/paf_apps.xsd ">

and

(this was trying to use xml catalog

<Application-array xmlns="http://www.<insert company here>.com/paf_apps"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.<insert company here>.com/paf_apps.xsd">

Again, i don't know which was is best but both give me the "cvc-elt.1:
Cannot find the declaration of element 'Application-array'." error.
Re: XML Validation via local XSD file [message #220199 is a reply to message #220182] Thu, 04 September 2008 21:22 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Thanks so much for the quick response...i have a couple more comments and
questions.

As for the JAXB thing, let me be a little more clear and maybe it will
make more sense. In our application, we use XStream to take a jave object
and put it to/from xml for simple serialization. It writes out both the
attributes and the data parts of the data. For example, if i had a Person
class defined as:

public class Person {

int age;
String name;

//etc
}

It would render:

<Person>
<age>28</age>
<name>Joe Smith</name>
</Person>

We don't use JAXB to create that class, i typically develop it by hand
then XStream will take care of rest to get to/from xml.

The problem I'm trying to solve, i might be way out in left field, is to
create an XSD document off of that Person class and then link the XSD into
the Person XML so we can validate using the RCP. Make sense?

So final XML would be:

<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../conf/schemas/person.xsd ">
<age>28</age>
<name>Joe Smith</name>
</Person>

I can get the extra xsd stuff in the xml when XStream is writing out the
XML, but i'm getting that "cvc-elt.1: Cannot find the declaration of
element" error. So are you saying a NamespacePrefixMapper will fix this
problem?

As for the xml catalog, can you give me an example of how to reference
that xsd in a xml file? Using your example, would it be referenced in my
rcp app like this?

<node xmlns="http://http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/XInclude/xinclude.xsd">

Thanks so much!
JavaJ


David Carver wrote:

> For JAXB you need to setup a NamespacePrefixMapper, so and set the
> appropriate namespaces, otherwise JAXB won't write out and XML with the
> appropriate namespaces. Also, be very careful with JAXB or any XML
> Databinding (except possibily EMF's XML schema support, it rocks!), as
> you can still write invalid XML even though it the classes were
> generated from the XSD. Also becareful that xsi:types aren't being
> included in your XML as it acts as substitution groups, and overrides
> definitions at that level.

>
http://fisheye5.cenqua.com/browse/~raw,r=1.16/jaxb-architect ure-document/www/doc/com/sun/xml/bind/marshaller/NamespacePr efixMapper.html

> As the cataLogContributions does allow you to register the XSD and
> include it in a plugin so that it corresponds to a specific namespace.
> It's handy if you know the XSD isn't going to change all the time.

> A sample definition is:

> <extension
> point="org.eclipse.wst.xml.core.catalogContributions">
> <catalogContribution>
> <uri
> id="org.w3c.xinclude"
> name="http://www.w3.org/2001/XInclude"
> uri="xslt-schemas/xinclude.xsd">
> </uri>
> </catalogContribution>
> </extension>

> This includes the xinclude.xsd stored in the xslt-schemas directory of
> the plugin. and it assigns it the Xinclude namespace.

> Dave


> JavaJ wrote:
>> Hello,
>>
>> I have a problem in my RCP application where we use the webtools xml
>> editor and validation. We are moving from DTD to XSD for xml
>> validation. We use XStream to render out our java objects to xml and
>> need a way to validate them using XSD. So...we now use JAXB to render
>> out the class xsd files. So now i have the xml and the xsd. Next, I
>> want to be able to click on an xml file in the rcp project navigator and
>> click validate. Then I want the xml to be validated with a local xsd
>> file. When i get the xml file to link to the xsd file, i get
>> "cvc-elt.1: Cannot find the declaration of element". After doing some
>> research, it looks like i need to enable namespace-aware(ness) and have
>> no idea how to turn that on. This is long and confusing..i apologize
>> for that, but if anyone could help me out, that would be great!
>>
>> Ideally I would like to use uri for a local namespace maybe using this
>> extension: org.eclipse.wst.xml.core.catalogContributions but so far I
>> haven't found much documentation on this. Does this allow my RCP app to
>> register an XSD file to a local uri and then allow me to put that uri in
>> my xml file? Clearly i need help.
>>
>> Thanks!
>>
Re: XML Validation via local XSD file [message #220205 is a reply to message #220199] Thu, 04 September 2008 21:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

In order to use the XML Catalog you will need to make your XML and XSD
use namespaces. The XML that you are outputing now doesn't include a
namespace, so the XML Catalog isn't going to help you out.
>
> It would render:
>
> <Person>
> <age>28</age>
> <name>Joe Smith</name>
> </Person>
>
> We don't use JAXB to create that class, i typically develop it by hand
> then XStream will take care of rest to get to/from xml.
>
> The problem I'm trying to solve, i might be way out in left field, is to
> create an XSD document off of that Person class and then link the XSD
> into the Person XML so we can validate using the RCP. Make sense?
>
> So final XML would be:
>
> <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="../../../conf/schemas/person.xsd ">
> <age>28</age>
> <name>Joe Smith</name>
> </Person>
>
> I can get the extra xsd stuff in the xml when XStream is writing out the
> XML, but i'm getting that "cvc-elt.1: Cannot find the declaration of
> element" error. So are you saying a NamespacePrefixMapper will fix this
> problem?

What does your XSD look like. When you click on that XSD, and select
Generate->XML

Does it generate an equivalent example XML as what you are generating.

In your XSD you will need to have a global element, called Person in
order for it to know how to validate it. The XSD is saying that you
don't have a Person element defined.




>
> As for the xml catalog, can you give me an example of how to reference
> that xsd in a xml file? Using your example, would it be referenced in
> my rcp app like this?
>

In your case, you would need the following:

<Person xmlns="http://www.person.com/person.xsd">

</Person>

And your catalog entry would be setup so that the namespace
http://www.person.com/person.xsd referenced your person.xsd file.

I'd check the generation of the xml from your XSD to make sure that it
is setup the way you think it is.

Dave
Re: XML Validation via local XSD file [message #220213 is a reply to message #220191] Thu, 04 September 2008 21:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Make sure your XSD has a global element defined for the root elements.

Dave

JavaJ wrote:
> Here is how i referenced the xsd file both ways:
>
>
> <Application-array xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="../../../conf/schemas/paf_apps.xsd ">
>
> and
>
> (this was trying to use xml catalog
>
> <Application-array xmlns="http://www.<insert company here>.com/paf_apps"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.<insert company here>.com/paf_apps.xsd">
> Again, i don't know which was is best but both give me the "cvc-elt.1:
> Cannot find the declaration of element 'Application-array'." error.
>
Re: XML Validation via local XSD file [message #220220 is a reply to message #220205] Thu, 04 September 2008 22:08 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Thanks for your help...I'll give it a whirl.
Re: XML Validation via local XSD file [message #221117 is a reply to message #220205] Tue, 09 September 2008 16:46 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Dave,

I'm getting closer. I was out for a couple of days so I just started
digging in this again. I can get my rcp app to use the xml catalog to
match my person.xml to my person.xsd as you said. It looks something like
this:

uri for xml catalog: http://www.person.com/person.xsd points to
schemas/person.xsd

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="person">
<xs:sequence>
<xs:element name="age" type="xs:int"/>
<xs:element name="name" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

xml is as such:

<person xmlns="http://www.person.com/person.xsd">
<name>jason</name>
<age>28</age>
</person>

but I'm still getting validation errors:

1. Referenced file contains errors (talking about my person.xsd file)
2. cvc-elt.1: Cannot find the declarion of element 'person'


Any ideas?

Thanks,
J

David Carver wrote:

> In order to use the XML Catalog you will need to make your XML and XSD
> use namespaces. The XML that you are outputing now doesn't include a
> namespace, so the XML Catalog isn't going to help you out.
>>
>> It would render:
>>
>> <Person>
>> <age>28</age>
>> <name>Joe Smith</name>
>> </Person>
>>
>> We don't use JAXB to create that class, i typically develop it by hand
>> then XStream will take care of rest to get to/from xml.
>>
>> The problem I'm trying to solve, i might be way out in left field, is to
>> create an XSD document off of that Person class and then link the XSD
>> into the Person XML so we can validate using the RCP. Make sense?
>>
>> So final XML would be:
>>
>> <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:noNamespaceSchemaLocation="../../../conf/schemas/person.xsd ">
>> <age>28</age>
>> <name>Joe Smith</name>
>> </Person>
>>
>> I can get the extra xsd stuff in the xml when XStream is writing out the
>> XML, but i'm getting that "cvc-elt.1: Cannot find the declaration of
>> element" error. So are you saying a NamespacePrefixMapper will fix this
>> problem?

> What does your XSD look like. When you click on that XSD, and select
> Generate->XML

> Does it generate an equivalent example XML as what you are generating.

> In your XSD you will need to have a global element, called Person in
> order for it to know how to validate it. The XSD is saying that you
> don't have a Person element defined.




>>
>> As for the xml catalog, can you give me an example of how to reference
>> that xsd in a xml file? Using your example, would it be referenced in
>> my rcp app like this?
>>

> In your case, you would need the following:

> <Person xmlns="http://www.person.com/person.xsd">

> </Person>

> And your catalog entry would be setup so that the namespace
> http://www.person.com/person.xsd referenced your person.xsd file.

> I'd check the generation of the xml from your XSD to make sure that it
> is setup the way you think it is.

> Dave
Re: XML Validation via local XSD file [message #221145 is a reply to message #221117] Tue, 09 September 2008 20:01 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Anyone?


JavaJ wrote:

> Dave,

> I'm getting closer. I was out for a couple of days so I just started
> digging in this again. I can get my rcp app to use the xml catalog to
> match my person.xml to my person.xsd as you said. It looks something like
> this:

> uri for xml catalog: http://www.person.com/person.xsd points to
> schemas/person.xsd

> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

> <xs:complexType name="person">
> <xs:sequence>
> <xs:element name="age" type="xs:int"/>
> <xs:element name="name" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>

> xml is as such:

> <person xmlns="http://www.person.com/person.xsd">
> <name>jason</name>
> <age>28</age>
> </person>

> but I'm still getting validation errors:

> 1. Referenced file contains errors (talking about my person.xsd file)
> 2. cvc-elt.1: Cannot find the declarion of element 'person'


> Any ideas?

> Thanks,
> J

> David Carver wrote:

>> In order to use the XML Catalog you will need to make your XML and XSD
>> use namespaces. The XML that you are outputing now doesn't include a
>> namespace, so the XML Catalog isn't going to help you out.
>>>
>>> It would render:
>>>
>>> <Person>
>>> <age>28</age>
>>> <name>Joe Smith</name>
>>> </Person>
>>>
>>> We don't use JAXB to create that class, i typically develop it by hand
>>> then XStream will take care of rest to get to/from xml.
>>>
>>> The problem I'm trying to solve, i might be way out in left field, is to
>>> create an XSD document off of that Person class and then link the XSD
>>> into the Person XML so we can validate using the RCP. Make sense?
>>>
>>> So final XML would be:
>>>
>>> <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:noNamespaceSchemaLocation="../../../conf/schemas/person.xsd ">
>>> <age>28</age>
>>> <name>Joe Smith</name>
>>> </Person>
>>>
>>> I can get the extra xsd stuff in the xml when XStream is writing out the
>>> XML, but i'm getting that "cvc-elt.1: Cannot find the declaration of
>>> element" error. So are you saying a NamespacePrefixMapper will fix this
>>> problem?

>> What does your XSD look like. When you click on that XSD, and select
>> Generate->XML

>> Does it generate an equivalent example XML as what you are generating.

>> In your XSD you will need to have a global element, called Person in
>> order for it to know how to validate it. The XSD is saying that you
>> don't have a Person element defined.




>>>
>>> As for the xml catalog, can you give me an example of how to reference
>>> that xsd in a xml file? Using your example, would it be referenced in
>>> my rcp app like this?
>>>

>> In your case, you would need the following:

>> <Person xmlns="http://www.person.com/person.xsd">

>> </Person>

>> And your catalog entry would be setup so that the namespace
>> http://www.person.com/person.xsd referenced your person.xsd file.

>> I'd check the generation of the xml from your XSD to make sure that it
>> is setup the way you think it is.

>> Dave
Re: XML Validation via local XSD file [message #221169 is a reply to message #221117] Wed, 10 September 2008 00:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

JavaJ wrote:
> Dave,
>
> I'm getting closer. I was out for a couple of days so I just started
> digging in this again. I can get my rcp app to use the xml catalog to
> match my person.xml to my person.xsd as you said. It looks something
> like this:
>
> uri for xml catalog: http://www.person.com/person.xsd points to
> schemas/person.xsd
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> <xs:complexType name="person">
> <xs:sequence>
> <xs:element name="age" type="xs:int"/>
> <xs:element name="name" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>

You need to specify a targetNamespace like

<xs:schema version="1.0: targetNamespace="http://www.person.com/person"
elementFormDefault="qualified">

That will set the schema up for the namespace, and make the elements
have to be in that namespace if they are defined int he schema.

Dave
Re: XML Validation via local XSD file [message #221198 is a reply to message #221169] Wed, 10 September 2008 14:12 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
Dave,

I really appreciate you helping me out. Well..I'm one step closer now.

With this xsd...

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://www.person.com/person"
elementFormDefault="qualified">

<xs:complexType name="person">
<xs:sequence>
<xs:element name="age" type="xs:int"/>
<xs:element name="name" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

...my person xml won't validate with the "Referenced file contains errors"
referring to my xsd file.

With this xsd (kept the xmlns + target namespace)...

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.person.com/person"
elementFormDefault="qualified">

<xs:complexType name="person">
<xs:sequence>
<xs:element name="age" type="xs:int"/>
<xs:element name="name" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

...i get the "cvc-elt.1: Cannot find the declaration of element 'person'".

Any idea why? When i try to generate the xml from the xsd as you
suggested before I get error "No root elements exists since the schema
provider has no global elements."

Here is xml again:

<?xml version="1.0" encoding="UTF-8"?>
<person xmlns="http://www.person.com/person" >
<name>jason</name>
<age>28</age>
</person>


Thanks,
Jason

David Carver wrote:

> JavaJ wrote:
>> Dave,
>>
>> I'm getting closer. I was out for a couple of days so I just started
>> digging in this again. I can get my rcp app to use the xml catalog to
>> match my person.xml to my person.xsd as you said. It looks something
>> like this:
>>
>> uri for xml catalog: http://www.person.com/person.xsd points to
>> schemas/person.xsd
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>
>> <xs:complexType name="person">
>> <xs:sequence>
>> <xs:element name="age" type="xs:int"/>
>> <xs:element name="name" type="xs:string" minOccurs="0"/>
>> </xs:sequence>
>> </xs:complexType>
>> </xs:schema>
>>

> You need to specify a targetNamespace like

> <xs:schema version="1.0: targetNamespace="http://www.person.com/person"
> elementFormDefault="qualified">

> That will set the schema up for the namespace, and make the elements
> have to be in that namespace if they are defined int he schema.

> Dave
Re: XML Validation via local XSD file [message #221206 is a reply to message #221198] Wed, 10 September 2008 14:36 Go to previous messageGo to next message
JavaJ Missing name is currently offline JavaJ Missing nameFriend
Messages: 45
Registered: July 2009
Member
I got it working. Thanks Dave for all your help!!! Here's what my final
xsd looked like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.person.com/person"
xmlns="http://www.person.com/person" elementFormDefault="qualified">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0"/>
<xs:element name="age" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Re: XML Validation via local XSD file [message #221224 is a reply to message #221198] Thu, 11 September 2008 00:19 Go to previous message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Add the following to your schema:

<xs:element name="person" type="person"/>

That should get you going.


JavaJ wrote:

> With this xsd (kept the xmlns + target namespace)...
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.person.com/person"
> elementFormDefault="qualified">
>
> <xs:complexType name="person">
> <xs:sequence>
> <xs:element name="age" type="xs:int"/>
> <xs:element name="name" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
> ..i get the "cvc-elt.1: Cannot find the declaration of element 'person'".
>
> Any idea why? When i try to generate the xml from the xsd as you
> suggested before I get error "No root elements exists since the schema
> provider has no global elements."
>
> Here is xml again:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <person xmlns="http://www.person.com/person" > <name>jason</name>
> <age>28</age>
> </person>
>
>
> Thanks,
> Jason
>
> David Carver wrote:
>
>> JavaJ wrote:
>>> Dave,
>>>
>>> I'm getting closer. I was out for a couple of days so I just
>>> started digging in this again. I can get my rcp app to use the xml
>>> catalog to match my person.xml to my person.xsd as you said. It
>>> looks something like this:
>>>
>>> uri for xml catalog: http://www.person.com/person.xsd points to
>>> schemas/person.xsd
>>>
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>>
>>> <xs:complexType name="person">
>>> <xs:sequence>
>>> <xs:element name="age" type="xs:int"/>
>>> <xs:element name="name" type="xs:string" minOccurs="0"/>
>>> </xs:sequence>
>>> </xs:complexType>
>>> </xs:schema>
>>>
>
>> You need to specify a targetNamespace like
>
>> <xs:schema version="1.0:
>> targetNamespace="http://www.person.com/person"
>> elementFormDefault="qualified">
>
>> That will set the schema up for the namespace, and make the elements
>> have to be in that namespace if they are defined int he schema.
>
>> Dave
>
>
Previous Topic:Problem running application under Tomcat in Eclipse
Next Topic:JSDT element v node?
Goto Forum:
  


Current Time: Thu Mar 28 12:09:09 GMT 2024

Powered by FUDForum. Page generated in 0.03183 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top