[xsd-users] Serialize a xml whitout the attributes xmlns,
xmlns:xsi and xsi:schemaLocation
Boris Kolpackov
boris at codesynthesis.com
Mon Oct 23 08:41:30 EDT 2006
Hi Cláudio,
Cláudio Margulhano <cmargulhano at gmail.com> writes:
> Is there one way to serialize a xml whitout the attributes xmlns, xmlns:xsi
> and xsi:schemaLocation?
>
> ...
>
> <message xmlns="http://www.example.org/logevents" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://www.example.org/logevents logger.xsd">
You can get rid of xmlns:xsi and xsi:schemaLocation by not providing schema
location in the namespace infomap. E.g., change the following code:
xml_schema::namespace_infomap map;
map[""].name = "http://www.example.org/logevents";
map[""].schema = "logger.xsd";
message (..., map);
to read:
xml_schema::namespace_infomap map;
map[""].name = "http://www.example.org/logevents";
message (..., map);
You cannot get rid of xmlns="http://www.example.org/logevents" if your
schema uses XML namespaces (e.g., has targetNamespace attribute in the
xsd:schema root). So you will have to change your schema fist and then
you can use the empty namespace infomap:
xml_schema::namespace_infomap map;
message (..., map);
hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061023/c325e1e8/attachment.pgp
More information about the xsd-users
mailing list