Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Namespace issue

 
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>
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

http://siosjrp1



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
 
What's gotten into you? Could it be this tiny ad?
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic