Hi Werner,
As said, I have a class that I use to (un)marshall MathML and which works
fine.
I had the same kind of things to do again, unmarshall an XML (SVG) String
read from the database, set it in my object and marshall everything, so I
wanted to re-use the above mentionned code.
I reduced SVG to the minimal fragment generating the problem:
SVGGlyph.unmarshal(new StringReader("" +
"<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"no\"?>\n" +
"<svg>\n" +
" <defs\n" +
" id=\"defs4\">\n" +
" </defs>\n" +
" <g\n" +
" style=\"opacity:1\"\n" +
" id=\"layer2\">\n" +
" </g>\n" +
"</svg>")));
I get the error:
Exception in thread "main" java.lang.RuntimeException: element "g" occurs
more than once.
location: /svg/g{file: [not available]; line: 9; column: 7}
...
Caused by: element "g" occurs more than once.
location: /svg/g{file: [not available]; line: 9; column: 7}
...
Caused by: ValidationException: element "g" occurs more than once.
location: /svg/g
If I remove <defs...../defs> or <g..../g> no problem, but both together it
didn't work.
I would really like to know what I did wrong, so thanks for any idea!
Melanie
> Melanie,
>
> can you please remind me (us) as to what the problem about the SVG stuff
> was ?
>
> Werner
>
> Melanie Courtot wrote:
>> Hi,
>>
>> I had the same problem as I wanted to marshal some MathML contained by
>> an
>> object.
>> I managed to have something working by using a Math class which contains
>> a
>> java.lang.Object _anyObject; which can then be used by Castor.
>>
>> This worked fine as well to unmarshall the MathML.
>> So I do a
>> Math.unmarshal(new StringReader(mathML));
>> to unmarshall the mathml from the database, set it in my object and then
>> marshall the whole object with castor.
>>
>> I had the problem a second time with some SVG (I posted on the list on
>> 06/02): I wanted to re use the same system but from the unmarshalling it
>> was complaining "element occurs more than once".
>> I didn't get it to work quickly, so I just used jdom to export my basic
>> object instead of castor.
>>
>> Sorry I can't be of more help here, but please post back if you get
>> something working!
>>
>> melanie
>>
>>
>>> I'm curious if there is a way to insert XML into an object being
>>> marshaled out by Castor.
>>>
>>> Let's say I have just some object that I am inserting into an object
>>> that is generated by Castor from an XSD, and that XSD had an xs:any in
>>> it. So my object will have a "setAnyObject" function in it.
>>> Something like
>>> <xs:element name="myXmlObj">
>>> <xs:complexType>
>>> <xs:sequence>
>>> <xs:any minOccurs="0"/>
>>> </xs:sequence>
>>> </xs:complexType>
>>> </xs:element>
>>>
>>> If I wanted my output to be
>>> <myXmlObj>
>>> <someDynamic>content</someDynamic>
>>> <someDynamic2>content</someDynamic2>
>>> </myXmlObj>
>>>
>>> How could I do this? Would I have to generate my own
>>> XMLClassDescriptor? Is there an easy way to do this, where I could do
>>> something like
>>> myXmlObj.setAnyObject("MyContent that won't be encoded");? So that the
>>> < and > won't show up as < and > in the marshaled output?
>>>
>>>
>>>
>>> Thank you,
>>> Zach
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email