From ian.durkan at progeny.net Tue Mar 2 18:50:20 2010
From: ian.durkan at progeny.net (Durkan, Ian)
Date: Tue Mar 2 18:50:32 2010
Subject: [xsd-users] Eliminate meaningless whitespace in text elements?
Message-ID: <3F87AA6367687C43A854B8E7073CDF8C1454C1@es-108a.paxriver.progeny.net>
Greetings,
We're being challenged by an issue with whitespjace within text nodes in
documents we're parsing using the combination of the xerces-c DOM parser
(specifically a DOMLSParser - to allow reuse of schema for validation)
followed by xsd/tree processing. Put simply we get the DOMDocument from
the DOMLSParser, then hand it off to xsd/tree.
In our schema, there's an element "description" that's type string.
During parsing, is there any way to have xsd/tree automatically
eliminate leading, trailing, and meaningless internal whitespace? For
example, the element might be set up like this in a document:
This description
covers multiple lines.
When calling the description() method of the element's parent, it
returns a string containing the spaces and newlines verbatim from the
document.
>From what I'm reading across the web, this is impossible for xerces-c
alone-the schema would need to set description's type to "token" instead
of "string". Can xsd/tree take care of this, or does it come down to
choosing between dropping whitespace ourselves, or changing the schema?
Ian Durkan
ian . durkan progeny . net
From robotpushkar at gmail.com Tue Mar 2 20:51:53 2010
From: robotpushkar at gmail.com (Pushkar Kolhe)
Date: Tue Mar 2 20:52:00 2010
Subject: [xsd-users] Namespace mapping for XML schema error...
Message-ID: <6c964ac91003021751s34402858g385f8b0c153a6438@mail.gmail.com>
Hi,
My XSD has the following schema:
file.xsd
...
I tried to create a C++ tree with:
xsd.exe cxx-tree file.xsd
I get an error saying Cannot map XML schema namespace 'urn:OffLineMessage'
to C++ namespace. I tried to add --namespace-map with:
xsd.exe cxx-tree --anonymous-regex "#.* (.+)/(.+)#$1_$2#" --namespace-map
"http://www.w3.org/2000/09/xmldsig#=XMLDSig" file.xsd
I get the same error again!
--p
From fengtr at gmail.com Tue Mar 2 23:01:00 2010
From: fengtr at gmail.com (Feng Tony)
Date: Wed Mar 3 03:29:20 2010
Subject: [xsd-users] Problem with parsing xml documents containing Chinese
characters
In-Reply-To:
References:
Message-ID:
Thank you, Boris!
In my last reply, the last question is I wonder if a name can be assigned to
a const char* type as:
const char * pChar = name;
it's convenient, isn't it? May be one can implement it by creating a
subclass of name, but I hadn't tried it yet.
My project can solve my problem right now.
Thank you very much!
On Fri, Feb 26, 2010 at 11:25 PM, Boris Kolpackov
wrote:
> Hi Tony,
>
> In the future please keep your replies CC'ed to the xsd-users mailing
> list as discussed in the posting guidelines:
>
> http://www.codesynthesis.com/support/posting-guidelines.xhtml
>
> Feng Tony writes:
>
> > Hi Boris,
> > Thanks for your excellent work.The xsd-3.3.0.b2-i686-windows version
> works
> > fine with wchar_t option.
>
> Glad to hear that.
>
>
> > But I still have some questions:
> > 1. "In this case Chinese characters will be encoded in UTF-8."
> > Did you mean that the Chinese characters will be encoded in UTF-8 when I
> > used MBCS character set in my project?
>
> That's correct. The character encoding used in the object model is
> independent of the operating system code page (except for one case,
> see below).
>
>
> > Then if I want to assign the string to variables of char* type and
> display
> > them in screen,how can I do it perfectly?
>
> There are several ways to do this.
>
> 1. You can use WideCharToMultiByte/MultiByteToWideChar with CP_UTF8
> to manually convert between UTF-8 and the current code page (this
> is Windows-specific).
>
> 2. You can try to use the Xerces-C++ "local code page" encoding for
> the object model. Chances are everything will work out of the box
> automatically.
>
> To do this, I suggest that you download XSD 3.3.0.b1 (see the
> download page[1]) and pass '--char-encoding lcp' option when
> compiling your schemas. Then you should be able to simply do:
>
> const char* s = foo->name ().c_str ();
>
>
> > 2.What is the correct method to extract a name or a desc string and
> assign
> > it to a string instance or a char* variable?
> > Is the following code correct?
> > if (it->desc().present())
> > {
> > tc.InsertItem(it->desc().get().c_str(), m_hIED);
> > }
>
> Yes, looks about right, if you are using the second (lcp) approach.
>
> > I thank if there is one overload member function like this(pseudo code):
> > tDescType & operator=( const TCHAR* ) {}
> > then it will be perfect, doesn't it? :)
>
> I am not sure I understand this part. Where do you expect such an operator
> to be define?
>
> [1] http://www.codesynthesis.com/products/xsd/download.xhtml
>
> Boris
>
> >
> > I am sorry for my poor expressions!
> >
> > Best regards
> >
> > Tony
>
From boris at codesynthesis.com Wed Mar 3 05:48:27 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 3 05:38:43 2010
Subject: [xsd-users] Problem with parsing xml documents containing
Chinese characters
In-Reply-To:
References:
Message-ID:
Hi Tony,
Feng Tony writes:
> In my last reply, the last question is I wonder if a name can be assigned to
> a const char* type as:
> const char * pChar = name;
> it's convenient, isn't it?
Such an implicit conversion would be dangerous. Which is also the reason
why std::string (from which xml_schema::string is derived) doesn't provide
it.
> May be one can implement it by creating a subclass of name, but I
> hadn't tried it yet.
Yes, you can do it by customizing the mapping for the xsd:string XML
Schema built-in type.
Boris
From boris at codesynthesis.com Wed Mar 3 05:58:03 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 3 05:48:19 2010
Subject: [xsd-users] Namespace mapping for XML schema error...
In-Reply-To: <6c964ac91003021751s34402858g385f8b0c153a6438@mail.gmail.com>
References: <6c964ac91003021751s34402858g385f8b0c153a6438@mail.gmail.com>
Message-ID:
Hi Pushkar,
Pushkar Kolhe writes:
> I get an error saying Cannot map XML schema namespace 'urn:OffLineMessage'
> to C++ namespace. I tried to add --namespace-map with:
> xsd.exe cxx-tree --anonymous-regex "#.* (.+)/(.+)#$1_$2#" --namespace-map
> "http://www.w3.org/2000/09/xmldsig#=XMLDSig" file.xsd
>
> I get the same error again!
You will need to pass the namespace that is used in your schema
(urn:OffLineMessage) instead of some unrelated namespace
(http://www.w3.org/2000/09/xmldsig#) to the --namespace-map option.
In other words, replace:
--namespace-map "http://www.w3.org/2000/09/xmldsig#=XMLDSig"
With something like:
--namespace-map urn:OffLineMessage=OffLineMessage
Alternatively, you can download[1] the beta for the next release of XSD
(3.3.0) which is capable of mapping URN-style namespace automatically.
[1] http://www.codesynthesis.com/products/xsd/download.xhtml
Boris
From boris at codesynthesis.com Wed Mar 3 06:18:43 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 3 06:08:59 2010
Subject: [xsd-users] Eliminate meaningless whitespace in text elements?
In-Reply-To: <3F87AA6367687C43A854B8E7073CDF8C1454C1@es-108a.paxriver.progeny.net>
References: <3F87AA6367687C43A854B8E7073CDF8C1454C1@es-108a.paxriver.progeny.net>
Message-ID:
Hi Ian,
Durkan, Ian writes:
> In our schema, there's an element "description" that's type string.
> During parsing, is there any way to have xsd/tree automatically
> eliminate leading, trailing, and meaningless internal whitespace? For
> example, the element might be set up like this in a document:
>
>
>
> This description
>
> covers multiple lines.
>
>
>
> When calling the description() method of the element's parent, it
> returns a string containing the spaces and newlines verbatim from the
> document.
That's the expected behavior since the semantics of the xsd:string
type require that it preserves all the whitespaces.
> >From what I'm reading across the web, this is impossible for xerces-c
> alone-the schema would need to set description's type to "token" instead
> of "string".
Correct, there is no automatic way to get the required behavior in
Xerces-C++ except by changing the schema. You could also "post-process"
the DOM document manually and collapse all the whitespaces in the
specific element(s) before handing it off to C++/Tree.
> Can xsd/tree take care of this, or does it come down to choosing between
> dropping whitespace ourselves, or changing the schema?
Unfortunately, there is no automatic way to do this in C++/Tree either.
There are a couple of "manual" options available on this level:
1. You can assign the value returned by description() to xml_schema::token
which will collapse all the whitespaces:
xml_schema::token t = x.description ();
2. You can customize the type containing the description element and
"override" the description() accessor to return the collapsed value.
Let's say the type containing the description element is called X.
Then you request the generation of the original mapping for X as
X_base (see the --custom-type option) and then provide the custom
implementation as:
class X: public X_base
{
// Copy c-tors and _clone from X_base and simply forward the
// arguments to X_Base.
public:
const description_type&
description () const
{
xml_schema::token t = X_Base::description ();
return description_type (t);
}
};
For more information on type customization see the C++/Tree Mapping
Customization Guide:
http://wiki.codesynthesis.com/Tree/Customization_guide
As well as the examples in the examples/cxx/tree/custom/ directory.
3. Customize the mapping for the xsd:string XML Schema built-in type to
always collapse whitespeces. This is a pervasive change in that every
element and attribute that uses this type will have whitespaces
collapsed. This method is primarily useful when you have a lot of
elements like description and all the other elements/attributes that
use xsd:string are whitespace-insensitive.
Boris
From mattia.db at gmail.com Wed Mar 3 10:28:04 2010
From: mattia.db at gmail.com (Mattia Donna Bianco)
Date: Wed Mar 3 10:28:08 2010
Subject: [xsd-users] Xsd crash
Message-ID:
Dear Boris,
I'm Mattia Donna Bianco. I used Xsd for some time and it always worked.
Currently I'm working on a LASeR project (a mpeg standard for richmedia)
but I haven't been able to process the LASeR schema with Xsd. I both used
the windows and linux version:
- in windows7 and windows xp crashes without saying anything
- in linux says "segmentation fault" and nothing else
The schemas validate using the validation tool online provided by w3c (
http://validate.openlaboratory.net/).
The command I give are:
xsd cxx-tree --generate-xml-schema --generate-serialization
--generate-polymorphic XMLSchema.xsd
and
xsd cxx-tree --generate-wildcard --extern-xml-schema XMLSchema.hxx
--generate-serialization --generate-polymorphic --file-per-type
--namespace-map urn:mpeg:mpeg4:LASeR:types:2005=mxm_dataobject::laser
--namespace-map http://www.w3.org/2000/svg=mxm_dataobject::laser
--namespace-map urn:mpeg:mpeg4:LASeR:2005=mxm_dataobject::laser
--namespace-map urn:mpeg:mpeg4:LASeR:types:2005=mxm_dataobject::laser
--namespace-map http://www.w3.org/2001/xml-events=mxm_dataobject::laser
--namespace-map
http://www.w3.org/XML/1998/namespace=mxm_dataobject::laser
--namespace-map http://www.w3.org/1999/xlink=mxm_dataobject::laser
--namespace-map http://www.w3.org/2005/SMIL21=mxm_dataobject::lasersaf2.xsd
This is the link to download the schemas:
link
.
Any helps will be appreciated.
Thanks for the attention, best regards
--
Mattia
From boris at codesynthesis.com Wed Mar 3 13:34:02 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 3 13:24:16 2010
Subject: [xsd-users] Xsd crash
In-Reply-To:
References:
Message-ID:
Hi Mattia,
Mattia Donna Bianco writes:
> Currently I'm working on a LASeR project (a mpeg standard for richmedia)
> but I haven't been able to process the LASeR schema with Xsd. I both used
> the windows and linux version:
> - in windows7 and windows xp crashes without saying anything
> - in linux says "segmentation fault" and nothing else
That's a bug in the file-per-type mode in XSD. Thanks for reporting it!
I have committed the fix and it will appear in the upcoming XSD 3.3.0.
In the meantime I can build you a pre-release binary. Let me know
which platform you need.
> The command I give are:
>
> [...]
>
> --namespace-map http://www.w3.org/2000/svg=mxm_dataobject::laser
>
> [...]
I had to change this to something like:
--namespace-map http://www.w3.org/2000/svg=mxm_dataobject::laser::svg
Since otherwise there are name conflicts. For example, the pathType type
is defined in two schemas that use different XML namespaces so if you
map all the XML namespaces to the same C++ namespace, you end up with
redefinition errors.
Boris
From greg at permedia.ca Thu Mar 11 11:41:52 2010
From: greg at permedia.ca (Greg Carter)
Date: Thu Mar 11 11:41:52 2010
Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem
In-Reply-To:
References:
Message-ID:
Hi Boris,
Just a note to let you know I've tried this out on both Windows and
Linux and everything is working correctly. The only additional thing I
did was to add
#include
and
#include
To all of my custom schema class cpp/cxx files and to most of other
files that used the generated classes. Did this to turn off the
warnings generated by the Microsoft compiler.
Boris Kolpackov wrote:
>
>> Ideally I'll end up applying your fix, as removing the
>> --extern-xml-schema option is a manual process (I have to put it back in
>> to get a proper build for Windows)... when you have a fix let me know
>> and I'll try it out.
>>
>
> Will do, probably early next week.
>
> Boris
>
>
From boris at codesynthesis.com Thu Mar 11 13:34:44 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Thu Mar 11 13:24:29 2010
Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem
In-Reply-To:
References:
Message-ID:
Hi Greg,
Greg Carter writes:
> Just a note to let you know I've tried this out on both Windows and
> Linux and everything is working correctly.
Thanks, I appreciate the feedback.
Boris
From angelo at smartrm.com Wed Mar 17 08:37:02 2010
From: angelo at smartrm.com (Angelo Difino)
Date: Wed Mar 17 08:37:10 2010
Subject: [xsd-users] Xsd crash
In-Reply-To:
References:
Message-ID: <4BA0CCEE.3000302@smartrm.com>
Hi Boris and all,
I've got a similar trouble on my schemas... I'm not sure the problem is
the same,
but I suppose is very close.
I've also tried with 3.3b1 but i cannot see any differences :/
the script i use is (to create class for mxmscp.xsd):
1)xsd cxx-tree --generate-xml-schema --generate-serialization
--generate-polymorphic xmlSchema.xsd
2)xsd cxx-tree --generate-wildcard --extern-xml-schema xmlschema.hxx
--generate-serialization --generate-polymorphic --file-per-type
--namespace-map
urn:mpeg:mpeg-m:schema:storelicenseprotocol:2009=mxm_dataobject::mxmslp
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/bbl.xsd=bbl.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mxmalp.xsd=mxmalp.xsd --location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mxmbp.xsd=mxmbp.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dia.xsd=dia.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/erl.xsd=erl.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl-msx.xsd=didl-msx.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl.xsd=didl.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didmodel.xsd=didmodel.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dii.xsd=dii.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpdidl.xsd=ipmpdidl.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo-msx.xsd=ipmpinfo-msx.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo.xsd=ipmpinfo.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpmsg.xsd=ipmpmsg.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg4ipmp.xsd=mpeg4ipmp.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg7smp.xsd=mpeg7smp.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m1x.xsd=rel-m1x.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m2x.xsd=rel-m2x.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m3x.xsd=rel-m3x.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-mx.xsd=rel-mx.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-r.xsd=rel-r.xsd
--location-map
http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-sx.xsd=rel-sx.xsd
--location-map http://www.w3.org/2001/xml.xsd=xml.xsd --location-map
http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd=dsig.xsd
--location-map
http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd=xenc.xsd
--namespace-map
urn:mpeg:maf:schema:mediastreaming:DIDLextensions=mxm_dataobject::didl_msx
--namespace-map urn:mpeg:mpeg21:2006:07-DIDL-NS=mxm_dataobject::didl
--namespace-map
urn:mpeg:mpeg21:2002:02-DIDMODEL-NS=mxm_dataobject::didmodel
--namespace-map urn:mpeg:mpeg21:2002:01-DII-NS=mxm_dataobject::dii
--namespace-map
urn:mpeg:mpeg21:2004:01-IPMPDIDL-NS=mxm_dataobject::ipmpdidl
--namespace-map urn:mpeg:mpeg21:2003:01-DIA-NS=mxm_dataobject::dia
--namespace-map urn:mpeg:mpeg21:2005:01-ERL-NS=mxm_dataobject::erl
--namespace-map
urn:mpeg:maf:Schema:mediastreaming:IPMPINFOextensions:2007=mxm_dataobject::ipmpinfo_msx
--namespace-map
urn:mpeg:mpeg21:2004:01-IPMPINFO-NS=mxm_dataobject::ipmpinfo
--namespace-map
urn:mpeg:mpegB:schema:IPMP-XML-MESSAGES:2007=mxm_dataobject::ipmpmsg
--namespace-map urn:mpeg:mpeg4:IPMPSchema:2002=mxm_dataobject::mpeg4ipmp
--namespace-map urn:mpeg:mpeg7:smp:schema:2001=mxm_dataobject::mpeg7smp
--namespace-map
urn:mpeg:mpeg21:2005:01-REL-M1X-NS=mxm_dataobject::rel_m1x
--namespace-map
urn:mpeg:mpeg21:2006:01-REL-M2X-NS=mxm_dataobject::rel_m2x
--namespace-map
urn:mpeg:mpeg21:2006:01-REL-M3X-NS=mxm_dataobject::rel_m3x
--namespace-map urn:mpeg:mpeg21:2003:01-REL-MX-NS=mxm_dataobject::rel_mx
--namespace-map urn:mpeg:mpeg21:2003:01-REL-R-NS=mxm_dataobject::rel_r
--namespace-map urn:mpeg:mpeg21:2003:01-REL-SX-NS=mxm_dataobject::rel_sx
--namespace-map
http://www.w3.org/XML/1998/namespace=mxm_dataobject::xml
--namespace-map http://www.w3.org/2000/09/xmldsig#=mxm_dataobject::dsig
--namespace-map http://www.w3.org/2001/04/xmlenc#=mxm_dataobject::xenc
--namespace-map
urn:mpeg:mpeg-m:schema:accesslicenseprotocol:2009=mxm_dataobject::mxm_protocols
--namespace-map
urn:mpeg:mpeg-m:schema:baseprotocol:2009=mxm_dataobject::mxm_bprotocols
--namespace-map urn:com.smartrm.core.represent.level0=smartrm_dataobject
--namespace-map
urn:mpeg:mpeg-m:schema:identifycontentprotocol:2009=mxm_dataobject::mxm_icp
mxmscp.xsd
I uploaded the schema I use on http://www.mxb.it/schemas.zip
Thank you very much for your patience :)
Best, Angelo!
From boris at codesynthesis.com Wed Mar 17 10:42:46 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 17 10:32:05 2010
Subject: [xsd-users] Xsd crash
In-Reply-To: <4BA0CCEE.3000302@smartrm.com>
References:
<4BA0CCEE.3000302@smartrm.com>
Message-ID:
Hi Angelo,
Angelo Difino writes:
> I've got a similar trouble on my schemas... I'm not sure the problem is
> the same, but I suppose is very close.
The stack trace ends in the Xerces-C++ code, so this is a different
problem. I am going to try to track it down and will let you know
what I find. Thanks for reporting this!
Boris
From mukesh.s at pyxis-it.com Wed Mar 17 07:49:59 2010
From: mukesh.s at pyxis-it.com (Mukesh Sharma)
Date: Wed Mar 17 10:49:09 2010
Subject: [xsd-users] FpML schema - C++ compilation
Message-ID: <000001cac5c7$f96a2f90$b702a8c0@MORDOR>
Dear All,
We have been trying to build the C++ objects from the FpML 5.0 2nd working
draft using Code Synthesis XSD. The steps we followed were as described on
the page - http://codesynthesis.com/download/xsd/3.2/windows/README.txt
The output was a single C++ file; which seemed to contain all the class
objects. But when we do FpML schema compilation in Java using JAXB, it
creates a whole hierarchy of small-small classes.
(1) Can anyone let us know if this is expected OR in C++ also we should
be getting the class hierarchy similar to Java?
(2) Do we need any additional steps other then mentioned in the above
link?
Thanks & Regards,
Mukesh Sharma
Pyxis, Pune | Mobile: +91-9503640002
From boris at codesynthesis.com Wed Mar 17 11:13:05 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 17 11:02:23 2010
Subject: [xsd-users] FpML schema - C++ compilation
In-Reply-To: <000001cac5c7$f96a2f90$b702a8c0@MORDOR>
References: <000001cac5c7$f96a2f90$b702a8c0@MORDOR>
Message-ID:
Hi Mukesh,
Mukesh Sharma writes:
> The output was a single C++ file; which seemed to contain all the class
> objects. But when we do FpML schema compilation in Java using JAXB, it
> creates a whole hierarchy of small-small classes.
>
> (1) Can anyone let us know if this is expected OR in C++ also we should
> be getting the class hierarchy similar to Java?
Yes, this is expected. By default XSD produces a set of C++ source files
(that is, a header file and an implementation files) for each schema file
instead of a set of files for each type as in Java. Also note that you
will need to compile each schema file separately or you can use *.xsd
as the XSD compiler argument to compiler every schema file in the
current directory.
> (2) Do we need any additional steps other then mentioned in the above
> link?
No, that's all you need. For your reference, here are the options that
we use to compile the FpML schemas in our tests:
--generate-polymorphic
--root-element FpML
--namespace-map http://www.fpml.org/2009/FpML-4-7=FpML_4_7
--namespace-map http://www.w3.org/2000/09/xmldsig#=XMLDSig
Boris
From katalin.roman at gmail.com Mon Mar 22 08:54:43 2010
From: katalin.roman at gmail.com (Catalin Roman)
Date: Mon Mar 22 08:54:52 2010
Subject: [xsd-users] Disable Xerces-C Unique Particle Attribution check
Message-ID: <2867232e1003220554u5f46b2e5gb97f287f859e420e@mail.gmail.com>
Hello everybody,
This is my first post on this mailing list, so please tell me if I did
something wrong by addressing the following problem here:
- I am trying to use XSD(xsd-3.2.0-i686-windows) in VS2008, with
Xerces-C(xerces-c-3.1.0-x86-windows-vc-9.0) to compile a schema that
violates UPA; the schema fragment that's responsible for this is:
...................................................................
I would like to ask if I can "disable" the UPA check performed by the
Xerces-C parser and if it's possible, how can I achieve that ?
Any other hints or workarounds are also most welcomed.
Thanks,
Catalin
From boris at codesynthesis.com Mon Mar 22 11:36:59 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Mon Mar 22 11:25:59 2010
Subject: [xsd-users] Xsd crash
In-Reply-To:
References:
<4BA0CCEE.3000302@smartrm.com>
Message-ID:
Hi Angelo,
Boris Kolpackov writes:
> Angelo Difino writes:
>
> > I've got a similar trouble on my schemas... I'm not sure the problem is
> > the same, but I suppose is very close.
>
> The stack trace ends in the Xerces-C++ code, so this is a different
> problem. I am going to try to track it down and will let you know
> what I find.
Ok, I have fixed this bug in Xerces-C++ and committed the fix for the
upcoming Xerces-C++ 3.1.1 release.
I have also built a pre-release binary for XSD 3.3.0.b2 with this fix
which you can download from here (I assume you are using Windows):
http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0.b2-i686-windows.zip
This version compiles your schemas without any problems.
You will also need to use the updated version of Xerces-C++ in your
application IF you have XML Schema validation enabled AND using
loadGrammar() to pre-load the schemas. In particular, you can still
use unmodified Xerces-C++ 3.1.0 if you use the schemaLocation
attributes in your XML or the schema_location property to load
the schemas (the bug does not affect these use-cases).
In case you need it, the updated version of Xerces-C++ with the fix
is available here:
http://www.codesynthesis.com/~boris/tmp/xerces-c-3.1.1.a1.zip
http://www.codesynthesis.com/~boris/tmp/xerces-c-3.1.1.a1.tar.gz
Let me know if you run into any problems.
Boris
From boris at codesynthesis.com Mon Mar 22 11:48:17 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Mon Mar 22 11:37:15 2010
Subject: [xsd-users] Disable Xerces-C Unique Particle Attribution check
In-Reply-To: <2867232e1003220554u5f46b2e5gb97f287f859e420e@mail.gmail.com>
References: <2867232e1003220554u5f46b2e5gb97f287f859e420e@mail.gmail.com>
Message-ID:
Hi Catalin,
Catalin Roman writes:
> I am trying to use XSD(xsd-3.2.0-i686-windows) in VS2008, with
> Xerces-C(xerces-c-3.1.0-x86-windows-vc-9.0) to compile a schema that
> violates UPA; the schema fragment that's responsible for this is:
>
>
>
>
>
To be precise, this fragment violates the "Consistent Element Declaration"
rule rather than the "Unique Particle Attribution" rule. In XML Schema
elements within the same type with the same name should have the same
type.
> I would like to ask if I can "disable" the UPA check performed by the
> Xerces-C parser and if it's possible, how can I achieve that?
No, unfortunately it is not possible to disable the checking of the
above fragment.
> Any other hints or workarounds are also most welcomed.
The only way forward that I can think of is to fix the schema. You could
use a single 'value' element whose type is a union of boolean and byte
to achieve the above behavior in a legal way.
Boris
From Lisa.Preston at jhuapl.edu Mon Mar 22 14:44:48 2010
From: Lisa.Preston at jhuapl.edu (Preston, Lisa K.)
Date: Mon Mar 22 14:57:21 2010
Subject: [xsd-users] Preserving order of elements in unbounded ?
Message-ID: <02549B881CC40B4FB07727C0B33B715207DCDDC285@aplesspirit.dom1.jhuapl.edu>
Hi,
I am using the XSD C++/Tree tool (version 3.2.0, Linux) to parse a schema and produce C++ binding code to be used in an application. I am working with a schema that defines a structure composed of a mixture of groups of Items, and string pointers to XML files containing groups of Items. I am having difficulty with the object model produced for xs:choice when it has a maxOccurs greater than 1, as it does not allow me to access the elements in the choice individually so I can process them in file order.
The following is a snippet from a simplified schema that exhibits the problem:
I would like to accept XML documents with the and elements in any order so the user has control over the order in which the groups of Items are processed, regardless of their definition style (inline vs. in a file). Since the user's specified order is meant to be deliberate, the application must be able to process the items in the order they appear in the file. In the example below, the Items must be processed in the following order: item1, item2, item3, item4, item5, item6, item7, item8, since that is the order the user has defined.
group1
So to the problem... Running the schema through the C++/Tree tool, the object model for the ItemGroup class provides the following "getter" methods, with their variety of signatures: groupName(), items_ref(), and items(). With only these calls available, I am unable to know the order in which these elements appeared in the parsed XML document, and can only process either all the elements first, or all the elements first. It is critical to my application that I be able to know the file-order of the elements, so my questions are:
1. Is there any way to get at this information with C++/Tree (even if it is tricky)?
2. Is there a better way to compose the schema such that the produced object model will give the effect I'm looking for?
3. Why with an "unbounded" choice is there not an accessor for the ordered sequence of "choiced" elements (I do understand the reason for the flat API, but it would be nice for both types of access)?
I have looked through the user list archives, and understand the reasons for the tool's particular implementation of xs:choice (simple flat API), but I still need to access the elements in this way. My current workaround is to access the underlying DOM tree, cycle through the elements looking for the element name "items" or "item-group", and then "popping" the next object appropriate from the items() or items_ref() result sequences. This works well enough, but is not very maintainable should we change the schema, and likely not all that efficient. It will probably also be confusing for anyone who comes along after I'm gone and tries to understand why I had to access the DOM directly when I had perfectly good C++ binding code.
Thoughts?
Lisa
From boris at codesynthesis.com Mon Mar 22 16:19:02 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Mon Mar 22 16:07:59 2010
Subject: [xsd-users] Preserving order of elements in unbounded ?
In-Reply-To: <02549B881CC40B4FB07727C0B33B715207DCDDC285@aplesspirit.dom1.jhuapl.edu>
References: <02549B881CC40B4FB07727C0B33B715207DCDDC285@aplesspirit.dom1.jhuapl.edu>
Message-ID:
Hi Lisa,
Preston, Lisa K. writes:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> [...]
>
>
> group1
>
>
>
>
>
>
>
>
>
>
>
>
> So to the problem... Running the schema through the C++/Tree tool, the
> object model for the ItemGroup class provides the following "getter"
> methods, with their variety of signatures: groupName(), items_ref(),
> and items(). With only these calls available, I am unable to know
> the order in which these elements appeared in the parsed XML document,
> and can only process either all the elements first, or all
> the elements first. It is critical to my application that
> I be able to know the file-order of the elements, so my questions are:
>
>
> 1. Is there any way to get at this information with C++/Tree
> (even if it is tricky)?
There are two ways to do this without modifying the schema. The first
way is to use the DOM association feature and iterate over the elements
in item-group in the "document order" using DOM. From each DOMElement
inside item-group you can then get pack to the object model node. I
understand that that's the method you are currently using (or a variant
of it).
The other approach would be to customize the ItemGroup type and
provide a custom API (along with parsing and serialization code)
that preserves the order. If ItemGroup is the only type with such
a structure (or if you have a handful of such types) then this
approach works quite well. For more information on type customization
see the C++/Tree Mapping Customization Guide:
http://wiki.codesynthesis.com/Tree/Customization_guide
As well as the examples in the examples/cxx/tree/custom/ directory.
In your particular situation you can actually go a step further
and transparently handle the items-ref elements in the customized
parsing code. That is, load the referenced XML documents and add
the items that they contain into the ItemGroup object so that
the users of your object model never have to deal with items-ref.
Let me know if you would like to use this method and would like me
to sketch out how the customization might look.
> 2. Is there a better way to compose the schema such that the produced
> object model will give the effect I'm looking for?
Again, there are two ways that this can be done. In your particular
case you can "overload" the items element to server as both the
container and the reference:
The ItemGroup becomes:
And the XML document becomes:
group1
This schema is a bit "looser" than the original in that the items element
can contain both the content and the ref attribute. Detecting/handling such
cases in your own code is quite easy, thought.
If you would like to preserve the current XML document structure then
there is another way to handle this that only involves modifying the
schema. The idea is to use substitution groups to get rid of the
unbounded choice trick. Here is how it would look:
The resulting ItemGroup class will contain a single sequence of abstract
items. You can then iterate over this sequence and test every object with
dynamic_cast to see whether it is Items or ItemsRef. For more information
on using substitution groups in C++/Tree, see Section 2.11, "Mapping for
xsi:type and Substitution Groups" in the C++/Tree Mapping User Manual:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11
The only potential problem with this approach is the namespace mismatch.
To use substitution groups the elements have to be declared global and
as a result will always be qualified in a schema with a target namespace.
This can be a problem if you schema uses unqualified local elements
(i.e., you don't have elementsFormDefault="qualified" in your xs:schema
element).
> 3. Why with an "unbounded" choice is there not an accessor for the
> ordered sequence of "choiced" elements (I do understand the reason
> for the flat API, but it would be nice for both types of access)?
The other type of API (the one that recreates the compositor structure)
gets quite complex even for simple schemas (for example, in your case
we would need a nested class for the choice compositor which contains
the two elements; the sequence then would be made up of instances of
this type). I believe supporting both styles of API would make the
resulting interface very confusing, not to mention the implementation
complexity that would result in trying to support both styles of access
off a single data representation underneath.
So for C++/Tree we have decided to have the flat API since it covers
majority of use-cases and is much simpler to use. Plus, as you can see
from the above, there are quite a few options when the flat API is not
sufficient.
If you would like to give the other type of API a try, we have used it
for the C++/Hybrid[1] mapping in XSD/e[2], which is our mobile/embedded
systems variant of XSD. XSD/e can also be used for general-purpose
platforms though is it fairly minimal compared to XSD and C++/Tree.
> My current workaround is to access the underlying DOM tree, cycle
> through the elements looking for the element name "items" or
> "item-group", and then "popping" the next object appropriate
> from the items() or items_ref() result sequences.
You can actually get from the DOM node to the corresponding object
model node if the DOM document is associated with the object model.
For more information on this see Section 5.1, "DOM Association" in
the C++/Tree Mapping User Manual:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#5.1
> This works well enough, but is not very maintainable should we change
> the schema, and likely not all that efficient.
This will actually be fairly efficient. The only "penalty" you incur
is the comparison of element names. This can be done faster using
dynamic_cast on the returned object model.
[1] http://www.codesynthesis.com/products/xsde/
[2] http://www.codesynthesis.com/products/xsde/c++/hybrid/
Boris
From Lisa.Preston at jhuapl.edu Mon Mar 22 16:14:58 2010
From: Lisa.Preston at jhuapl.edu (Preston, Lisa K.)
Date: Mon Mar 22 16:16:51 2010
Subject: [xsd-users] Preserving order of elements in unbounded ?
In-Reply-To:
References: <02549B881CC40B4FB07727C0B33B715207DCDDC285@aplesspirit.dom1.jhuapl.edu>
Message-ID: <02549B881CC40B4FB07727C0B33B715207DCDDC2B5@aplesspirit.dom1.jhuapl.edu>
Thanks, Boris. I'll give your suggestions a try and see what the best course of action is.
Appreciate the speedy response!
Lisa
-----Original Message-----
From: Boris Kolpackov [mailto:boris@codesynthesis.com]
Sent: Monday, March 22, 2010 4:19 PM
To: Preston, Lisa K.
Cc: xsd-users@codesynthesis.com
Subject: Re: [xsd-users] Preserving order of elements in unbounded ?
Hi Lisa,
Preston, Lisa K. writes:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> [...]
>
>
> group1
>
>
>
>
>
>
>
>
>
>
>
>
> So to the problem... Running the schema through the C++/Tree tool, the
> object model for the ItemGroup class provides the following "getter"
> methods, with their variety of signatures: groupName(), items_ref(),
> and items(). With only these calls available, I am unable to know
> the order in which these elements appeared in the parsed XML document,
> and can only process either all the elements first, or all
> the elements first. It is critical to my application that
> I be able to know the file-order of the elements, so my questions are:
>
>
> 1. Is there any way to get at this information with C++/Tree
> (even if it is tricky)?
There are two ways to do this without modifying the schema. The first
way is to use the DOM association feature and iterate over the elements
in item-group in the "document order" using DOM. From each DOMElement
inside item-group you can then get pack to the object model node. I
understand that that's the method you are currently using (or a variant
of it).
The other approach would be to customize the ItemGroup type and
provide a custom API (along with parsing and serialization code)
that preserves the order. If ItemGroup is the only type with such
a structure (or if you have a handful of such types) then this
approach works quite well. For more information on type customization
see the C++/Tree Mapping Customization Guide:
http://wiki.codesynthesis.com/Tree/Customization_guide
As well as the examples in the examples/cxx/tree/custom/ directory.
In your particular situation you can actually go a step further
and transparently handle the items-ref elements in the customized
parsing code. That is, load the referenced XML documents and add
the items that they contain into the ItemGroup object so that
the users of your object model never have to deal with items-ref.
Let me know if you would like to use this method and would like me
to sketch out how the customization might look.
> 2. Is there a better way to compose the schema such that the produced
> object model will give the effect I'm looking for?
Again, there are two ways that this can be done. In your particular
case you can "overload" the items element to server as both the
container and the reference:
The ItemGroup becomes:
And the XML document becomes:
group1
This schema is a bit "looser" than the original in that the items element
can contain both the content and the ref attribute. Detecting/handling such
cases in your own code is quite easy, thought.
If you would like to preserve the current XML document structure then
there is another way to handle this that only involves modifying the
schema. The idea is to use substitution groups to get rid of the
unbounded choice trick. Here is how it would look:
The resulting ItemGroup class will contain a single sequence of abstract
items. You can then iterate over this sequence and test every object with
dynamic_cast to see whether it is Items or ItemsRef. For more information
on using substitution groups in C++/Tree, see Section 2.11, "Mapping for
xsi:type and Substitution Groups" in the C++/Tree Mapping User Manual:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11
The only potential problem with this approach is the namespace mismatch.
To use substitution groups the elements have to be declared global and
as a result will always be qualified in a schema with a target namespace.
This can be a problem if you schema uses unqualified local elements
(i.e., you don't have elementsFormDefault="qualified" in your xs:schema
element).
> 3. Why with an "unbounded" choice is there not an accessor for the
> ordered sequence of "choiced" elements (I do understand the reason
> for the flat API, but it would be nice for both types of access)?
The other type of API (the one that recreates the compositor structure)
gets quite complex even for simple schemas (for example, in your case
we would need a nested class for the choice compositor which contains
the two elements; the sequence then would be made up of instances of
this type). I believe supporting both styles of API would make the
resulting interface very confusing, not to mention the implementation
complexity that would result in trying to support both styles of access
off a single data representation underneath.
So for C++/Tree we have decided to have the flat API since it covers
majority of use-cases and is much simpler to use. Plus, as you can see
from the above, there are quite a few options when the flat API is not
sufficient.
If you would like to give the other type of API a try, we have used it
for the C++/Hybrid[1] mapping in XSD/e[2], which is our mobile/embedded
systems variant of XSD. XSD/e can also be used for general-purpose
platforms though is it fairly minimal compared to XSD and C++/Tree.
> My current workaround is to access the underlying DOM tree, cycle
> through the elements looking for the element name "items" or
> "item-group", and then "popping" the next object appropriate
> from the items() or items_ref() result sequences.
You can actually get from the DOM node to the corresponding object
model node if the DOM document is associated with the object model.
For more information on this see Section 5.1, "DOM Association" in
the C++/Tree Mapping User Manual:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#5.1
> This works well enough, but is not very maintainable should we change
> the schema, and likely not all that efficient.
This will actually be fairly efficient. The only "penalty" you incur
is the comparison of element names. This can be done faster using
dynamic_cast on the returned object model.
[1] http://www.codesynthesis.com/products/xsde/
[2] http://www.codesynthesis.com/products/xsde/c++/hybrid/
Boris
From katalin.roman at gmail.com Tue Mar 23 04:22:16 2010
From: katalin.roman at gmail.com (Catalin Roman)
Date: Tue Mar 23 04:22:26 2010
Subject: [xsd-users] Disable Xerces-C Unique Particle Attribution check
In-Reply-To:
References: <2867232e1003220554u5f46b2e5gb97f287f859e420e@mail.gmail.com>
Message-ID: <2867232e1003230122u5a03c452h7bb038c961b0d556@mail.gmail.com>
Thank you for the quick reply, even if I don't like the response :). Also,
thanks for the union hint.
Have a nice day,
Catalin
On Mon, Mar 22, 2010 at 5:48 PM, Boris Kolpackov wrote:
> Hi Catalin,
>
> Catalin Roman writes:
>
> > I am trying to use XSD(xsd-3.2.0-i686-windows) in VS2008, with
> > Xerces-C(xerces-c-3.1.0-x86-windows-vc-9.0) to compile a schema that
> > violates UPA; the schema fragment that's responsible for this is:
> >
> >
> >
> >
> >
>
> To be precise, this fragment violates the "Consistent Element Declaration"
> rule rather than the "Unique Particle Attribution" rule. In XML Schema
> elements within the same type with the same name should have the same
> type.
>
>
> > I would like to ask if I can "disable" the UPA check performed by the
> > Xerces-C parser and if it's possible, how can I achieve that?
>
> No, unfortunately it is not possible to disable the checking of the
> above fragment.
>
>
> > Any other hints or workarounds are also most welcomed.
>
> The only way forward that I can think of is to fix the schema. You could
> use a single 'value' element whose type is a union of boolean and byte
> to achieve the above behavior in a legal way.
>
> Boris
>
From angelo at smartrm.com Tue Mar 23 12:24:42 2010
From: angelo at smartrm.com (Angelo Difino)
Date: Tue Mar 23 12:24:49 2010
Subject: [xsd-users] Xsd crash
In-Reply-To:
References:
<4BA0CCEE.3000302@smartrm.com>
Message-ID: <4BA8EB4A.2030706@smartrm.com>
Hi Boris and all,
We've some troubles using the xsd's headers on a macosx machine:
when we try to compile some our classes that use the xsd heade,r with the
define -DXP_MACOSX, we had got some troubles related to the
_nil_ symbol defined in literals.ixx.
Seems that macosx somewhere define the same symbol and we really
can't found it out.
Does anybody has any suggestion about how to workaround this trouble?
Any suggestions are more than welcome!
Best,
Angelo
Trace is:
/bin/sh ../libtool --tag=CXX --mode=compile g++ -arch i386
-DHAVE_CONFIG_H -I. -I.. -DXP_MACOSX -fshort-wchar -pthread -O0 -ggdb
-I. -DXP_UNIX -I/Users/dade/smartrm/mxm_workspace/smartrm-cpp/src
-I/Users/dade/smartrm/mxm_workspace/mxm-cpp/include
-I/Users/dade/smartrm/mxm_workspace/mxm-cpp/src -MT
libsmartrm_plugin_la-npp_gate.lo -MD -MP -MF
.deps/libsmartrm_plugin_la-npp_gate.Tpo -c -o
libsmartrm_plugin_la-npp_gate.lo `test -f 'npp_gate.cpp' || echo
'./'`npp_gate.cpp
libtool: compile: g++ -arch i386 -DHAVE_CONFIG_H -I. -I.. -DXP_MACOSX
-fshort-wchar -pthread -O0 -ggdb -I. -DXP_UNIX
-I/Users/dade/smartrm/mxm_workspace/smartrm-cpp/src
-I/Users/dade/smartrm/mxm_workspace/mxm-cpp/include
-I/Users/dade/smartrm/mxm_workspace/mxm-cpp/src -MT
libsmartrm_plugin_la-npp_gate.lo -MD -MP -MF
.deps/libsmartrm_plugin_la-npp_gate.Tpo -c npp_gate.cpp -fno-common
-DPIC -o .libs/libsmartrm_plugin_la-npp_gate.o
In file included from
/Users/dade/smartrm/install/include/xsd/cxx/tree/parsing.txx:12,
from
/Users/dade/smartrm/install/include/xsd/cxx/tree/parsing.hxx:9,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/configuration/xmlschema.hxx:66,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/configuration/mxmConfiguration.hxx:58,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/configuration/MXMParameters.h:27,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/MXM.h:27,
from smartrm_comp-impl.h:30,
from plugin.h:50,
from npp_gate.cpp:43:
/Users/dade/smartrm/install/include/xsd/cxx/xml/bits/literals.hxx:47:
error: expected unqualified-id before '__null'
/Users/dade/smartrm/install/include/xsd/cxx/xml/bits/literals.hxx:47:
error: expected initializer before '__null'
In file included from
/Users/dade/smartrm/install/include/xsd/cxx/xml/bits/literals.hxx:83,
from
/Users/dade/smartrm/install/include/xsd/cxx/tree/parsing.txx:12,
from
/Users/dade/smartrm/install/include/xsd/cxx/tree/parsing.hxx:9,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/configuration/xmlschema.hxx:66,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/configuration/mxmConfiguration.hxx:58,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/configuration/MXMParameters.h:27,
from
/Users/dade/smartrm/mxm_workspace/mxm-cpp/src/mxm_core/MXM.h:27,
from smartrm_comp-impl.h:30,
from plugin.h:50,
from npp_gate.cpp:43:
/Users/dade/smartrm/install/include/xsd/cxx/xml/bits/literals.ixx:76:
error: expected unqualified-id before '__null'
/Users/dade/smartrm/install/include/xsd/cxx/xml/bits/literals.ixx:76:
error: expected initializer before '__null'
npp_gate.cpp: In function 'NPError NPP_GetValue(NPP_t*, NPPVariable,
void*)':
npp_gate.cpp:165: warning: deprecated conversion from string constant to
'char*'
npp_gate.cpp:168: warning: deprecated conversion from string constant to
'char*'
make: *** [libsmartrm_plugin_la-npp_gate.lo] Error 1
From boris at codesynthesis.com Wed Mar 24 15:18:54 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 24 15:07:44 2010
Subject: [xsd-users] Xsd crash
In-Reply-To: <4BA8EB4A.2030706@smartrm.com>
References:
<4BA0CCEE.3000302@smartrm.com>
<4BA8EB4A.2030706@smartrm.com>
Message-ID:
Hi Angelo,
Angelo Difino writes:
> We've some troubles using the xsd's headers on a macosx machine:
> when we try to compile some our classes that use the xsd header,
> with the define -DXP_MACOSX, we had got some troubles related to
> the _nil_ symbol defined in literals.ixx.
Looks like some headers on OS X define nil as a macro. I have
renamed the function to use a less common name. Can you apply
this patch and see if it helps (the changes are only in libxsd):
http://scm.codesynthesis.com/?p=xsd/xsd.git;a=patch;h=7207d957dcc2425fc89bab11efd6c5941d630956;hp=49129dd75396f109664aa0f2fa9c9d67ab464b80
Boris
From barrie.kovish at singularsoftware.com Sat Mar 27 22:14:14 2010
From: barrie.kovish at singularsoftware.com (Barrie Kovish)
Date: Mon Mar 29 11:14:47 2010
Subject: [xsd-users] Non intrusive data structures
Message-ID: <5099AD0F-C710-49CA-B138-E46C8223AD6B@singularsoftware.com>
I'm using the XSD tree mapping. I'd like to be able to move elements around the XML document without changing the address of the elements. For example suppose I have
Red
Blue
Red
Blue
In code I want to keep a list of pointers to all Red cars. But if I move car id 1 from dealer A to dealer B the address of the XSD data structure will change. Is there a way to generate XSD classes which save the Car elements as pointers?
Thanks,
Barrie
From boris at codesynthesis.com Mon Mar 29 11:33:45 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Mon Mar 29 11:22:13 2010
Subject: [xsd-users] Non intrusive data structures
In-Reply-To: <5099AD0F-C710-49CA-B138-E46C8223AD6B@singularsoftware.com>
References: <5099AD0F-C710-49CA-B138-E46C8223AD6B@singularsoftware.com>
Message-ID:
Hi Barrie,
Barrie Kovish writes:
> I'm using the XSD tree mapping. I'd like to be able to move
> elements around the XML document without changing the address
> of the elements. For example suppose I have
>
>
>
>
> Red
>
>
>
>
> Blue
>
>
>
>
>
>
>
> Red
>
>
>
>
> Blue
>
>
>
>
> In code I want to keep a list of pointers to all Red cars. But if I
> move car id 1 from dealer A to dealer B the address of the XSD data
> structure will change. Is there a way to generate XSD classes which
> save the Car elements as pointers?
If you are using the beta for the upcoming 3.3.0 release[1], then you
can detach a sub-tree from the object model and then re-attach it at
a different point, all without reallocations and thus without changing
the sub-tree's memory location. Here is the relevant part from the
NEWS file:
New option, --generate-detach, triggers the generation of detach
functions for required elements and attributes. For optional and
sequence cardinalities the detach functions are now provided by the
respective containers even without this option. These functions, for
example, allow one to move sub-trees in the object model either within
the same tree or between different trees without copying. For more
information, refer to Section 2.8 "Mapping for Local Elements and
Attributes" in the C++/Tree Mapping User Manual.
[The C++/Tree Mapping User Manual is in the package's documentation/
directory; the online version is still for 3.2.0.]
[1] http://www.codesynthesis.com/products/xsd/download.xhtml
Boris
From erik.sjolund at gmail.com Tue Mar 30 15:00:51 2010
From: erik.sjolund at gmail.com (Erik =?ISO-8859-1?Q?Sj=F6lund?=)
Date: Tue Mar 30 15:01:15 2010
Subject: [xsd-users] mapping between xsd file and xml file
Message-ID: <1269975651.1758.36.camel@erik-desktop>
Could CodeSynthesis XSD or CodeSynthesis XSD/e be used for this:
A GUI application showing an XML file in one window and showing the
corresponding W3C XML Schema in another window. The data trees could
both be represented with something like
http://qt.nokia.com/doc/4.6/qtreewidget.htm
A mouse click in one of the trees would mark the corresponding place in
the other tree.
How can you map between the two trees?
cheers,
Erik Sj?lund
From boris at codesynthesis.com Wed Mar 31 09:46:42 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 31 09:37:36 2010
Subject: [xsd-users] mapping between xsd file and xml file
In-Reply-To: <1269975651.1758.36.camel@erik-desktop>
References: <1269975651.1758.36.camel@erik-desktop>
Message-ID:
Hi Erik,
Erik Sj?lund writes:
> Could CodeSynthesis XSD or CodeSynthesis XSD/e be used for this:
>
> A GUI application showing an XML file in one window and showing the
> corresponding W3C XML Schema in another window. The data trees could
> both be represented with something like
> http://qt.nokia.com/doc/4.6/qtreewidget.htm
>
> A mouse click in one of the trees would mark the corresponding place in
> the other tree.
Neither XSD nor XSD/e will really be of much help here. What you are
looking for is an XML Schema validator with PSVI (Post-Schema Validation
Infoset) that would allow you to get from an XML construct (e.g., element,
attribute, etc.) to the corresponding XML Schema construct that was used
to validate this XML construct. The closest you can get is probably
Xerces-C++. Though getting from the XML Schema construct to file/line
in the .xsd file might be a challenge.
If you decide to try Xerces-C++ and have further questions about it,
the better place to direct them would be the project's mailing lists:
http://xerces.apache.org/xerces-c/mailing-lists.html
Boris
From barrie.kovish at singularsoftware.com Wed Mar 31 12:54:44 2010
From: barrie.kovish at singularsoftware.com (Barrie Kovish)
Date: Wed Mar 31 12:55:15 2010
Subject: [xsd-users] Non intrusive data structures
In-Reply-To:
References: <5099AD0F-C710-49CA-B138-E46C8223AD6B@singularsoftware.com>
Message-ID:
Hi Boris,
Thanks for the reply.
Looking at the documentation it looks like we should be able to remove an element from one sequence and place it in a second sequence without changing the address of other elements in either sequence. That would be exactly what we need. Do I understand this correctly?
Do you have a target date for beta 3.3.0 going into general release?
Thanks,
Barrie
On 2010-03-29, at 8:33 AM, Boris Kolpackov wrote:
> Hi Barrie,
>
> Barrie Kovish writes:
>
>> I'm using the XSD tree mapping. I'd like to be able to move
>> elements around the XML document without changing the address
>> of the elements. For example suppose I have
>>
>>
>>
>>
>> Red
>>
>>
>>
>>
>> Blue
>>
>>
>>
>>
>>
>>
>>
>> Red
>>
>>
>>
>>
>> Blue
>>
>>
>>
>>
>> In code I want to keep a list of pointers to all Red cars. But if I
>> move car id 1 from dealer A to dealer B the address of the XSD data
>> structure will change. Is there a way to generate XSD classes which
>> save the Car elements as pointers?
>
> If you are using the beta for the upcoming 3.3.0 release[1], then you
> can detach a sub-tree from the object model and then re-attach it at
> a different point, all without reallocations and thus without changing
> the sub-tree's memory location. Here is the relevant part from the
> NEWS file:
>
> New option, --generate-detach, triggers the generation of detach
> functions for required elements and attributes. For optional and
> sequence cardinalities the detach functions are now provided by the
> respective containers even without this option. These functions, for
> example, allow one to move sub-trees in the object model either within
> the same tree or between different trees without copying. For more
> information, refer to Section 2.8 "Mapping for Local Elements and
> Attributes" in the C++/Tree Mapping User Manual.
>
> [The C++/Tree Mapping User Manual is in the package's documentation/
> directory; the online version is still for 3.2.0.]
>
> [1] http://www.codesynthesis.com/products/xsd/download.xhtml
>
> Boris
From boris at codesynthesis.com Wed Mar 31 16:37:40 2010
From: boris at codesynthesis.com (Boris Kolpackov)
Date: Wed Mar 31 16:28:37 2010
Subject: [xsd-users] Non intrusive data structures
In-Reply-To:
References: <5099AD0F-C710-49CA-B138-E46C8223AD6B@singularsoftware.com>
Message-ID:
Hi Barrie,
Barrie Kovish writes:
> Looking at the documentation it looks like we should be able
> to remove an element from one sequence and place it in a second
> sequence without changing the address of other elements in either
> sequence. That would be exactly what we need. Do I understand this
> correctly?
Yes, that's correct.
> Do you have a target date for beta 3.3.0 going into general release?
We were originally planning to release it by mid-March but then the
VC++ 2010 release was scheduled for April 12 so we decided to postpone
the XSD release in order to test everything with the final VC++ build
as well as add the project/solution files. So the final XSD 3.3.0
release should be published by the end of April.
Boris
From barrie.kovish at singularsoftware.com Wed Mar 31 17:04:52 2010
From: barrie.kovish at singularsoftware.com (Barrie Kovish)
Date: Wed Mar 31 17:05:24 2010
Subject: [xsd-users] Non intrusive data structures
In-Reply-To:
References: <5099AD0F-C710-49CA-B138-E46C8223AD6B@singularsoftware.com>
Message-ID: <37CA3BD6-C944-4508-84CA-EF1EBE0CB6AD@singularsoftware.com>
Is the existing beta stable with VC++ 2008?
Thanks,
Barrie
On 2010-03-31, at 1:37 PM, Boris Kolpackov wrote:
> Hi Barrie,
>
> Barrie Kovish writes:
>
>> Looking at the documentation it looks like we should be able
>> to remove an element from one sequence and place it in a second
>> sequence without changing the address of other elements in either
>> sequence. That would be exactly what we need. Do I understand this
>> correctly?
>
> Yes, that's correct.
>
>
>> Do you have a target date for beta 3.3.0 going into general release?
>
> We were originally planning to release it by mid-March but then the
> VC++ 2010 release was scheduled for April 12 so we decided to postpone
> the XSD release in order to test everything with the final VC++ build
> as well as add the project/solution files. So the final XSD 3.3.0
> release should be published by the end of April.
>
> Boris