[xsd-users] Help me: Borland C++ Builder 2007 compiled program has unwanted prefix and all property values are missing.

James Mei jxmei3 at gmail.com
Tue Oct 13 19:14:48 EDT 2009


Hi Boris

It seems like the serialization is trying to print out properties that
stored in the class. But the properties are stored in unicode, that is why
they are all missing in the output file.

May I know if there is any flag setting to enable that ?

e.g.

    ofstream outfile(argv[2], ios::out);
    SCL_(outfile, *h, f);
//the value for "f" ?

Or there is other API to store the xml file into the file system ?

Cheers
James


On Tue, Oct 13, 2009 at 11:50 PM, James Mei <jxmei3 at gmail.com> wrote:

> Hi Boris
>
> Thanks for the reply.
>
> I am currently tracing the line for the missing node properties.
>
> From the memory map, the Xerces parses the xml file correctly. It is then
> putting the property values into the class structure.
>
> I can see the property values are stored in the class structure, but during
> serialization, they do not get output.
>
> As show in the picture, the value for h.get()->Header().revision() is
> stored in
>
> h._Myptr.Header.X_.revision_.x_    std::basic_string<char,
> std::char_traits<char>,std::allocator<char> >::_Bx.
>
> Is there any special option in the serializer for the xml output ?
>
> Cheers
> James
>
>
> On Tue, Oct 13, 2009 at 9:54 PM, Boris Kolpackov <boris at codesynthesis.com>wrote:
>
>> Hi James,
>>
>> James Mei <jxmei3 at gmail.com> writes:
>>
>> > Even I use the same namespace (no change on the namespace, write the xml
>> > file right after reading), it still has a "p1" prefix
>>
>> Your schema and consequently your XML documents *DO* use namespaces.
>> In the object model the information about the namespace-prefix mappings
>> that was used in your input XML is not preserved. As a result, during
>> serialization, you have two choices: you can either assign prefixes
>> to namespaces used in your vocabulary manually, or generic ones (like
>> p1, p2, etc.) will be assigned automatically.
>>
>> For details see Section 6.1, "Namespace and Schema Information" in the
>> C++/Tree Mapping Getting Started Guide:
>>
>>
>> http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#6.1
>>
>>
>> >     SCL_(outfile, *h);
>>
>> Change this to be:
>>
>> xml_schema::namespace_infomap map;
>>
>> map[""].name = "http://www.iec.ch/61850/2003/SCL";
>> map[""].schema = "SCL.xsd";
>>
>> SCL_(outfile, *h, map);
>>
>> Boris
>>
>
>


More information about the xsd-users mailing list