Professional Documents
Culture Documents
Share
Report Abuse
Page 1 of 3
Next Blog
Create Blog
Sign In
ojitha kumanayaka
I HAVE SPECIALIZED IN JAVA TECHNOLOGY. MY MAIN RESEARCH AREA IS DESCRIPTION LOGIC(DL) AND DL BASED SEMANTIC WEB.
HOWEVER, SOFTWARE DEVELOPMENT PROCESSES SUCH AS XP, RUP AND AGILE ARE OTHER INTERESTED AREAS. MY FAVORITE
TECHNOLOGIES ARE JAVA/J2EE, WEB SERVICES, WEB FRAMEWORKS (STRUTS), SPRING, HIBERNATE, AND ADOBE TECHNOLOGIES
(ACTIONSCRIPT 3, FLEX, SMARTFORMS, LIVECYCLE DESIGNER ES, BLAZEDS). I WOULD LIKE TO SHARE MORE THAN THAT WITH YOU.
201
Map data 2012 T
total
pageviews
As shown in the above figure, I need Address to be replaced by AUAddress or USAddress in the instance xml
file. All the Address, USAddress and AUAddress are complex types in the XML schema. These types are
defined in the address.xsd file as shown in the following code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
?
<?xmlversion="1.0"encoding="utf8"?>
<xs:schemaxmlns="http://www.ojitha.org/address"targetNamespace="http://www.ojitha.org/add
elementFormDefault="qualified"attributeFormDefault="unqualified">
<xs:complexTypename="AUAddress">
<xs:complexContent>
<xs:extensionbase="Address">
<xs:sequence>
<xs:elementname="state"maxOccurs="1">
<xs:simpleType>
<xs:restrictionbase="xs:string">
<xs:enumerationvalue="ACT"/>
<xs:enumerationvalue="VIC"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attributename="country"type="xs:NMTOKEN"fixed="AU"use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexTypename="USAddress">
<xs:complexContent>
<xs:extensionbase="Address">
<xs:sequence>
<xs:elementname="state"maxOccurs="1">
<xs:simpleType>
<xs:restrictionbase="xs:string">
<xs:enumerationvalue="AK"/>
<xs:enumerationvalue="AL"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attributename="country"type="xs:NMTOKEN"fixed="US"use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexTypename="Address">
<xs:sequence>
<xs:elementname="street"type="xs:string"maxOccurs="1"/>
<xs:elementname="city"type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Following figure shows these three types how they are related.
http://ojitha.blogspot.in/2012/01/learn-xml-schema-by-example-2.html
23,030
popular
posts
Spring 3
java.lang.Thread.isAlive()
This blog intended to
check the aliveness of a
thread. We have used the
method boolean isAlive()
define in the class
java.lang.Thread, whic...
Remote
access
with
Spring
HttpInvoker
Introduction I can
remember the early days
of Java where I used RMI
to create distributed
system. But it is very
difficult to use RMI thes...
contents
BlazeDS (1)
DL (1)
Flex (1)
Java (29)
JSF (1)
JUnit (1)
Linux (2)
OGNL (8)
Ontology (1)
OWL (1)
Patterns (1)
Protege (1)
Rails (1)
Ruby (1)
Semantic Web (1)
Spring (4)
6/9/2012
Page 2 of 3
blog archive
2012 (10)
February (6)
January (4)
Learn XML Schema by
Example: 2
Polymorphism
Learn XML Schema by
Example: 1. Complex type
SAAJ Unit testing client for
JAX-WS web services
Tip: Java Instance
initialization is critical
2011 (17)
2010 (6)
2009 (9)
2008 (2)
2007 (2)
followers
Join this site
with Google Friend Connect
Members (4)
Already a member?Sign in
subscribe to
Let us create a another schema which represent the person, who is having address which can be either
AUAddress or USAddress.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
?
<?xmlversion="1.0"encoding="utf8"?>
<xs:schemaxmlns="http://www.ojitha.org"targetNamespace="http://www.ojitha.org"xmlns:xs="
<xs:importnamespace="http://www.ojitha.org/address"
schemaLocation="file:///C:/XmlPad%20Projects/first/address.xsd"/>
<xs:annotation>
<xs:documentation>
Thisistestingschemaforapurchaseorder.
</xs:documentation>
</xs:annotation>
<xs:elementname="process">
<xs:complexType>
<xs:sequence>
<xs:elementname="person"type="personType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexTypename="personType">
<xs:sequence>
<xs:elementname="name">
<xs:complexType>
<xs:simpleContent>
<xs:extensionbase="xs:string">
<xs:attributename="sex"use="required">
<xs:simpleType>
<xs:restrictionbase="xs:string">
<xs:enumerationvalue="M"/>
<xs:enumerationvalue="F"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:elementname="age">
<xs:simpleType>
<xs:restrictionbase="xs:positiveInteger">
<xs:minInclusivevalue="12"/>
<xs:maxExclusivevalue="100"/>
</xs:restriction>
http://ojitha.blogspot.in/2012/01/learn-xml-schema-by-example-2.html
6/9/2012
44
45
46
47
48
49
Page 3 of 3
</xs:simpleType>
</xs:element>
<xs:elementname="address"type="addr:Address"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
The <address> element can be either AUAddress or USAddress in the instance XML files as shown in the
following,
1
2
3
4
5
6
7
8
9
10
11
12
13
?
<?xmlversion="1.0"encoding="utf8"?>
<processxmlns="http://www.ojitha.org"xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance
<person>
<namesex="M">Ojitha</name>
<age>40</age>
<addressxsi:type="addr:AUAddress"country="AU">
<addr:street>Ten</addr:street>
<addr:city>bonython</addr:city>
<addr:state>ACT</addr:state>
</address>
</person>
</process>
<?xmlversion="1.0"encoding="utf8"?>
<processxmlns="http://www.ojitha.org"xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance
<person>
<namesex="M">Ojitha</name>
<age>40</age>
<addressxsi:type="addr:USAddress"country="US">
<addr:street>Ten</addr:street>
<addr:city>bonython</addr:city>
<addr:state>AL</addr:state>
</address>
</person>
</process>
ShareThis
0 comments:
Post a Comment
Publish
Preview
Newer Post
Home
Older Post
http://ojitha.blogspot.in/2012/01/learn-xml-schema-by-example-2.html
6/9/2012