• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call xsd file from xml file

 
praneeth ram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
My intention is when ever i invoke the xml file through browser, My xml file must be call and validated by xsd file. how can achive this. Which tag and attribute i need to write in xml file. I mentioned my file in the bellow.

emp.xsd
<? xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employees" type="xsd:string"/>
</xsd:schema>

emp.xml
<!-- Here i want to mention emp.xsd file location -->
<employee>
praneeth
</employees>

both files are placed inside D:\praneeth folder.

Thanks & Regards,
Praneeth.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, your xsd has to specify the namespace under which the elements will be available. And once you do that, the elements in your xml can then refer to that namespace. See if this helps


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic