473,785 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parsing string data through castor

I'm trying to parse string data using castor and it looks like the new
lines are getting lost.

I'm using castor 0.9.4.3

For example:

Input

<INPUT> First line
second line
third line </INPUT>

after marshaling and unmarshaling using castor this becomes

<INPUT> First line second line third line </INPUT>

Is there something I can do to preserve the newlines in the data or is
this a bug in castor.

Thanks in advance for the help
Jul 20 '05 #1
1 2067
In article <42************ **************@ posting.google. com>,
mn****@telcordi a.com (madhununna) wrote:
I'm trying to parse string data using castor and it looks like the new
lines are getting lost.

I'm using castor 0.9.4.3

For example:

Input

<INPUT> First line
second line
third line </INPUT>

after marshaling and unmarshaling using castor this becomes

<INPUT> First line second line third line </INPUT>

Is there something I can do to preserve the newlines in the data or is
this a bug in castor.

Thanks in advance for the help

I don't know for sure, but it looks like a bug in Castor
to me. It looks similar to a bug I had to deal with a
few years ago.

Before you get any further with Castor, see how the current
version handles

<INPUT> First line
second <b>line</b> with <i>mixed content</i>
third line </INPUT>

A few years back I worked on a project that had already
chosen Castor before I joined the team. They had found
that the marshaling and unmarshaling mangled the order
of leaf node when some of those leaf nodes were PCDATA,
and they would get something like

<INPUT> First line <b>line</b><i>mixed content</i>second with third
line </INPUT>

(one long line)

back from the system. The people at www.castor.org were
contacted to report the bug, and our team was told that
it wasn't a bug since all of the elements were present in
the output, that castor was intended for data-centric
applications instead of text-oriented applications, that
all parts of the object were present, a Java application
wouldn't "care" one way or the other, and that they were
not going to try to "fix" it.

The fix that the team came up with was to encode the sample
above as

<INPUT><text>Fi rst line</text>
<text>second </text><b>line</b><text> with </text><i>mixed content</i>
<text>third line</text></INPUT>

If I remember correctly, it still came back out of the
system as one line, but with all leaf nodes existing
as elements (no mixed content) the ordering survived.

This was all before I joined the team, but as you can
imagine I got an earful about it when I asked why the
hell these <text> elements were being used instead of
traditional mixed content. I could hardly belive it,
but was quickly shown the email correspondence that
documented the whole affair.

Good luck.

- - - -
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3054
by: Casper B | last post by:
The www.castor.org project seems to be gone. I loved this XML-Java binding framework and I am wondering if anyone are aware of what has happened to it?! Thanks, Casper
1
2623
by: Przemyslaw Wegrzyn | last post by:
Hi! I'm quite new to Python. Is there anything like Castor or JAXB available for Python ? All I have found is generateDS.py, but it seems to be very limited and a bit buggy - it seems to be sensitive to the order in which I declare elements in my XML Schema file. In my upcoming project I need a robust XML support, and I wanted to give Python a try, unfortunately I'll probably have to switch back to Java for this project :(
2
3784
by: Christophe Geraud | last post by:
I got the following exception with Castor: "The prefix 'xml' is reserved (XML 1.0 Specification) and cannot be declared." I got this exception using or not a mapping file. Can anyone tell what it means ? Here is the stack trace : java.lang.IllegalArgumentException: The prefix 'xml' is reserved (XML 1.0 Specification) and cannot be declared.
0
1350
by: Ulf Heyder | last post by:
I use castor-0.9.5 with xerces-2.4.0 to automatically generate classes from XSDs via source generator and un-/marshall JAVA objects to/from XML files. My question is how to tell the castor source generator to create the classes in a way that while marshalling they will create a schemaLocation entry in the opening root tag: <?xml version="1.0" encoding="UTF-8"?> <liste
2
3853
by: Christophe Vanfleteren | last post by:
Hello, I'm parsing xml that is returned by the Amazon webservices (using their REST interface). Their dev-heavy.xsd has the following entry: <xs:element name="Track"> <xs:complexType> <xs:sequence>
4
7248
by: Pushya | last post by:
Hello - I am trying to parse a .XSD file to obtain information about element name and type in the file. I have been trying to find some kind of documentation for Schema Parsing. All I come across is documentation for validating XML files against XSD files. Is ther any way to parse the XSD file itself? Any help will be appreciated. Thanks for your time.
0
1264
by: shaque | last post by:
Hi, I am working on data binding in java. I have dtd,mapping and xml file. the startin of my xml file is as follows: <?xml version="1.0" encoding="UTF-8"?> <!-- Document : text.xml
0
1464
by: manas589 | last post by:
Hi Can any one tell me how to use binding.xml while generating castor bean from an xsd file. i have one xsd file where two element are conflicting. so i thought to use binding file while generating castor bean. i have created my binding.xml file. but i don't know how to use this binding.xml file while creating beans. is it required to put the binding.xml file in classpath or where can i mentioned the path of this file so that while...
2
3129
by: Roshan Naik | last post by:
Castor is a pure C++ Library that introduces the Logic paradigm (LP) into C++. Although LP has been well explored in Computer science, it remains under utilized in main stream software development due to lack of support in popular programming languages. Among the few languages that do support it, Prolog is perhaps the most commonly known.
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.