simple-support Mailing List for Simple (Page 13)
Brought to you by:
niallg
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(13) |
May
(13) |
Jun
(27) |
Jul
(4) |
Aug
(14) |
Sep
(7) |
Oct
|
Nov
(6) |
Dec
(24) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
(21) |
Mar
(10) |
Apr
(15) |
May
(24) |
Jun
(24) |
Jul
(30) |
Aug
(5) |
Sep
(19) |
Oct
(27) |
Nov
(16) |
Dec
(24) |
| 2009 |
Jan
(34) |
Feb
(24) |
Mar
(35) |
Apr
(26) |
May
(8) |
Jun
(17) |
Jul
(28) |
Aug
(31) |
Sep
(36) |
Oct
(35) |
Nov
(20) |
Dec
(16) |
| 2010 |
Jan
(40) |
Feb
(21) |
Mar
(47) |
Apr
(45) |
May
(34) |
Jun
(68) |
Jul
(46) |
Aug
(39) |
Sep
(47) |
Oct
(20) |
Nov
(42) |
Dec
(13) |
| 2011 |
Jan
(41) |
Feb
(16) |
Mar
(32) |
Apr
(44) |
May
(28) |
Jun
(35) |
Jul
(37) |
Aug
(33) |
Sep
(60) |
Oct
(20) |
Nov
(35) |
Dec
(23) |
| 2012 |
Jan
(34) |
Feb
(23) |
Mar
(34) |
Apr
(21) |
May
(48) |
Jun
(24) |
Jul
(31) |
Aug
(39) |
Sep
(25) |
Oct
(10) |
Nov
(27) |
Dec
(28) |
| 2013 |
Jan
(32) |
Feb
(24) |
Mar
(24) |
Apr
(9) |
May
(4) |
Jun
(6) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
(5) |
Nov
(1) |
Dec
(12) |
| 2014 |
Jan
(14) |
Feb
(16) |
Mar
(5) |
Apr
(3) |
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
| 2015 |
Jan
(3) |
Feb
(15) |
Mar
(7) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
|
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Arthur E. <ar...@bl...> - 2012-09-06 16:51:38
|
I've posted this question onto Stackoverflow, but thought I should post it here to see if anyone has an answer: http://stackoverflow.com/questions/12298673/how-do-i-use-the-value-of-an-xml-element-when-setting-the-path-in-the-java-simpl I have the following XML: <rdr> <details> <detail> <name>version</name> <value>15.0</value> </detail> <detail> <name>resolution</name> <value>1080X1920</value> </detail> </details> </rdr> and I am marshalling this into the following Java bean: import org.simpleframework.xml.Element; import org.simpleframework.xml.Path; import org.simpleframework.xml.Root; @Root(name = "rdr", strict = false) public class XmlBean { @Path("details/detail[1]") @Element(name = "value") private String version; @Path("details/detail[2]") @Element(name = "value") private String resolution; public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getResolution() { return resolution; } public void setResolution(String resolution) { this.resolution = resolution; } } I am using simple XML, version 2.6.6. However, what I would like to do, is use the name elements in the XPath. For example, rather than using the Path "details/detail[1]" I would like to use "details/detail[name=version]". This doesn't work and I get an org.simpleframework.xml.core.PathException: Invalid index for path exception returned. I have tried surrounding version with ' to no avail. >From what I understand of XPath, this is the correct syntax: http://www.w3schools.com/xpath/xpath_syntax.asp Can anyone confirm that this looks correct? I've looked into the source code for the simple xml library and it is handling the XPath processing by itself without using a 3rd party library. I can see why it doesn't work, because it is only accepting digits and will throw that exception for any char that isn't a digit. I'm tempted to fix the library, but suspect that I am doing something wrong and that there may be another annotation that I should be using or some other syntax. Is there another annotation that I can use to achieve what I am trying to do? Is it possible to do what I am trying to do using Simple? |
|
From: Niall G. <gal...@ya...> - 2012-09-02 13:18:27
|
see @Text --- On Sun, 2/9/12, haiko van der Schaaf <hvd...@gm...> wrote: From: haiko van der Schaaf <hvd...@gm...> Subject: [Simple-support] attribute mapping To: sim...@li... Received: Sunday, 2 September, 2012, 5:23 AM Hi all, I am trying to map the following piece of XML with an attribute. <example read="false> simple xml example </example> Reading the simple site and browsing the mail achives does not give a clue how to map this to a java object. Maybe I missed something. Does anyone has suggestions? Thanks, Haiko van der Schaaf -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: haiko v. d. S. <hvd...@gm...> - 2012-09-02 12:23:24
|
Hi all, I am trying to map the following piece of XML with an attribute. <example read="false> simple xml example </example> Reading the simple site and browsing the mail achives does not give a clue how to map this to a java object. Maybe I missed something. Does anyone has suggestions? Thanks, Haiko van der Schaaf |
|
From: amit.shipra <ami...@rb...> - 2012-08-31 13:38:58
|
Not sure if this is a possibility or it already exists but if somehow we could reverse engineer (generate) the annotated classes from a given XSD - that would have been a tremendously helpful tool. Wish if it would have been there - it could have solved lots of mundane work. Apologies if its already there but could not find one. Please post link if its out there. Thanks, -- View this message in context: http://old.nabble.com/Wishlist%3A-Reverse-engineer-tool-from-XSD-tp34373695p34373695.html Sent from the Simple XML Serialization mailing list archive at Nabble.com. |
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-28 00:56:05
|
All it will do is write to the provided Writer or OutputStream, you can if you wish add a BufferedWriter or BufferedOutputStream or evey a MyBufferedOutputStreamImpl, its up yo you really. From: Danny Sinang [mailto:d.s...@gm...] Sent: Tuesday, 28 August 2012 12:36 AM To: sim...@li... Subject: [Simple-support] Flushing deserialized data Hi, We're using simpleXML to deserialize data for our Analytics API queries. There is a possibility that customers can run a query that returns a huge number of XML nodes, causing a rather long wait and large memory consumption on the application server. We are therefore considering some sort of buffering wherein we fetch like 100 XML documents from our XML backend and then immediately send them to the customer. Then we fetch the next 100 documents and so on. Is simpleXML capable of such "buffering / flushing" ? Regards, Danny |
|
From: Danny S. <d.s...@gm...> - 2012-08-27 14:36:23
|
Hi, We're using simpleXML to deserialize data for our Analytics API queries. There is a possibility that customers can run a query that returns a huge number of XML nodes, causing a rather long wait and large memory consumption on the application server. We are therefore considering some sort of buffering wherein we fetch like 100 XML documents from our XML backend and then immediately send them to the customer. Then we fetch the next 100 documents and so on. Is simpleXML capable of such "buffering / flushing" ? Regards, Danny |
|
From: Niall G. <gal...@ya...> - 2012-08-23 20:55:47
|
This is part of Spring Android, not Simple. --- On Thu, 23/8/12, Jason La <ja...@gm...> wrote: > From: Jason La <ja...@gm...> > Subject: [Simple-support] SimpleXmlHttpMessageConverter missing? > To: sim...@li... > Received: Thursday, 23 August, 2012, 11:03 AM > Hi, > > I'm trying to use SimpleXmlHttpMessageConverter with Spring > 3, and it > looks like SimpleXmlHttpMessageConverter is no longer part > of Simple? > > Am I configuring it correctly? > > <dependency> > > <groupId>org.simpleframework</groupId> > > <artifactId>simple-xml</artifactId> > <version>2.6.6</version> > </dependency> > > Code: > > RestTemplate restTemplate = new RestTemplate(); > > restTemplate.getMessageConverters().add(new > SimpleXmlHttpMessageConverter()); > > The compiler can't find SimpleXmlHttpMessageConverter(). > > Any help is much appreciated. > > -- > =============== > Jason La > ja...@gm... > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's > security and > threat landscape has changed and how IT managers can > respond. Discussions > will include endpoint security, mobile security and the > latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: Jason La <ja...@gm...> - 2012-08-23 18:04:06
|
Hi,
I'm trying to use SimpleXmlHttpMessageConverter with Spring 3, and it
looks like SimpleXmlHttpMessageConverter is no longer part of Simple?
Am I configuring it correctly?
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.6.6</version>
</dependency>
Code:
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter());
The compiler can't find SimpleXmlHttpMessageConverter().
Any help is much appreciated.
--
===============
Jason La
ja...@gm...
|
|
From: Niall G. <gal...@ya...> - 2012-08-22 11:48:12
|
Check out articles section on the website, this is one of use perhaps? http://blog.ribomation.com/2011/07/android-and-xml/ --- On Wed, 22/8/12, Andrew Spinner <and...@ti...> wrote: From: Andrew Spinner <and...@ti...> Subject: [Simple-support] Monitoring deserialisation progress To: sim...@li... Received: Wednesday, 22 August, 2012, 4:04 AM Hello, Is there any way to monitor the progress of the deserialisation process? Form a user perspective, it would ideally be useful for the Persister to assess the size of the XML file and notify a listener of the percentage complete/remaining. I don't immediately see an easy way to implement it, but presumably it would involve attaching listeners to the Persister object. In any case, it's a suggestion for a possible new feature at some stage. Thanks, Andrew -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Dawid W. <daw...@gm...> - 2012-08-22 11:15:07
|
If you know the size of the input (and can access it) then wrap your input stream or input reader and count the bytes read so far yourself, possibly calling back a hook every few kilobytes. In general this isn't possible since streaming access doesn't have the notion of "size". For inputs such as files or in-memory buffers you can do it yourself. Dawid On Wed, Aug 22, 2012 at 1:04 PM, Andrew Spinner <and...@ti...> wrote: > Hello, > > Is there any way to monitor the progress of the deserialisation process? > Form a user perspective, it would ideally be useful for the Persister to > assess the size of the XML file and notify a listener of the percentage > complete/remaining. > > I don't immediately see an easy way to implement it, but presumably it would > involve attaching listeners to the Persister object. > > In any case, it's a suggestion for a possible new feature at some stage. > > Thanks, > > Andrew > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: Andrew S. <and...@ti...> - 2012-08-22 11:05:05
|
Hello, Is there any way to monitor the progress of the deserialisation process? Form a user perspective, it would ideally be useful for the Persister to assess the size of the XML file and notify a listener of the percentage complete/remaining. I don't immediately see an easy way to implement it, but presumably it would involve attaching listeners to the Persister object. In any case, it's a suggestion for a possible new feature at some stage. Thanks, Andrew |
|
From: M. D. <m....@we...> - 2012-08-21 13:50:01
|
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Thanks a lot for both answers. It works now!<br/>
@Nial: you're right. I need to create myown TreeStrategy too.</div><div><br/></div><div>Regards,<br/></div><div>Maria<br/></div><div><br/></div><div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;">
<b>Gesendet:</b> Dienstag, 21. August 2012 um 04:05 Uhr<br/>
<b>Von:</b> "Niall Gallagher - Yieldbroker" <Nia...@yi...><br/>
<b>An:</b> "Maxim Solodovnik" <sol...@gm...><br/>
<b>Cc:</b> "M. D." <m....@we...>, "sim...@li..." <sim...@li...><br/>
<b>Betreff:</b> RE: [Simple-support] Deserializing Style-Tag
<br/></div>
<div name="quoted-content">
Yes it can, but you will have to create your own TreeStrategy. In Simple the "class" attribute is the default attribute used to store the Java class name. If you want to use this attribute you can do this.<br/>
<br/>
TreeStrategy ts = new TreeStrategy("myIdAttributeName", "myClassAttributeName") // Default is TreeStrategy("id", "class")<br/>
Persister p = new Persister(ts);<br/>
<br/>
This will allow you yo use the "class" attribute.<br/>
<br/>
-----Original Message-----<br/>
From: Maxim Solodovnik [mailto:sol...@gm...] <br/>
Sent: Tuesday, 21 August 2012 11:55 AM<br/>
To: Niall Gallagher - Yieldbroker<br/>
Cc: M. D.; sim...@li...<br/>
Subject: Re: [Simple-support] Deserializing Style-Tag<br/>
<br/>
I believe it is something like<br/>
<br/>
<div class="button" style="..." ...></div><br/>
<br/>
can not be mapped directly to<br/>
@Root<br/>
class Div {<br/>
private String class; // <-- error is here }<br/>
<br/>
can easily be implemented as<br/>
<br/>
@Root<br/>
class Div {<br/>
@Attribute(name="class")<br/>
private String cssClass; // <-- no error }<br/>
<br/>
something like this<br/>
<br/>
On Tue, Aug 21, 2012 at 5:47 AM, Niall Gallagher - Yieldbroker <Nia...@yi...> wrote:<br/>
> Can you provide an example, I am not sure what you are talking about.<br/>
><br/>
><br/>
><br/>
> From: M. D. [mailto:m....@we...]<br/>
> Sent: Monday, 20 August 2012 9:37 PM<br/>
> To: sim...@li...<br/>
> Subject: [Simple-support] Deserializing Style-Tag<br/>
><br/>
><br/>
><br/>
> Hello,<br/>
><br/>
><br/>
><br/>
> I would like to deserialize Style-tag of html with Simple. I noticed <br/>
> that the attribute "class" can't be mapped to an Instance variable in java.<br/>
><br/>
> Is there any solution for that?<br/>
><br/>
><br/>
><br/>
> Thanks in advance<br/>
><br/>
><br/>
> ----------------------------------------------------------------------<br/>
> --------<br/>
> Live Security Virtual Conference<br/>
> Exclusive live event will cover all the ways today's security and <br/>
> threat landscape has changed and how IT managers can respond. <br/>
> Discussions will include endpoint security, mobile security and the <br/>
> latest in malware threats. <br/>
> <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br/>
> _______________________________________________<br/>
> Simple-support mailing list<br/>
> Sim...@li...<br/>
> <a href="https://lists.sourceforge.net/lists/listinfo/simple-support" target="_blank">https://lists.sourceforge.net/lists/listinfo/simple-support</a><br/>
><br/>
<br/>
<br/>
<br/>
--<br/>
WBR<br/>
Maxim aka solomax<br/>
</div>
</div><div><br/><br/></div></div></body></html>
|
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-21 02:06:06
|
Yes it can, but you will have to create your own TreeStrategy. In Simple the "class" attribute is the default attribute used to store the Java class name. If you want to use this attribute you can do this.
TreeStrategy ts = new TreeStrategy("myIdAttributeName", "myClassAttributeName") // Default is TreeStrategy("id", "class")
Persister p = new Persister(ts);
This will allow you yo use the "class" attribute.
-----Original Message-----
From: Maxim Solodovnik [mailto:sol...@gm...]
Sent: Tuesday, 21 August 2012 11:55 AM
To: Niall Gallagher - Yieldbroker
Cc: M. D.; sim...@li...
Subject: Re: [Simple-support] Deserializing Style-Tag
I believe it is something like
<div class="button" style="..." ...></div>
can not be mapped directly to
@Root
class Div {
private String class; // <-- error is here }
can easily be implemented as
@Root
class Div {
@Attribute(name="class")
private String cssClass; // <-- no error }
something like this
On Tue, Aug 21, 2012 at 5:47 AM, Niall Gallagher - Yieldbroker <Nia...@yi...> wrote:
> Can you provide an example, I am not sure what you are talking about.
>
>
>
> From: M. D. [mailto:m....@we...]
> Sent: Monday, 20 August 2012 9:37 PM
> To: sim...@li...
> Subject: [Simple-support] Deserializing Style-Tag
>
>
>
> Hello,
>
>
>
> I would like to deserialize Style-tag of html with Simple. I noticed
> that the attribute "class" can't be mapped to an Instance variable in java.
>
> Is there any solution for that?
>
>
>
> Thanks in advance
>
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
--
WBR
Maxim aka solomax
|
|
From: Maxim S. <sol...@gm...> - 2012-08-21 01:55:16
|
I believe it is something like
<div class="button" style="..." ...></div>
can not be mapped directly to
@Root
class Div {
private String class; // <-- error is here
}
can easily be implemented as
@Root
class Div {
@Attribute(name="class")
private String cssClass; // <-- no error
}
something like this
On Tue, Aug 21, 2012 at 5:47 AM, Niall Gallagher - Yieldbroker
<Nia...@yi...> wrote:
> Can you provide an example, I am not sure what you are talking about.
>
>
>
> From: M. D. [mailto:m....@we...]
> Sent: Monday, 20 August 2012 9:37 PM
> To: sim...@li...
> Subject: [Simple-support] Deserializing Style-Tag
>
>
>
> Hello,
>
>
>
> I would like to deserialize Style-tag of html with Simple. I noticed that
> the attribute "class" can't be mapped to an Instance variable in java.
>
> Is there any solution for that?
>
>
>
> Thanks in advance
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
--
WBR
Maxim aka solomax
|
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-20 22:48:00
|
Can you provide an example, I am not sure what you are talking about. From: M. D. [mailto:m....@we...] Sent: Monday, 20 August 2012 9:37 PM To: sim...@li... Subject: [Simple-support] Deserializing Style-Tag Hello, I would like to deserialize Style-tag of html with Simple. I noticed that the attribute "class" can't be mapped to an Instance variable in java. Is there any solution for that? Thanks in advance |
|
From: M. D. <m....@we...> - 2012-08-20 11:37:33
|
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hello,<span lang="EN-GB"> </span><br/></div><div><span lang="EN-GB"></span><br/></div><div><span lang="EN-GB">I would like to deserialize Style-tag of html with Simple. I noticed that the attribute "class" can't be mapped to an Instance variable in java.</span><span lang="EN-GB"></span><br/></div><div><span lang="EN-GB">Is there any solution for that?</span><br/></div><div><br/></div><div>Thanks in advance<br/></div></div></body></html> |
|
From: Niall G. <gal...@ya...> - 2012-08-20 08:37:08
|
Thats really up to you, check out the tutorial http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php --- On Mon, 20/8/12, Michele Illuzzi <Mic...@au...> wrote: From: Michele Illuzzi <Mic...@au...> Subject: [Simple-support] Serialize / Deserialize xs:choice element To: "sim...@li..." <sim...@li...> Received: Monday, 20 August, 2012, 12:37 AM Hello, I have the following: <xs:choice> <xs:sequence> <xs:element name="DATAINIZIO"/> <xs:element name="DATAFINE"/> </xs:sequence> <xs:element name="NUMTRANSAZIONE"/></xs:choice> How to I annotate the choice XSD element using SimpleXML?Thanks -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Michele I. <Mic...@au...> - 2012-08-20 07:37:15
|
Hello, I have the following:
<xs:choice>
<xs:sequence>
<xs:element name="DATAINIZIO"/>
<xs:element name="DATAFINE"/>
</xs:sequence>
<xs:element name="NUMTRANSAZIONE"/>
</xs:choice>
How to I annotate the choice XSD element using SimpleXML?
Thanks
|
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-14 00:02:28
|
Hi Gary,
Currently the string "Bog is" and "allergic to peanuts" will not be accessible through the InputNode. Ill be adding some changes to allow this in future, but currently CDATA is your best option.
Niall
From: Gar Ng [mailto:ga...@gm...]
Sent: Tuesday, 14 August 2012 5:22 AM
To: sim...@li...
Subject: [Simple-support] how to serialize/deserialize html style tags within an element
Hi,
I have some xml documents that contain html inside an element. An example is as follows:
<person>
<firstName>Bob<firstName>
<notes>
<html: p>
Bob is <strong>severely</strong> allergic to peanuts
</html: p>
</notes>
</person>
I attempted to create a converter to handle this case.
The current api allows me to create child elements and write a value to the current element but is there a way to handle this case where a style element is embedded in the text? When attempting to read it in, the value on the inputNode appears to only contain the text up to the <strong> tag, everything after the child element <strong> does not appear to be in the inputNode. Conversely, there is no way to create an output node with this structure either.
The only solution that I can think of would be to wrap the <notes> or <p> element in CDATA before reading and then do some post processing to remove the CDATA tag after writing. Is there a better way to do this?
Thanks,
Gary
|
|
From: Gar Ng <ga...@gm...> - 2012-08-13 19:22:07
|
Hi,
I have some xml documents that contain html inside an element. An example
is as follows:
<person>
<firstName>Bob<firstName>
<notes>
<html: p>
Bob is <strong>severely</strong> allergic to peanuts
</html: p>
</notes>
</person>
I attempted to create a converter to handle this case.
The current api allows me to create child elements and write a value to the
current element but is there a way to handle this case where a style
element is embedded in the text? When attempting to read it in, the value
on the inputNode appears to only contain the text up to the <strong> tag,
everything after the child element <strong> does not appear to be in the
inputNode. Conversely, there is no way to create an output node with this
structure either.
The only solution that I can think of would be to wrap the <notes> or <p>
element in CDATA before reading and then do some post processing to remove
the CDATA tag after writing. Is there a better way to do this?
Thanks,
Gary
|
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-12 23:24:29
|
Thanks, this is a bug, Ill make sure its in the next release, which Ill release when I get some time this week hopefully.
-----Original Message-----
From: Gupta, Amit A [mailto:ami...@rb...]
Sent: Saturday, 11 August 2012 3:28 AM
To: Niall Gallagher; sim...@li...
Subject: Re: [Simple-support] NullPointerException for similar Element Names with different @Paths
If you run this code - it will replicate the scenario. Note that other elements such as 'type' and 'role' are working fine. Only sourcesystem is misbehaving.
If you rename sourceSystem to sourceSystem-remove - it would run fine.
Thanks,
--------------------------------------------------------------------------------
package test.simple.scenario.path;
import java.io.StringWriter;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Namespace;
import org.simpleframework.xml.Path;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
@Root(name="header")
public class TradeHeader {
@Element(name = "sourceSystem")
@Path("tradeIdentifier/tradeKey")
@Namespace
private String tradeKeySourceSystem = "VALUE";
@Attribute(name = "id")
@Path("book")
private String bookId = "BOOK";
@Element(name = "code")
@Path("book/identifier")
@Namespace
private String bookCode = "code";
@Element(name = "sourceSystem")
@Path("book/identifier")
@Namespace
private String bookSourceSystem = "VALUE";
@Element(name = "type")
@Path("book/identifier")
@Namespace
private String bookType = "SHORT_NAME";
@Element(name = "role")
@Path("book")
@Namespace
private String bookRole = "VALUE";
@Attribute(name = "id")
@Path("trader")
private String traderId = "TID";
@Element(name = "code")
@Path("trader/identifier")
@Namespace
private String traderCode = "tCode";
@Element(name = "sourceSystem")
@Path("trader/identifier")
@Namespace
private String traderSourceSystem = "VALUE";
@Element(name = "type")
@Path("trader/identifier")
@Namespace
private String traderType = "SHORT_NAME";
@Element(name = "role")
@Path("trader")
@Namespace
private String traderRole = "VALUE";
public static void main(String[] args) throws Exception {
Serializer serializer = new Persister();
StringWriter writer = new StringWriter();
TradeHeader header = new TradeHeader();
serializer.write(header, writer);
String data = writer.getBuffer().toString();
System.out.println(data);
}
}
-----Original Message-----
From: Niall Gallagher [mailto:gal...@ya...]
Sent: 2012, August, 10 12:58 PM
To: sim...@li...; Gupta, Amit A
Subject: Re: [Simple-support] NullPointerException for similar Element Names with different @Paths
Can you provide a test, I find this unlikely..but its possible I guess. Some code to repeat this would be good.
--- On Fri, 10/8/12, amit.shipra <ami...@rb...> wrote:
> From: amit.shipra <ami...@rb...>
> Subject: Re: [Simple-support] NullPointerException for similar Element
> Names with different @Paths
> To: sim...@li...
> Received: Friday, 10 August, 2012, 6:17 AM
>
> In the XML Message 'sourceSystem' is at multiple places. I overlooked
> in my haste. When I tried name="sourceSystem[1]" the actual tags were
> changed to <ns0:sourceSystem[1]>value</sourceSystem[1]>.
>
> Issue remains. Please help.
>
> Amit-G.
>
>
>
> Robert Massaioli-2 wrote:
> >
> > You just said previously that you had solved the
> problem? Is that not the
> > case?
> >
> > On Fri, Aug 10, 2012 at 11:04 PM, amit.shipra
> > <ami...@rb...>wrote:
> >
> >>
> >> Could someone please help with this issue. Let me
> know if I am doing
> >> anything
> >> wrong here?? :-/
> >>
> >>
> >> amit.shipra wrote:
> >> >
> >> > Hi there,
> >> >
> >> > XML looks like:
> >> >
> >> >
> <ns0:book id="BOOK">
> >> >
> <ns0:identifier>
> >> >
>
> <ns0:sourceSystem>DTCC</ns0:sourceSystem>
> >> >
> </ns0:identifier>
> >> >
> </ns0:book>
> >> >
> <ns0:trader
> id="ID_EXECUTING_TRADER">
> >> >
> <ns0:identifier>
> >> >
>
> <ns0:sourceSystem>NYSE</ns0:sourceSystem>
> >> >
> </ns0:identifier>
> >> >
> </ns0:trader>
> >> >
> >> >
> >> > and my JAVA code (for sourceSystem Element)
> is:
> >> >
> >> >
> @Element(name="sourceSystem")
> >> >
> @Path("ns0:book/ns0:identifier")
> >> > private String
> bookSourceSystem="system1";
> >> >
> >> >
> >> >
> @Element(name="sourceSystem")
> >> >
> @Path("ns0:trader/ns0:identifier")
> >> > private String
> traderSourceSystem="system2";
> >> >
> >> >
> >> > However, I am getting the
> NullPointerException:
> >> >
> >> > StackTrace:
> >> > Exception in thread "main"
> java.lang.NullPointerException
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.InstantiatorBuilder.register(Instantiator
> Builder.java:461)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.InstantiatorBuilder.register(Instantiator
> Builder.java:433)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder
> .java:283)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder
> .java:259)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder
> .java:200)
> >> > at
> org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
> >> > at
> org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
> >> > at
> org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory
> .java:77)
> >> > at
> >>
> org.simpleframework.xml.core.Support.getScanner(Support.java:203)
> >> > at
> >>
> org.simpleframework.xml.core.Source.getScanner(Source.java:271)
> >> > at
> org.simpleframework.xml.core.Source.getCaller(Source.java:300)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeReplace(Composite.java:114
> 7)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:10
> 98)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:100
> 4)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:975)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:952)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:125
> 6)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:123
> 9)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:10
> 98)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:100
> 4)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:10
> 87)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:100
> 4)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:975)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:952)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1180)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1162)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1140)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1259)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1241)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1222)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1201)
> >> >
> >> >
> >> > Source code block:
> >> >
> >> > private void register(Label
> label, LabelMap map) throws Exception {
> >> > String name =
> label.getName();
> >> > String path =
> label.getPath();
> >> >
> >> >
> if(map.containsKey(name)) {
> >> > Label
> current = map.get(name); <-- THIS RETURNS current AS
> >> NULL.
> >> > String key =
> current.getPath();
> >> >
> >> >
> >> > Could we have only one Element even if @Paths
> are different? Struck
> >> around
> >> > this for long. Is there a work around?
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/NullPointerException-for-similar-Element-Name
> >> s-with-different-%40Paths-tp34277238p34281760.html
> >> Sent from the Simple XML Serialization mailing list
> archive at
> >> Nabble.com.
> >>
> >>
> >>
> >>
> ----------------------------------------------------------------------
> --------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways
> today's security and
> >> threat landscape has changed and how IT managers
> can respond. Discussions
> >> will include endpoint security, mobile security and
> the latest in malware
> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> _______________________________________________
> >> Simple-support mailing list
> >> Sim...@li...
> >> https://lists.sourceforge.net/lists/listinfo/simple-support
> >>
> >
> >
> ----------------------------------------------------------------------
> --------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's
> security and
> > threat landscape has changed and how IT managers can
> respond. Discussions
> > will include endpoint security, mobile security and the
> latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/NullPointerException-for-similar-Element-Names-w
> ith-different-%40Paths-tp34277238p34281810.html
> Sent from the Simple XML Serialization mailing list archive at
> Nabble.com.
>
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
_______________________________________________________________________
This email is intended only for the use of the individual(s) to whom it is addressed and may be privileged and confidential.
Unauthorised use or disclosure is prohibited. If you receive This e-mail in error, please advise immediately and delete the original message.
This message may have been altered without your or our knowledge and the sender does not accept any liability for any errors or omissions in the message.
Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par un autre moyen.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Gupta, A. A <ami...@rb...> - 2012-08-10 18:02:07
|
If you run this code - it will replicate the scenario. Note that other elements such as 'type' and 'role' are working fine. Only sourcesystem is misbehaving.
If you rename sourceSystem to sourceSystem-remove - it would run fine.
Thanks,
--------------------------------------------------------------------------------
package test.simple.scenario.path;
import java.io.StringWriter;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Namespace;
import org.simpleframework.xml.Path;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
@Root(name="header")
public class TradeHeader {
@Element(name = "sourceSystem")
@Path("tradeIdentifier/tradeKey")
@Namespace
private String tradeKeySourceSystem = "VALUE";
@Attribute(name = "id")
@Path("book")
private String bookId = "BOOK";
@Element(name = "code")
@Path("book/identifier")
@Namespace
private String bookCode = "code";
@Element(name = "sourceSystem")
@Path("book/identifier")
@Namespace
private String bookSourceSystem = "VALUE";
@Element(name = "type")
@Path("book/identifier")
@Namespace
private String bookType = "SHORT_NAME";
@Element(name = "role")
@Path("book")
@Namespace
private String bookRole = "VALUE";
@Attribute(name = "id")
@Path("trader")
private String traderId = "TID";
@Element(name = "code")
@Path("trader/identifier")
@Namespace
private String traderCode = "tCode";
@Element(name = "sourceSystem")
@Path("trader/identifier")
@Namespace
private String traderSourceSystem = "VALUE";
@Element(name = "type")
@Path("trader/identifier")
@Namespace
private String traderType = "SHORT_NAME";
@Element(name = "role")
@Path("trader")
@Namespace
private String traderRole = "VALUE";
public static void main(String[] args) throws Exception {
Serializer serializer = new Persister();
StringWriter writer = new StringWriter();
TradeHeader header = new TradeHeader();
serializer.write(header, writer);
String data = writer.getBuffer().toString();
System.out.println(data);
}
}
-----Original Message-----
From: Niall Gallagher [mailto:gal...@ya...]
Sent: 2012, August, 10 12:58 PM
To: sim...@li...; Gupta, Amit A
Subject: Re: [Simple-support] NullPointerException for similar Element Names with different @Paths
Can you provide a test, I find this unlikely..but its possible I guess. Some code to repeat this would be good.
--- On Fri, 10/8/12, amit.shipra <ami...@rb...> wrote:
> From: amit.shipra <ami...@rb...>
> Subject: Re: [Simple-support] NullPointerException for similar Element
> Names with different @Paths
> To: sim...@li...
> Received: Friday, 10 August, 2012, 6:17 AM
>
> In the XML Message 'sourceSystem' is at multiple places. I overlooked
> in my haste. When I tried name="sourceSystem[1]" the actual tags were
> changed to <ns0:sourceSystem[1]>value</sourceSystem[1]>.
>
> Issue remains. Please help.
>
> Amit-G.
>
>
>
> Robert Massaioli-2 wrote:
> >
> > You just said previously that you had solved the
> problem? Is that not the
> > case?
> >
> > On Fri, Aug 10, 2012 at 11:04 PM, amit.shipra
> > <ami...@rb...>wrote:
> >
> >>
> >> Could someone please help with this issue. Let me
> know if I am doing
> >> anything
> >> wrong here?? :-/
> >>
> >>
> >> amit.shipra wrote:
> >> >
> >> > Hi there,
> >> >
> >> > XML looks like:
> >> >
> >> >
> <ns0:book id="BOOK">
> >> >
> <ns0:identifier>
> >> >
>
> <ns0:sourceSystem>DTCC</ns0:sourceSystem>
> >> >
> </ns0:identifier>
> >> >
> </ns0:book>
> >> >
> <ns0:trader
> id="ID_EXECUTING_TRADER">
> >> >
> <ns0:identifier>
> >> >
>
> <ns0:sourceSystem>NYSE</ns0:sourceSystem>
> >> >
> </ns0:identifier>
> >> >
> </ns0:trader>
> >> >
> >> >
> >> > and my JAVA code (for sourceSystem Element)
> is:
> >> >
> >> >
> @Element(name="sourceSystem")
> >> >
> @Path("ns0:book/ns0:identifier")
> >> > private String
> bookSourceSystem="system1";
> >> >
> >> >
> >> >
> @Element(name="sourceSystem")
> >> >
> @Path("ns0:trader/ns0:identifier")
> >> > private String
> traderSourceSystem="system2";
> >> >
> >> >
> >> > However, I am getting the
> NullPointerException:
> >> >
> >> > StackTrace:
> >> > Exception in thread "main"
> java.lang.NullPointerException
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.InstantiatorBuilder.register(Instantiator
> Builder.java:461)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.InstantiatorBuilder.register(Instantiator
> Builder.java:433)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder
> .java:283)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder
> .java:259)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder
> .java:200)
> >> > at
> org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
> >> > at
> org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
> >> > at
> org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory
> .java:77)
> >> > at
> >>
> org.simpleframework.xml.core.Support.getScanner(Support.java:203)
> >> > at
> >>
> org.simpleframework.xml.core.Source.getScanner(Source.java:271)
> >> > at
> org.simpleframework.xml.core.Source.getCaller(Source.java:300)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeReplace(Composite.java:114
> 7)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:10
> 98)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:100
> 4)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:975)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:952)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:125
> 6)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:123
> 9)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:10
> 98)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:100
> 4)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:10
> 87)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:100
> 4)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:975)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:952)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1180)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1162)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1140)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1259)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1241)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1222)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1201)
> >> >
> >> >
> >> > Source code block:
> >> >
> >> > private void register(Label
> label, LabelMap map) throws Exception {
> >> > String name =
> label.getName();
> >> > String path =
> label.getPath();
> >> >
> >> >
> if(map.containsKey(name)) {
> >> > Label
> current = map.get(name); <-- THIS RETURNS current AS
> >> NULL.
> >> > String key =
> current.getPath();
> >> >
> >> >
> >> > Could we have only one Element even if @Paths
> are different? Struck
> >> around
> >> > this for long. Is there a work around?
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/NullPointerException-for-similar-Element-Name
> >> s-with-different-%40Paths-tp34277238p34281760.html
> >> Sent from the Simple XML Serialization mailing list
> archive at
> >> Nabble.com.
> >>
> >>
> >>
> >>
> ----------------------------------------------------------------------
> --------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways
> today's security and
> >> threat landscape has changed and how IT managers
> can respond. Discussions
> >> will include endpoint security, mobile security and
> the latest in malware
> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> _______________________________________________
> >> Simple-support mailing list
> >> Sim...@li...
> >> https://lists.sourceforge.net/lists/listinfo/simple-support
> >>
> >
> >
> ----------------------------------------------------------------------
> --------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's
> security and
> > threat landscape has changed and how IT managers can
> respond. Discussions
> > will include endpoint security, mobile security and the
> latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/NullPointerException-for-similar-Element-Names-w
> ith-different-%40Paths-tp34277238p34281810.html
> Sent from the Simple XML Serialization mailing list archive at
> Nabble.com.
>
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
_______________________________________________________________________
This email is intended only for the use of the individual(s) to whom it is addressed and may be privileged and confidential.
Unauthorised use or disclosure is prohibited. If you receive This e-mail in error, please advise immediately and delete the original message.
This message may have been altered without your or our knowledge and the sender does not accept any liability for any errors or omissions in the message.
Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par un autre moyen.
|
|
From: Niall G. <gal...@ya...> - 2012-08-10 16:57:46
|
Can you provide a test, I find this unlikely..but its possible I guess. Some code to repeat this would be good.
--- On Fri, 10/8/12, amit.shipra <ami...@rb...> wrote:
> From: amit.shipra <ami...@rb...>
> Subject: Re: [Simple-support] NullPointerException for similar Element Names with different @Paths
> To: sim...@li...
> Received: Friday, 10 August, 2012, 6:17 AM
>
> In the XML Message 'sourceSystem' is at multiple places. I
> overlooked in my
> haste. When I tried name="sourceSystem[1]" the actual tags
> were changed to
> <ns0:sourceSystem[1]>value</sourceSystem[1]>.
>
> Issue remains. Please help.
>
> Amit-G.
>
>
>
> Robert Massaioli-2 wrote:
> >
> > You just said previously that you had solved the
> problem? Is that not the
> > case?
> >
> > On Fri, Aug 10, 2012 at 11:04 PM, amit.shipra
> > <ami...@rb...>wrote:
> >
> >>
> >> Could someone please help with this issue. Let me
> know if I am doing
> >> anything
> >> wrong here?? :-/
> >>
> >>
> >> amit.shipra wrote:
> >> >
> >> > Hi there,
> >> >
> >> > XML looks like:
> >> >
> >> >
> <ns0:book id="BOOK">
> >> >
> <ns0:identifier>
> >> >
>
> <ns0:sourceSystem>DTCC</ns0:sourceSystem>
> >> >
> </ns0:identifier>
> >> >
> </ns0:book>
> >> >
> <ns0:trader
> id="ID_EXECUTING_TRADER">
> >> >
> <ns0:identifier>
> >> >
>
> <ns0:sourceSystem>NYSE</ns0:sourceSystem>
> >> >
> </ns0:identifier>
> >> >
> </ns0:trader>
> >> >
> >> >
> >> > and my JAVA code (for sourceSystem Element)
> is:
> >> >
> >> >
> @Element(name="sourceSystem")
> >> >
> @Path("ns0:book/ns0:identifier")
> >> > private String
> bookSourceSystem="system1";
> >> >
> >> >
> >> >
> @Element(name="sourceSystem")
> >> >
> @Path("ns0:trader/ns0:identifier")
> >> > private String
> traderSourceSystem="system2";
> >> >
> >> >
> >> > However, I am getting the
> NullPointerException:
> >> >
> >> > StackTrace:
> >> > Exception in thread "main"
> java.lang.NullPointerException
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:461)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:433)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:283)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:259)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:200)
> >> > at
> org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
> >> > at
> org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
> >> > at
> org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:77)
> >> > at
> >>
> org.simpleframework.xml.core.Support.getScanner(Support.java:203)
> >> > at
> >>
> org.simpleframework.xml.core.Source.getScanner(Source.java:271)
> >> > at
> org.simpleframework.xml.core.Source.getCaller(Source.java:300)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1147)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:975)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:952)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1256)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1239)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1087)
> >> > at
> >> >
> >>
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:975)
> >> > at
> >>
> org.simpleframework.xml.core.Composite.write(Composite.java:952)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
> >> > at
> >>
> org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1180)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1162)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1140)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1259)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1241)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1222)
> >> > at
> >>
> org.simpleframework.xml.core.Persister.write(Persister.java:1201)
> >> >
> >> >
> >> > Source code block:
> >> >
> >> > private void register(Label
> label, LabelMap map) throws Exception {
> >> > String name =
> label.getName();
> >> > String path =
> label.getPath();
> >> >
> >> >
> if(map.containsKey(name)) {
> >> > Label
> current = map.get(name); <-- THIS RETURNS current
> AS
> >> NULL.
> >> > String key =
> current.getPath();
> >> >
> >> >
> >> > Could we have only one Element even if @Paths
> are different? Struck
> >> around
> >> > this for long. Is there a work around?
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34281760.html
> >> Sent from the Simple XML Serialization mailing list
> archive at
> >> Nabble.com.
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways
> today's security and
> >> threat landscape has changed and how IT managers
> can respond. Discussions
> >> will include endpoint security, mobile security and
> the latest in malware
> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> _______________________________________________
> >> Simple-support mailing list
> >> Sim...@li...
> >> https://lists.sourceforge.net/lists/listinfo/simple-support
> >>
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's
> security and
> > threat landscape has changed and how IT managers can
> respond. Discussions
> > will include endpoint security, mobile security and the
> latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
>
> --
> View this message in context: http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34281810.html
> Sent from the Simple XML Serialization mailing list archive
> at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's
> security and
> threat landscape has changed and how IT managers can
> respond. Discussions
> will include endpoint security, mobile security and the
> latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: amit.shipra <ami...@rb...> - 2012-08-10 13:18:07
|
In the XML Message 'sourceSystem' is at multiple places. I overlooked in my
haste. When I tried name="sourceSystem[1]" the actual tags were changed to
<ns0:sourceSystem[1]>value</sourceSystem[1]>.
Issue remains. Please help.
Amit-G.
Robert Massaioli-2 wrote:
>
> You just said previously that you had solved the problem? Is that not the
> case?
>
> On Fri, Aug 10, 2012 at 11:04 PM, amit.shipra
> <ami...@rb...>wrote:
>
>>
>> Could someone please help with this issue. Let me know if I am doing
>> anything
>> wrong here?? :-/
>>
>>
>> amit.shipra wrote:
>> >
>> > Hi there,
>> >
>> > XML looks like:
>> >
>> > <ns0:book id="BOOK">
>> > <ns0:identifier>
>> > <ns0:sourceSystem>DTCC</ns0:sourceSystem>
>> > </ns0:identifier>
>> > </ns0:book>
>> > <ns0:trader id="ID_EXECUTING_TRADER">
>> > <ns0:identifier>
>> > <ns0:sourceSystem>NYSE</ns0:sourceSystem>
>> > </ns0:identifier>
>> > </ns0:trader>
>> >
>> >
>> > and my JAVA code (for sourceSystem Element) is:
>> >
>> > @Element(name="sourceSystem")
>> > @Path("ns0:book/ns0:identifier")
>> > private String bookSourceSystem="system1";
>> >
>> >
>> > @Element(name="sourceSystem")
>> > @Path("ns0:trader/ns0:identifier")
>> > private String traderSourceSystem="system2";
>> >
>> >
>> > However, I am getting the NullPointerException:
>> >
>> > StackTrace:
>> > Exception in thread "main" java.lang.NullPointerException
>> > at
>> >
>> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:461)
>> > at
>> >
>> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:433)
>> > at
>> >
>> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:283)
>> > at
>> >
>> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:259)
>> > at
>> >
>> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:200)
>> > at org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
>> > at org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
>> > at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
>> > at
>> >
>> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:77)
>> > at
>> org.simpleframework.xml.core.Support.getScanner(Support.java:203)
>> > at
>> org.simpleframework.xml.core.Source.getScanner(Source.java:271)
>> > at org.simpleframework.xml.core.Source.getCaller(Source.java:300)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1147)
>> > at
>> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
>> > at
>> org.simpleframework.xml.core.Composite.write(Composite.java:975)
>> > at
>> org.simpleframework.xml.core.Composite.write(Composite.java:952)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1256)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1239)
>> > at
>> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1087)
>> > at
>> >
>> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
>> > at
>> org.simpleframework.xml.core.Composite.write(Composite.java:975)
>> > at
>> org.simpleframework.xml.core.Composite.write(Composite.java:952)
>> > at
>> org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
>> > at
>> org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
>> > at
>> org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1180)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1162)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1140)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1259)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1241)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1222)
>> > at
>> org.simpleframework.xml.core.Persister.write(Persister.java:1201)
>> >
>> >
>> > Source code block:
>> >
>> > private void register(Label label, LabelMap map) throws Exception {
>> > String name = label.getName();
>> > String path = label.getPath();
>> >
>> > if(map.containsKey(name)) {
>> > Label current = map.get(name); <-- THIS RETURNS current AS
>> NULL.
>> > String key = current.getPath();
>> >
>> >
>> > Could we have only one Element even if @Paths are different? Struck
>> around
>> > this for long. Is there a work around?
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34281760.html
>> Sent from the Simple XML Serialization mailing list archive at
>> Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Simple-support mailing list
>> Sim...@li...
>> https://lists.sourceforge.net/lists/listinfo/simple-support
>>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
--
View this message in context: http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34281810.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Robert M. <rob...@gm...> - 2012-08-10 13:13:37
|
You just said previously that you had solved the problem? Is that not the
case?
On Fri, Aug 10, 2012 at 11:04 PM, amit.shipra <ami...@rb...>wrote:
>
> Could someone please help with this issue. Let me know if I am doing
> anything
> wrong here?? :-/
>
>
> amit.shipra wrote:
> >
> > Hi there,
> >
> > XML looks like:
> >
> > <ns0:book id="BOOK">
> > <ns0:identifier>
> > <ns0:sourceSystem>DTCC</ns0:sourceSystem>
> > </ns0:identifier>
> > </ns0:book>
> > <ns0:trader id="ID_EXECUTING_TRADER">
> > <ns0:identifier>
> > <ns0:sourceSystem>NYSE</ns0:sourceSystem>
> > </ns0:identifier>
> > </ns0:trader>
> >
> >
> > and my JAVA code (for sourceSystem Element) is:
> >
> > @Element(name="sourceSystem")
> > @Path("ns0:book/ns0:identifier")
> > private String bookSourceSystem="system1";
> >
> >
> > @Element(name="sourceSystem")
> > @Path("ns0:trader/ns0:identifier")
> > private String traderSourceSystem="system2";
> >
> >
> > However, I am getting the NullPointerException:
> >
> > StackTrace:
> > Exception in thread "main" java.lang.NullPointerException
> > at
> >
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:461)
> > at
> >
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:433)
> > at
> >
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:283)
> > at
> >
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:259)
> > at
> >
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:200)
> > at org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
> > at org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
> > at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
> > at
> >
> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:77)
> > at
> org.simpleframework.xml.core.Support.getScanner(Support.java:203)
> > at org.simpleframework.xml.core.Source.getScanner(Source.java:271)
> > at org.simpleframework.xml.core.Source.getCaller(Source.java:300)
> > at
> > org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1147)
> > at
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
> > at
> > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> > at
> > org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> > at org.simpleframework.xml.core.Composite.write(Composite.java:975)
> > at org.simpleframework.xml.core.Composite.write(Composite.java:952)
> > at
> > org.simpleframework.xml.core.Composite.writeElement(Composite.java:1256)
> > at
> > org.simpleframework.xml.core.Composite.writeElement(Composite.java:1239)
> > at
> org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
> > at
> > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> > at
> > org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> > at
> > org.simpleframework.xml.core.Composite.writeElements(Composite.java:1087)
> > at
> > org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> > at org.simpleframework.xml.core.Composite.write(Composite.java:975)
> > at org.simpleframework.xml.core.Composite.write(Composite.java:952)
> > at org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
> > at org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
> > at org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1180)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1162)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1140)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1259)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1241)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1222)
> > at
> org.simpleframework.xml.core.Persister.write(Persister.java:1201)
> >
> >
> > Source code block:
> >
> > private void register(Label label, LabelMap map) throws Exception {
> > String name = label.getName();
> > String path = label.getPath();
> >
> > if(map.containsKey(name)) {
> > Label current = map.get(name); <-- THIS RETURNS current AS
> NULL.
> > String key = current.getPath();
> >
> >
> > Could we have only one Element even if @Paths are different? Struck
> around
> > this for long. Is there a work around?
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34281760.html
> Sent from the Simple XML Serialization mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|