[xsd-users] Error in compilation and question about parsing

sabitha reddy sabitha.reddi at gmail.com
Mon May 19 22:28:59 EDT 2014


Hey Boris,

I really appreciate your help. It worked after I changed it to:

 auto_ptr<Hosts>  h(hosts (argv[1]));
         Hosts::host_sequence& hs (h->host ());

My second question was:

We create Hosts object by sending xml file name as input[argv[1]. Instead
is there a way I can do it by sending my xml data as char string and not by
writing it to file and passing file name?. And also, my test program worked
only after I specified the XSD file path in input xml file as follows:

<hosts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="hosts_file.xsd">

Is there any way I can avoid this?. My xml file is generated by some other
source and its difficult to edit to add the xsd path to it.

Thanks in advance for your help.

Regards,
Sabitha.


On Mon, May 19, 2014 at 8:40 PM, Boris Kolpackov <boris at codesynthesis.com>wrote:

> Hi Sabitha,
>
> sabitha reddy <sabitha.reddi at gmail.com> writes:
>
> > auto_ptr<Hosts>  h(Hosts (argv[1]));
>
> In XSD, this line has the following pattern:
>
> auto_ptr<TypeName> h (ElementName (argv[1]));
>
> If both your ElementName and TypeName are actually the same name, then
> XSD append '_' at the end to make ElementName. So in your case the code
> most likely should look like this:
>
> auto_ptr<Hosts> h (Hosts_ (argv[1]));
>
>
> > And also, my other question is, if we create an object without sending
> xml
> > file, is there any way I can read it later into the object?,
>
> I am not sure I understand what you are trying to achieve. If it is
> already an object, why would you need to later read into an object?
>
> Boris
>


More information about the xsd-users mailing list