Unqualified elment - but still have prefix at the root

View: New views
15 Messages — Rating Filter:   Alert me  

Unqualified elment - but still have prefix at the root

by Avihaimar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

i have two schemas A,B.
B import A.
Both of them defined as unqualified element, but the xml that generated from B has n1: as a prefix for the root elements.
Is there a way to have no prefix at all?

Thank you

RE: Unqualified elment - but still have prefix at the root

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> i have two schemas A,B.
> B import A.

Actually, you have one schema made up from two schema documents.

> Both of them defined as unqualified element, but the xml that
> generated from B has n1: as a prefix for the root elements.
> Is there a way to have no prefix at all?
>

Are you saying (a) you don't want the elements to be in a namespace, or are
you saying (b) you want them to be in a namespace, but you want that to be
the default namespace (so it needs no prefix)?

If you want (a) then you'll have to change your schema. Without seeing the
schema, it's hard to say how.

If you want (b), then this depends on the tool that you are using to
generate instances from your schema. You haven't told us what tool you are
using.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 




Re: Unqualified elment - but still have prefix at the root

by Avihaimar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Exampel :  lib.xsd import book.xsd (both with unqualified)

------   LIB -------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.library.org" xmlns:b="http://www.book.org" targetNamespace="http://www.library.org" elementFormDefault="unqualified" attributeFormDefault="unqualified">
        <xs:import namespace="http://www.book.org" schemaLocation="Book.xsd"/>
        <xs:element name="Library" type="Library"/>
        <xs:complexType name="Library">
                <xs:sequence>
                        <xs:element name="BookCatalogue">
                                <xs:complexType>
                                        <xs:sequence>
                                                <xs:element name="test" type="b:BookType" maxOccurs="unbounded"/>
                                        </xs:sequence>
                                </xs:complexType>
                        </xs:element>
                </xs:sequence>
        </xs:complexType>
</xs:schema>



---------------------   Book  --------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.book.org" targetNamespace="http://www.book.org" elementFormDefault="unqualified" attributeFormDefault="unqualified">
        <xs:complexType name="BookType">
                <xs:sequence>
                        <xs:element name="Title" type="xs:string"/>
                </xs:sequence>
        </xs:complexType>
</xs:schema>



When i generate xml in xmlspy i get the following xml (with n1 prefix , but i dont want prefix!!!!)

------------------------ XML -------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 sp1 (http://www.altova.com)-->
<n1:Library xsi:schemaLocation="http://www.library.org lib.xsd" xmlns:n1="http://www.library.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <BookCatalogue>
                <test>
                        <Title>String</Title>
                </test>
        </BookCatalogue>
</n1:Library>




Thank you!!!!!!

Re: Unqualified elment - but still have prefix at the root

by Avihaimar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Attached files as ZIP


Avihaimar wrote:
Exampel :  lib.xsd import book.xsd (both with unqualified)

------   LIB -------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.library.org" xmlns:b="http://www.book.org" targetNamespace="http://www.library.org" elementFormDefault="unqualified" attributeFormDefault="unqualified">
        <xs:import namespace="http://www.book.org" schemaLocation="Book.xsd"/>
        <xs:element name="Library" type="Library"/>
        <xs:complexType name="Library">
                <xs:sequence>
                        <xs:element name="BookCatalogue">
                                <xs:complexType>
                                        <xs:sequence>
                                                <xs:element name="test" type="b:BookType" maxOccurs="unbounded"/>
                                        </xs:sequence>
                                </xs:complexType>
                        </xs:element>
                </xs:sequence>
        </xs:complexType>
</xs:schema>



---------------------   Book  --------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.book.org" targetNamespace="http://www.book.org" elementFormDefault="unqualified" attributeFormDefault="unqualified">
        <xs:complexType name="BookType">
                <xs:sequence>
                        <xs:element name="Title" type="xs:string"/>
                </xs:sequence>
        </xs:complexType>
</xs:schema>



When i generate xml in xmlspy i get the following xml (with n1 prefix , but i dont want prefix!!!!)

------------------------ XML -------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 sp1 (http://www.altova.com)-->
<n1:Library xsi:schemaLocation="http://www.library.org lib.xsd" xmlns:n1="http://www.library.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <BookCatalogue>
                <test>
                        <Title>String</Title>
                </test>
        </BookCatalogue>
</n1:Library>




Thank you!!!!!!
xsd.zip

RE: Unqualified elment - but still have prefix at the root

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The instance document is valid against your schema. I don't know whether the
Altova tool gives you any choice over the use of namespace prefixes, you
will have to consult the Altova documentation or support. But any user of
this XML document shouldn't care about the allocation of prefixes - it's
only the namespaces that are significant. So the question is: why does it
matter? Because if it does matter, then there is something wrong with your
application requirement.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



> -----Original Message-----
> From: xmlschema-dev-request@...
> [mailto:xmlschema-dev-request@...] On Behalf Of Avihaimar
> Sent: 25 August 2009 11:54
> To: xmlschema-dev@...
> Subject: Re: Unqualified elment - but still have prefix at the root
>
>
> Exampel :  lib.xsd import book.xsd (both with unqualified)
>
> ------   LIB -------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.library.org" xmlns:b="http://www.book.org"
> targetNamespace="http://www.library.org"
> elementFormDefault="unqualified"
> attributeFormDefault="unqualified">
> <xs:import namespace="http://www.book.org"
> schemaLocation="Book.xsd"/>
> <xs:element name="Library" type="Library"/>
> <xs:complexType name="Library">
> <xs:sequence>
> <xs:element name="BookCatalogue">
> <xs:complexType>
> <xs:sequence>
> <xs:element
> name="test" type="b:BookType" maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
>
>
> ---------------------   Book  --------------
> <?xml version="1.0"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.book.org" targetNamespace="http://www.book.org"
> elementFormDefault="unqualified" attributeFormDefault="unqualified">
> <xs:complexType name="BookType">
> <xs:sequence>
> <xs:element name="Title" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
>
>
> When i generate xml in xmlspy i get the following xml (with
> n1 prefix , but i dont want prefix!!!!)
>
> ------------------------ XML ------------------- <?xml
> version="1.0" encoding="UTF-8"?> <!--Sample XML file
> generated by XMLSpy v2008 sp1 (http://www.altova.com)-->
> <n1:Library xsi:schemaLocation="http://www.library.org lib.xsd"
> xmlns:n1="http://www.library.org"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <BookCatalogue>
> <test>
> <Title>String</Title>
> </test>
> </BookCatalogue>
> </n1:Library>
>
>
>
>
> Thank you!!!!!!
> --
> View this message in context:
> http://www.nabble.com/Unqualified-elment---but-still-have-pref
> ix-at-the-root-tp25123070p25132221.html
> Sent from the w3.org - xmlschema-dev mailing list archive at
> Nabble.com.
>
>



Re: Unqualified elment - but still have prefix at the root

by Avihaimar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The instance is valid , but the instance is create with prefix "n1", but i dont want prefix!!!!

remove the prefix 'n1' from the instance and change 'xmlns:n1="http://www.library.org"  to '''xmlns="http://www.library.org" will cause to invalid instance.

I dont want any prefix. and i dont know how to get rid the n1 prefix.


Thank you



Avihaimar wrote:
Hey,

i have two schemas A,B.
B import A.
Both of them defined as unqualified element, but the xml that generated from B has n1: as a prefix for the root elements.
Is there a way to have no prefix at all?

Thank you

RE: Unqualified elment - but still have prefix at the root

by Simon Cox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The Libray and Book elements are declared in different namespaces.
The instance document has to distinguish between the namespaces in use
somehow.
So one of them must have a prefix to achieve this.  


--------------------------------------------------------
Simon Cox

European Commission, Joint Research Centre,
Institute for Environment and Sustainability,
Spatial Data Infrastructures Unit, TP 262
Via E. Fermi, 2749, I-21027 Ispra (VA), Italy
Tel: +39 0332 78 3652
Fax: +39 0332 78 6325
mailto:simon.cox@...
http://ies.jrc.ec.europa.eu/simon-cox 

SDI Unit: http://sdi.jrc.ec.europa.eu/ 
IES Institute: http://ies.jrc.ec.europa.eu/
JRC: http://www.jrc.ec.europa.eu/
--------------------------------------------------------

-----Original Message-----
From: xmlschema-dev-request@... [mailto:xmlschema-dev-request@...] On
Behalf Of Michael Kay
Sent: Tuesday, 25 August 2009 13:32
To: 'Avihaimar'; xmlschema-dev@...
Subject: RE: Unqualified elment - but still have prefix at the root

The instance document is valid against your schema. I don't know whether the
Altova tool gives you any choice over the use of namespace prefixes, you
will have to consult the Altova documentation or support. But any user of
this XML document shouldn't care about the allocation of prefixes - it's
only the namespaces that are significant. So the question is: why does it
matter? Because if it does matter, then there is something wrong with your
application requirement.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



> -----Original Message-----
> From: xmlschema-dev-request@...
> [mailto:xmlschema-dev-request@...] On Behalf Of Avihaimar
> Sent: 25 August 2009 11:54
> To: xmlschema-dev@...
> Subject: Re: Unqualified elment - but still have prefix at the root
>
>
> Exampel :  lib.xsd import book.xsd (both with unqualified)
>
> ------   LIB -------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.library.org" xmlns:b="http://www.book.org"
> targetNamespace="http://www.library.org"
> elementFormDefault="unqualified"
> attributeFormDefault="unqualified">
> <xs:import namespace="http://www.book.org"
> schemaLocation="Book.xsd"/>
> <xs:element name="Library" type="Library"/>
> <xs:complexType name="Library">
> <xs:sequence>
> <xs:element name="BookCatalogue">
> <xs:complexType>
> <xs:sequence>
> <xs:element
> name="test" type="b:BookType" maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
>
>
> ---------------------   Book  --------------
> <?xml version="1.0"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.book.org" targetNamespace="http://www.book.org"
> elementFormDefault="unqualified" attributeFormDefault="unqualified">
> <xs:complexType name="BookType">
> <xs:sequence>
> <xs:element name="Title" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
>
>
> When i generate xml in xmlspy i get the following xml (with
> n1 prefix , but i dont want prefix!!!!)
>
> ------------------------ XML ------------------- <?xml version="1.0"
> encoding="UTF-8"?> <!--Sample XML file generated by XMLSpy v2008 sp1
> (http://www.altova.com)--> <n1:Library
> xsi:schemaLocation="http://www.library.org lib.xsd"
> xmlns:n1="http://www.library.org"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <BookCatalogue>
> <test>
> <Title>String</Title>
> </test>
> </BookCatalogue>
> </n1:Library>
>
>
>
>
> Thank you!!!!!!
> --
> View this message in context:
> http://www.nabble.com/Unqualified-elment---but-still-have-pref
> ix-at-the-root-tp25123070p25132221.html
> Sent from the w3.org - xmlschema-dev mailing list archive at
> Nabble.com.
>
>




RE: Unqualified elment - but still have prefix at the root

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
>
> I dont want any prefix. and i dont know how to get rid the n1 prefix.
>

As I said before (I can only repeat myself)

(a) you should be able to handle the document whatever prefixes it uses - if
not, there is something wrong with your application

(b) to find out whether you can generate the instance document a different
way, consult the Altova documentation. Or try a different tool.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



Re: Unqualified elment - but still have prefix at the root

by Avihaimar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Last one - (Thank you!!!!!)


I know - i can handle this XML with any prefix. Its depend on the declaration in the header (xlmns).

But,

XML without any prefix will failed in validation . I want to have the option to not have prefix at all and i dont know how can i do this either by chanigng the xsd or the instance.

When i send example of XML to the cutomers i want to send them XML with no prefix and i didnt success to have one by chanigng the xsd or the instance.


Avihaimar wrote:
Hey,

i have two schemas A,B.
B import A.
Both of them defined as unqualified element, but the xml that generated from B has n1: as a prefix for the root elements.
Is there a way to have no prefix at all?

Thank you

Re: Unqualified elment - but still have prefix at the root

by Kevin Braun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think what you may be trying to say is that despite the fact that you
are using elemFormDefault="unqualified", your elements are qualified.  
Global elements belong to the target namespace; the elemFormDefault only
applies to local elements (ie, within a complex type).  If you don't
want any of your elements to be in a namespace, you will have to get rid
of the targetNamespace.

Kevin

On 8/25/2009 8:49 AM, Avihaimar wrote:

> Last one - (Thank you!!!!!)
>
>
> I know - i can handle this XML with any prefix. Its depend on the
> declaration in the header (xlmns).
>
> But,
>
> XML without any prefix will failed in validation . I want to have the option
> to not have prefix at all and i dont know how can i do this either by
> chanigng the xsd or the instance.
>
> When i send example of XML to the cutomers i want to send them XML with no
> prefix and i didnt success to have one by chanigng the xsd or the instance.
>
>
>
> Avihaimar wrote:
>  
>> Hey,
>>
>> i have two schemas A,B.
>> B import A.
>> Both of them defined as unqualified element, but the xml that generated
>> from B has n1: as a prefix for the root elements.
>> Is there a way to have no prefix at all?
>>
>> Thank you
>>
>>    
>
>  


RE: Unqualified elment - but still have prefix at the root

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
>
> I know - i can handle this XML with any prefix. Its depend on
> the declaration in the header (xlmns).
>
> But,
>
> XML without any prefix will failed in validation . I want to
> have the option to not have prefix at all and i dont know how
> can i do this either by chanigng the xsd or the instance.
>
> When i send example of XML to the cutomers i want to send
> them XML with no prefix and i didnt success to have one by
> chanigng the xsd or the instance.
>

Your current instance document is valid against your schema.

Perhaps you can show us what you want the instance document to look like.

You don't seem to have grasped the essential point that the namespace is
significant, the prefix isn't.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



RE: Unqualified elment - but still have prefix at the root

by Simon Cox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The key point is that because your document uses elements from two
namespaces, an instance document with no namespace prefixes at all is
invalid. The 'no prefix' can only be used by one namespace, not both.


--------------------------------------------------------
Simon Cox

European Commission, Joint Research Centre,
Institute for Environment and Sustainability,
Spatial Data Infrastructures Unit, TP 262
Via E. Fermi, 2749, I-21027 Ispra (VA), Italy
Tel: +39 0332 78 3652
Fax: +39 0332 78 6325
mailto:simon.cox@...
http://ies.jrc.ec.europa.eu/simon-cox 

SDI Unit: http://sdi.jrc.ec.europa.eu/ 
IES Institute: http://ies.jrc.ec.europa.eu/
JRC: http://www.jrc.ec.europa.eu/
--------------------------------------------------------

-----Original Message-----
From: xmlschema-dev-request@... [mailto:xmlschema-dev-request@...] On
Behalf Of Avihaimar
Sent: Tuesday, 25 August 2009 14:49
To: xmlschema-dev@...
Subject: Re: Unqualified elment - but still have prefix at the root


Last one - (Thank you!!!!!)


I know - i can handle this XML with any prefix. Its depend on the
declaration in the header (xlmns).

But,

XML without any prefix will failed in validation . I want to have the option
to not have prefix at all and i dont know how can i do this either by
chanigng the xsd or the instance.

When i send example of XML to the cutomers i want to send them XML with no
prefix and i didnt success to have one by chanigng the xsd or the instance.



Avihaimar wrote:

>
> Hey,
>
> i have two schemas A,B.
> B import A.
> Both of them defined as unqualified element, but the xml that
> generated from B has n1: as a prefix for the root elements.
> Is there a way to have no prefix at all?
>
> Thank you
>

--
View this message in context:
http://www.nabble.com/Unqualified-elment---but-still-have-prefix-at-the-root
-tp25123070p25133549.html
Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.




Re: Unqualified elment - but still have prefix at the root

by David Maze :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It sounds like you're looking for an instance more like:

<Library xmlns="http://www.library.org">
  <test xmlns="">
    <Title>XSLT 2.0 Programmer's Reference</Title>
  </test>
</Library>

That doesn't use any namespace prefixes, but puts the {http://www.library.org}Library, {}test and {}Title elements in the correct namespaces.

xs:schema/@elementFormDefault and xs:element/@form affect whether an element is in the xs:schema/@targetNamespace or in the null namespace; there is no particular requirement for a "qualified" element to have a namespace prefix or not.  (Which is to say, I kind of suspect you might actually want elementFormDefault="qualified", so that everything is in the same namespace.)

David Maze
Senior Software Engineer, IBM WebSphere DataPower SOA Appliances
One Rogers Street, Cambridge, MA 02142
Phone: 617-693-1306  Fax: 617-693-5541




From:        Avihaimar <avihaimar@...>
To:        xmlschema-dev@...
Date:        08/25/2009 06:58 AM
Subject:        Re: Unqualified elment - but still have prefix at the root
Sent by:        xmlschema-dev-request@...





Exampel :  lib.xsd import book.xsd (both with unqualified)

------   LIB -------
<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns="
http://www.library.org" xmlns:b="http://www.book.org"
targetNamespace="
http://www.library.org" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
                <xs:import namespace="
http://www.book.org" schemaLocation="Book.xsd"/>
                <xs:element name="Library" type="Library"/>
                <xs:complexType name="Library">
                                 <xs:sequence>
                                                  <xs:element name="BookCatalogue">
                                                                   <xs:complexType>
                                                                                    <xs:sequence>
                                                                                                     <xs:element name="test" type="b:BookType" maxOccurs="unbounded"/>
                                                                                    </xs:sequence>
                                                                   </xs:complexType>
                                                  </xs:element>
                                 </xs:sequence>
                </xs:complexType>
</xs:schema>



---------------------   Book  --------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns="
http://www.book.org" targetNamespace="http://www.book.org"
elementFormDefault="unqualified" attributeFormDefault="unqualified">
                <xs:complexType name="BookType">
                                 <xs:sequence>
                                                  <xs:element name="Title" type="xs:string"/>
                                 </xs:sequence>
                </xs:complexType>
</xs:schema>



When i generate xml in xmlspy i get the following xml (with n1 prefix , but
i dont want prefix!!!!)

------------------------ XML -------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 sp1 (
http://www.altova.com)-->
<n1:Library xsi:schemaLocation="
http://www.library.org lib.xsd"
xmlns:n1="
http://www.library.org"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
                <BookCatalogue>
                                 <test>
                                                  <Title>String</Title>
                                 </test>
                </BookCatalogue>
</n1:Library>




Thank you!!!!!!
--
View this message in context:
http://www.nabble.com/Unqualified-elment---but-still-have-prefix-at-the-root-tp25123070p25132221.html
Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.




Re: Unqualified elment - but still have prefix at the root

by Avihaimar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Almost.

I want instance like you attach,but in your instance you have xmlns in the test element.
Remove it and your instance is not valid.

And i dont want prefix at all. clean xml.


David Maze wrote:
It sounds like you're looking for an instance more like:

<Library xmlns="http://www.library.org">
  <test xmlns="">
    <Title>XSLT 2.0 Programmer's Reference</Title>
  </test>
</Library>

That doesn't use any namespace prefixes, but puts the {
http://www.library.org}Library, {}test and {}Title elements in the correct
namespaces.

xs:schema/@elementFormDefault and xs:element/@form affect whether an
element is in the xs:schema/@targetNamespace or in the null namespace;
there is no particular requirement for a "qualified" element to have a
namespace prefix or not.  (Which is to say, I kind of suspect you might
actually want elementFormDefault="qualified", so that everything is in the
same namespace.)

David Maze
Senior Software Engineer, IBM WebSphere DataPower SOA Appliances
One Rogers Street, Cambridge, MA 02142
Phone: 617-693-1306  Fax: 617-693-5541



From:   Avihaimar <avihaimar@yahoo.com>
To:     xmlschema-dev@w3.org
Date:   08/25/2009 06:58 AM
Subject:        Re: Unqualified elment - but still have prefix at the root
Sent by:        xmlschema-dev-request@w3.org




Exampel :  lib.xsd import book.xsd (both with unqualified)

------   LIB -------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.library.org" xmlns:b="http://www.book.org"
targetNamespace="http://www.library.org" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
                 <xs:import namespace="http://www.book.org"
schemaLocation="Book.xsd"/>
                 <xs:element name="Library" type="Library"/>
                 <xs:complexType name="Library">
                                 <xs:sequence>
                                                 <xs:element
name="BookCatalogue">
 <xs:complexType>
  <xs:sequence>
                 <xs:element name="test" type="b:BookType"
maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>
                                                 </xs:element>
                                 </xs:sequence>
                 </xs:complexType>
</xs:schema>



---------------------   Book  --------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.book.org" targetNamespace="http://www.book.org"
elementFormDefault="unqualified" attributeFormDefault="unqualified">
                 <xs:complexType name="BookType">
                                 <xs:sequence>
                                                 <xs:element name="Title"
type="xs:string"/>
                                 </xs:sequence>
                 </xs:complexType>
</xs:schema>



When i generate xml in xmlspy i get the following xml (with n1 prefix ,
but
i dont want prefix!!!!)

------------------------ XML -------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 sp1 (http://www.altova.com
)-->
<n1:Library xsi:schemaLocation="http://www.library.org lib.xsd"
xmlns:n1="http://www.library.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                 <BookCatalogue>
                                 <test>
                                                 <Title>String</Title>
                                 </test>
                 </BookCatalogue>
</n1:Library>




Thank you!!!!!!
--
View this message in context:
http://www.nabble.com/Unqualified-elment---but-still-have-prefix-at-the-root-tp25123070p25132221.html

Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.



Parent Message unknown Re: Unqualified elment - but still have prefix at the root

by Kevin Braun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you omit the target namespace, you are giving up using namespaces,
which are used to help avoid naming conflicts.

These resources might help you:
http://www.w3.org/TR/xmlschema-0/#NS
http://www.amazon.com/gp/product/0130655678

Kevin
(I earlier CC'd xmlschema-dev-request instead of xmlschema-dev by accident)

On 8/25/2009 9:41 AM, avihai marchiano wrote:

> WOW!!!!!!!!
>
> It work!!!!
>
> So, what am i missing if omit the target namespace?
> By the way i also need to do additonal change and add prefix to the default xlmns
>
>
>
> ----- Original Message ----
> From: Kevin Braun <kbraun@...>
> To: Avihaimar <avihaimar@...>
> Cc: xmlschema-dev@...
> Sent: Tuesday, August 25, 2009 4:13:17 PM
> Subject: Re: Unqualified elment - but still have prefix at the root
>
> I think what you may be trying to say is that despite the fact that you are using elemFormDefault="unqualified", your elements are qualified.  Global elements belong to the target namespace; the elemFormDefault only applies to local elements (ie, within a complex type).  If you don't want any of your elements to be in a namespace, you will have to get rid of the targetNamespace.
>
> Kevin
>
> On 8/25/2009 8:49 AM, Avihaimar wrote:
>  
>> Last one - (Thank you!!!!!)
>>
>>
>> I know - i can handle this XML with any prefix. Its depend on the
>> declaration in the header (xlmns).
>>
>> But,
>>
>> XML without any prefix will failed in validation . I want to have the option
>> to not have prefix at all and i dont know how can i do this either by
>> chanigng the xsd or the instance.
>>
>> When i send example of XML to the cutomers i want to send them XML with no
>> prefix and i didnt success to have one by chanigng the xsd or the instance.
>>
>>
>>
>> Avihaimar wrote:
>>  
>>    
>>> Hey,
>>> i have two schemas A,B. B import A. Both of them defined as unqualified element, but the xml that generated
>>> from B has n1: as a prefix for the root elements. Is there a way to have no prefix at all?
>>> Thank you
>>>
>>>    
>>>      
>>  
>>    
>
>
>      
>
>