I am using an xml file to store data. I can get the data out now, but I
have a problem with any field that needs text formatting such as bold,
carriage return/linefeed, htmls tags.
Can some one point me to a good tutorial that will help me learn this,
or give me an example?
Thanks,
Irvin.
<product>
<title>My product Title</title>
<prod_date>20.May.1999</prod_date>
<desc>
Paragraph one.
Paragraph two.
</desc>
</product> 8 2652
Irvin wrote: I am using an xml file to store data. I can get the data out now, but I have a problem with any field that needs text formatting such as bold, carriage return/linefeed, htmls tags.
Can some one point me to a good tutorial that will help me learn this, or give me an example?
Use XSLT.
<product> <title>My product Title</title> <prod_date>20.May.1999</prod_date> <desc> Paragraph one.
This is going to be a problem. You really need to have something better
than a newline in there to signal paragraphs.
Paragraph two. </desc> </product>
<desc>
<para>Paragraph one.</para>
<para>Paragraph two.</para>
</desc>
Don't be tempted to pretend that linebreaks are a substitute for paragraph
start and end. They're not.
e.g.:
<xsl:template match="title">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:template match="prod_date">
<h2>
<!-- get rid of the periods in the date -->
<xsl:value-of select="translate(.,'.',' ')"/>
</h2>
</xsl:template>
[and much more].
///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
Peter,
Thanks for your quick reply. I am completly new to xml! But it looks
like it could be fun to work with.
Anyways, I actually found a way to do what I wanted!
<desc><![CDATA[<p"Paragraph one".</p><p>It's paragraph two.</p>]]
</desc>
But now I have a new problem!
Only part of the text shows up! Is there a limit to the number of
characters that a Node(?) can return? It cuts off mid sentence, no
special charaters nearby. You can take a look here: http://www.ivan-isabel.com/test/test.xml <- XML datastore http://www.ivan-isabel.com/test/articles.php <- PHP/XML version (cut
off text) http://www.ivan-isabel.com/articles.html <- Static version (full text)
Thanks again for your help.
Irvin.
Hi, Thanks for your quick reply. I am completly new to xml! But it looks like it could be fun to work with.
Anyways, I actually found a way to do what I wanted! <desc><![CDATA[<p"Paragraph one".</p><p>It's paragraph two.</p>]] </desc>
But now I have a new problem!
Only part of the text shows up! Is there a limit to the number of characters that a Node(?) can return?
No, there are no limitations. It cuts off mid sentence, no special charaters nearby. You can take a look here: http://www.ivan-isabel.com/test/test.xml <- XML datastore http://www.ivan-isabel.com/test/articles.php <- PHP/XML version (cut off text) http://www.ivan-isabel.com/articles.html <- Static version (full text)
I don't see any mid-sentence cuts on those pages (maybe you repaired it already), but when I look at the source code of the PHP version, I see this:
<para><p><![CDATA[...is a key to entering into the Father’s kingdom, and
since we know that He wants us to enter in, we are all capable
of opening the door to it.</p></para>
<para><![CDATA[<p class="style">What is prophecy? It is simply hearing the
Father speaking and repeating what He says, perceiving the
Father’s heart for someone and then sharing it with ...
First of all, it's useless to put markup data in a CDATA section. In the genrated HTML as well as in the source XML.
Secondly, the CDATA sections, if used, must be closed with ']]>'
Finally, the 'para' element isn't defined in HTML4.0
Maybe these errors are causing the mid-sentece cuts on your browser.
btw, you could consider to use XHTML, CSS and table-free design:-)
regards,
--
Joris Gillis ( http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Joris,
Thanks for your reply. I have added comments to your posting. I don't see any mid-sentence cuts on those pages (maybe you repaired
it already ...
No. I still have that issue. I have tried in IE 6.0 and Mozilla
FireFox.
First of all, it's useless to put markup data in a CDATA section. In
the genrated HTML as well as in the source XML.
Is there a better way to do it? The user needs to be able to add style
his text with bold, italic, and stylesheet classes.
Secondly, the CDATA sections, if used, must be closed with ']]>'
Ya. I caught that after I posted.
Finally, the 'para' element isn't defined in HTML4.0
I already dropped that.
btw, you could consider to use XHTML, CSS and table-free design:-)
I have never looked at XHTML before.
Ceterum censeo XML omnibus esse utendum
Translated, this means?
Thnaks again!
Irvin.
>> I don't see any mid-sentence cuts on those pages (maybe you repaired it already ...
No. I still have that issue. I have tried in IE 6.0 and Mozilla FireFox.
That's weird: in my Opera browser, I cannot see any problem, but when I set my preferences to 'indentify as MSIE 6.0' , the line is indeed broken. It seems the algorithm in the PHP that checks the browser type is broken. I cannot help you with that; I don't know any PHP. First of all, it's useless to put markup data in a CDATA section. In the genrated HTML as well as in the source XML.
Is there a better way to do it? The user needs to be able to add style his text with bold, italic, and stylesheet classes.
Well, CDATA sections are, as the word says, meant to be encapsulate Character Data i.d. characters _without_ markup. So it doesn't make sense to put 'tags' in CDATA, because they will be parsed as < and > .I'd just omit the CDATA declaration (certainly in the HTML generated):
<desc><p"Paragraph one".</p><p>It's paragraph two.</p>
</desc> Secondly, the CDATA sections, if used, must be closed with ']]>'
Ya. I caught that after I posted.
Finally, the 'para' element isn't defined in HTML4.0
I already dropped that.
btw, you could consider to use XHTML, CSS and table-free design:-)
I have never looked at XHTML before.
roughly spoken, XHTML is HTML written with XML strictness. So you can perform XSLT on a XHTML page, it's more versatile. Ceterum censeo XML omnibus esse utendum Translated, this means?
:-) Furthermore, I am of the opinion that XML must be used by everyone/for everything.
regards,
--
Joris Gillis ( http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Thanks for your help on this.
With regards to CDATA, the <p> tags seem to be presented well in the
browser. It doesn't appear to break anything. If I take them out I
loose my paragraph style and end up with one long paragraph.
I will post this whole issue with a PHP/XML forum and see what they
say.
Irvin.
Irvin wrote: Peter, Thanks for your quick reply. I am completly new to xml! But it looks like it could be fun to work with.
Anyways, I actually found a way to do what I wanted! <desc><![CDATA[<p"Paragraph one".</p><p>It's paragraph two.</p>]] </desc>
Yes, but don't be misled. The text inside a CDATA Marked Section is
*not* XML or HTML, as far as the processor is concerned, it's just a
bunch of letters and signs with no meaning, so it cannot be accessed
or manipulated as XML or HTML, only output as a string, which by luck
means something in the target environment.
It may not be important in a small test like this, but it's a Really
Bad Way to do things in a live production environment.
(Plus you're missing a closing > in your example)
But now I have a new problem!
Only part of the text shows up! Is there a limit to the number of characters that a Node(?) can return?
No.
It cuts off mid sentence, no special charaters nearby. You can take a look here: http://www.ivan-isabel.com/test/test.xml <- XML datastore http://www.ivan-isabel.com/test/articles.php <- PHP/XML version (cut off text) http://www.ivan-isabel.com/articles.html <- Static version (full text)
I don't use PHP, so this is not clear to me.
///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
Irvin wrote: Thanks for your help on this. With regards to CDATA, the <p> tags seem to be presented well in the browser. It doesn't appear to break anything. If I take them out I loose my paragraph style and end up with one long paragraph.
That's because you have insufficient markup.
If your users want to make the output look pretty (bold, italics, etc
for only decoration) then forget XML, tell them to use Dreamweaver.
If your users want to use bold, italics, etc to highlight something
important (names, places, quotations, references, etc) then use some
markup which describes that reason, and use XSLT to translate it to
HTML with CSS for display. This will last much longer, because later
on you'll be able to use the same markup to guide transformation to
other formats for other purposes without having to change it.
I will post this whole issue with a PHP/XML forum and see what they say.
I shudder to think :-)
///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nikola Pecigos |
last post by:
Hi,
I have the following problem:
We have an Oracle 9.2 with one table "document" which contains a path
to the filesystem. If I want to index these files (HTML, PDF, World,
Excel, etc.), I...
|
by: Irvin |
last post by:
I am using an xml file to store data. I can get the data out now, but I
have a problem with any field that needs text formatting such as bold,
carriage return/linefeed, htmls tags.
Can some one...
|
by: Colleyville Alan |
last post by:
I am using Access and have embedded the ActiveX control Formula One that
came with Office 2000. (ver 3.04). I have created and formatted a
spreadsheet and now I want to copy the info with...
|
by: Bradley |
last post by:
I have an A2000 database in which I have a continuous form with a tick
box. There is also a text box with a conditional format that is based on
the expression , if it's true then change the...
|
by: James Geurts |
last post by:
This is probably more of an ASP.Net situation rather than
c#, but since all of my code behind is in c#, maybe it
fits here. I'm wondering, generally, at what point is it
too inefficient to store...
| |
by: Nathan Franklin |
last post by:
hello list,
i am writing a pocket pc project. just this morning i opened up my project
and I got the following error..
error retrieving information from user datastore.
and then
the...
|
by: Scott M. |
last post by:
Ok, this is driving me nuts...
I am using VS.NET 2003 and trying to take an item out of a row in a
loosely-typed dataset and place it in a label as a currency. As it is now,
I am getting my...
|
by: aman909 |
last post by:
Hello,
Im trying to use conditional formatting in a text box on a form.
What im trying to do is that conditional formatting changes the colour of the text in the text box. I need the...
|
by: v4vijayakumar |
last post by:
Google appengine datastore is not very clear, and I couldn't get much
from API documents. It would be very helpful if there are some more
detailed documents with examples. Django provides very good...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |