• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Namespace issue

 
srinivas.b
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In the below xml file i want to include
<c:Address> for current address and
<pa:Address> for Permanent address
i am unable to create namespace for those
could any one help me how to create those ?

<?xml version="1.0"?>
<!-- This XML Contains New Account details for a bank customer by using Schema -->
<?xml-stylesheet type="text/xml" href="http://siosjrp1/Sample.xsl"?>
<ipo:Transaction Id="100012345"
xmlns:ipo="http://siosjrp1"
xsi:schemaLocation="http://siosjrp1 http://siosjrp1/SampleTransaction1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>

<Bank Name="HDFC" Id="10002001">
<NewAccount>
<!-- New Account element node -->
<CustomerName>
<FirstName>Mark</FirstName>
<MiddleName/>
<LastName>Shimrock</LastName>
</CustomerName>
<Address>
<Line1/>
<Line2/>
<City>Malvern</City>
<State>Pennsylvania</State>
<Zipcode>19355</Zipcode>
<Country>United States</Country>
</Address>
<!-- <pa:Address xmlns:pa="http://siosjrp1">
<pa:Line1/>
<pa:Line2/>
<pa:City/>
<pa:State/>
<pa:Zipcode/>
<pa:Country/>
</pa:Address>
-->
<EmailId>Mark.Shimrock@unisys.com</EmailId>
<MinBalance>
<![CDATA[ Minimum balance must not be < 1000 ]]>
</MinBalance>
<TypeofAccount>
<?note default is taken as Saving?>
<Saving>2000</Saving>
</TypeofAccount>
<FaxNo><757 9008></FaxNo>
<Phone/>
<MobileNo/>
</NewAccount>
</Bank>
</ipo:Transaction>

schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://siosjrp1"
xmlns="http://siosjrp1"
elementFormDefault="qualified"
attributeFormDefault="qualified"
>
<xs:element name="Transaction">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Bank">
<xs:complexType>
<xs:choice>
<xs:element name="Transfer">
<xs:complexType>
<xs:sequence>
<xs:element name="BankId"/>
<xs:element name="BankName"/>
<xs:element name="CustomerId"/>
<xs:element name="CustomerName"/>
<xs:element name="AccountNO"/>
<xs:element name="Branch"/>
<xs:element name="Amount"/>
<xs:element name="AvilableBalance"/>
<xs:element name="Date"/>
<xs:element name="Charge"/>
</xs:sequence>
<xs:attribute name="type" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="NewAccount">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerName">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName"/>
<xs:element name="MiddleName"/>
<xs:element name="LastName"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Address">
<xs:complexType>
<xs:sequence>
<xs:element name="Line1"/>
<xs:element name="Line2"/>
<xs:element name="City"/>
<xs:element name="State"/>
<xs:element name="Zipcode"/>
<xs:element name="Country"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!--<xs:element name="PermenantAddress">
<xs:complexType>
<xs:sequence>
<xs:element name="Line1"/>
<xs:element name="Line2"/>
<xs:element name="City"/>
<xs:element name="State"/>
<xs:element name="ZipCode"/>
<xs:element name="Counrty"/>
</xs:sequence>
</xs:complexType>
</xs:element>-->
<xs:element name="EmailId"/>
<xs:element name="MinBalance"/>
<xs:element name="TypeofAccount">
<xs:complexType>
<xs:choice>
<xs:element name="Saving"/>
<xs:element name="Current"/>
<xs:element name="Retirement "/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="FaxNo"/>
<xs:element name="Phone"/>
<xs:element name="MobileNo"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="Id" use="required"/>
<xs:attribute name="Name"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Id" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It appears your target namespace is http://siosjrp1 and your permanent address element is commented out. You will need to change your xsd to make this work
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic