[xsd-users] Need Help!!

Boris Kolpackov boris at codesynthesis.com
Thu Sep 30 12:10:35 EDT 2010


Hi Peddi,

Peddi Mahesh <peddimahesh at gmail.com> writes:

> <note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xsi:noNamespaceSchemaLocation="sample.xsd">
>     <to>Tove</to>
>     <from>Jani</from>
>     <heading>Reminder</heading>
>     <body>Don't forget me this weekend!</body>
> </note>
>
> [...]
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="body">
>     <xs:complexType mixed="true" />
>   </xs:element>
> 
>   <xs:element name="from">
>     <xs:complexType mixed="true" />
>   </xs:element>
> 
>   <xs:element name="heading">
>     <xs:complexType mixed="true" />
>   </xs:element>
> 
>   <xs:element name="note">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element ref="to" />
>         <xs:element ref="from" />
>         <xs:element ref="heading" />
>         <xs:element ref="body" />
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> 
>   <xs:element name="to">
>     <xs:complexType mixed="true" />
>   </xs:element>
> 
> </xs:schema>

That tool did a pretty poor job. It seems it doesn't know anything 
about types in the XML Schema namespace ;-). Here how I would write 
this schema:

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

> I have project in visual studio 2008 and when I build this project I am
> getting some errors
>
> Error    37    error LNK2019: unresolved external symbol
> "__declspec(dllimport) public: virtual __thiscall
> xercesc_3_1::Wrapper4InputSource::~Wrapper4InputSource(void)"

These symbols are defined in the Xerces-C++ library. I am pretty sure
you forgot to link your application to it. See step 9 in the Section 
for Visual Studio 2008 in the "Using XSD with Microsoft Visual Studio"
Wiki page:

http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio


> Do you have any tool which converts xml to xml schema?

I just saw this tool, called xsd-gen, that says it does it. I haven't
tried it myself yet, so I don't know if it is any good:

http://code.google.com/p/xsd-gen/

Boris



More information about the xsd-users mailing list