softechnics
asked on
XML Schema Instance Namespace Dropping
Having an issue here and think it’s something I'm missing with XSD, probably a misunderstanding of XML Schema on my part. Attached is an example Person.xsd and Auto.xsd. Can anyone tell me why when I generate an instance of Person.xsd using a tool like StylusStudio I get a Person xml with an Auto xml using the same namespace as Person (Person.xml)? I was expecting to get an xml instance as such (notice the p2 namespace provided for auto and different than p1:
<?xml version="1.0"?>
<p1:Person xmlns:p1=http://www.company.com/person xmlns:p2="http://www.company.com/auto" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.company.com/person file:///c:/Documents%20and %20Setting s/btaylor/ Desktop/Pe rson.xsd">
<p2:Auto make="string">
<!--Attribute make is optional-->
</p2:Auto>
</p1:Person>
Respectfully,
Brian
Auto.xsd
Person.xsd
Person.xml
<?xml version="1.0"?>
<p1:Person xmlns:p1=http://www.company.com/person xmlns:p2="http://www.company.com/auto" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.company.com/person file:///c:/Documents%20and
<p2:Auto make="string">
<!--Attribute make is optional-->
</p2:Auto>
</p1:Person>
Respectfully,
Brian
Auto.xsd
Person.xsd
Person.xml
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent response and thank you much Gertone!
welcome
ASKER
<?xml version="1.0"?>
<p1:Person xmlns:p1=http://www.company.com/person>
<p1:Auto make="string"/>
</p1:Person>
Not:
<?xml version="1.0"?>
<p1:Person xmlns:p1=http://www.company.com/person xmlns:p2="http://www.company.com/auto">
<p2:Auto make="string"/>
</p1:Person>