Join wMUsers | Blog at wMUsers | Edit my wMUsers Profile | Site Map | webMethods Jobs |For Employers

wMUsers  
  #1  
Old 10-27-2006, 08:30
dhimate dhimate is offline
Member
 
Join Date: Jan 2006
Posts: 88
Thanks: 1
Thanked 6 Times in 3 Posts
Unhappy XML Schema Validation

I created following Schema Definition
Code:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:transaction-schema" elementFormDefault="qualified" targetNamespace="urn:transaction-schema">
   <xs:simpleType name="FNameType">
  <xs:restriction base="xs:string">
  </xs:restriction>
 </xs:simpleType>
 <xs:simpleType name="AddressType">
  <xs:restriction base="xs:string">
  </xs:restriction>
 </xs:simpleType>
 <xs:complexType name="InformationType">
  <xs:sequence>
   <xs:element name="Name" type="FNameType" minOccurs="1" maxOccurs="1" />
         <xs:element name="Address" type="AddressType" minOccurs="1" maxOccurs="1" />
  </xs:sequence>
 </xs:complexType>
 <xs:element name="SampleDoc">
  <xs:complexType>
   <xs:sequence>
         <xs:element name="Information" type="InformationType" minOccurs="1" maxOccurs="10" />
         </xs:sequence>
  </xs:complexType>
 </xs:element>
</xs:schema>
Then I generated IS document type using this. Which created docType as well as IS schema for this XSD.

Then I generated sample xml for this schema using pub.xml.documentToXMLString, which gave me following output

Code:
<?xml version="1.0"?>
<ns:SampleDoc>
  <ns:Information>
    <ns:Name>MyName</ns:Name>
    <ns:Address>MyAddress</ns:Address>
  </ns:Information>
</ns:SampleDoc>
Please note that this xml does not have xmlns definition anywhere.

Now when I try to validate this xml against the schema that I generated previously it gives following error

pathName /
errorCode NV-001
[ISC.0082.9001] Error while parsing "[ISC.0042.9328] Error: namespace prefix ns not defined for element SampleDoc"

I tried to put the definition of ns in the sample xml and revaildate it.
Now it is giving following error.

Sample XML:
Code:
 
<?xml version="1.0"?>
<ns:SampleDoc xmlns:ns="http://www.thisserver.com/xmlSchemas">
  <ns:Information>
    <ns:Name>MyName</ns:Name>
    <ns:Address>MyAddress</ns:Address>
  </ns:Information>
</ns:SampleDoc>
pathName /SampleDoc
errorCode NV-003
errorMessage [ISC.0082.9003] Unable to locate a matching element declaration


Why is this problem occuring if I have generated the sample xml from the same schema and then trying to revalidate against it?
Reply With Quote
Advertisement
  #2  
Old 10-27-2006, 12:47
griffima's Avatar
griffima griffima is offline
Senior Member
 
Join Date: Jun 2004
Posts: 725
Thanks: 1
Thanked 35 Times in 31 Posts
Default Schema Okay

Your schema is fine. Make sure you are setting the nsDecls parameter on your documenToXMLString service. THis is what sets up the namespace on the XML instance document. It should match what you have defined in your schema and also what was created in your documents. Which in this case you defined a default namespace of urn:transaction-schema, so the nsDecls should be ns for the prefix and urn:transaction-schema for the namespace.
__________________
markg

http://www.thegreylines.net
Reply With Quote
The Following User Says Thank You to griffima For This Useful Post:
mcarlson (03-12-2010)
  #3  
Old 10-27-2006, 14:35
dhimate dhimate is offline
Member
 
Join Date: Jan 2006
Posts: 88
Thanks: 1
Thanked 6 Times in 3 Posts
Thumbs up working

Thanks Mark.
It is working
Reply With Quote
  #4  
Old 03-12-2010, 09:46
x-timas x-timas is offline
Junior Member
 
Join Date: Feb 2010
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks Mark. It was helpful for me.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Schema Validation IssueAmbiguous content model in schema raviusd Flow and Java services 3 01-28-2010 08:08
Schema validation snanda Flow and Java services 9 09-15-2004 14:37
Xcbl 35 schema validation problem data validation Brian Flow and Java services 0 11-11-2003 12:35
Schema validation mow Flow and Java services 0 08-30-2003 13:46
XML Validation Using Schema puneet Flow and Java services 7 07-15-2003 10:48


All times are GMT -6. The time now is 21:02.


.
All Content Copyright ©2002-2009, Conneva, Inc. DBA wMUsers.Com

wMUsers is an independent organization and is not sponsored in any manner by Software AG or webMethods, Inc.

Page generated in 0.08058 seconds with 17 queries