xml - Calling element from imported XSD -


my first xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"     targetnamespace="my.com/v1.0.xsd"     xmlns:abc="my.com/v1.0.xsd"     elementformdefault="qualified"> 

my new xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"            targetnamespace="my.com/v2.0.xsd"            xmlns:abc="my.com/v2.0.xsd"            elementformdefault="qualified">     <xs:import  namespace="my.com/v1.0.xsd" schemalocation="v1.0.xsd"/> 

i'm new xsd question may sound silly, great if can me.

now in v2.0.xsd, want call elements, complextypes in v1.0.xsd, how can likes ? though elements in gathered under abc namespace, unfortunately, things didn't work hope.

thank you.

to import v1 elements in v2 schema have qualify reference v1 element or complextype in v2 schema.

e.g.: given v1 schema that:

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="my.com/v1.0.xsd" xmlns:v1="my.com/v1.0.xsd" elementformdefault="qualified">   <xs:complextype name="typev1">     <xs:sequence>         <xs:element name="fromv1"/>     </xs:sequence>   </xs:complextype> </xs:schema> 

the v2 schema call complex type that:

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"   targetnamespace="my.com/v2.0.xsd"   xmlns:v2="my.com/v2.0.xsd"   xmlns:v1="my.com/v1.0.xsd"   elementformdefault="qualified">   <xs:import namespace="my.com/v1.0.xsd" schemalocation="v1.xsd"/>   <xs:element name="fromv2" type="v1:typev1"/> </xs:schema> 

in resulting xml, both namespaces have declared, e.g. that:

<?xml version="1.0" encoding="utf-8"?> <v2:fromv2 xmlns:v2='my.com/v2.0.xsd'>   <v1:fromv1 xmlns:v1='my.com/v1.0.xsd'/> </v2:fromv2> 

if want 1 namespace, have put same uri in both schemas targetnamespace , use include instead of import.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -