How to display HTML that is the data within and XML file.

C

Cal Who

Someone generates an XML file.
The data in the file is HTML.
She sends the file to me.
I upload it to my site.
A page on the site will extract the HTML and assign it to a Literal so it is
displayed.

The probem is that it is error prone for her not to see HTML in a browser.
It would appear that she could develop the HTML in a HTML editor then cut
and pasete into the XML.

But I only showed one section - there are actually many sections in the
file.
And the HTML is usually quite simple.

If she could just view it before sending it to me would be sufficient.

Is there any way I could generate a web site that knows how to display the
document and that she could install on her machine and use that to view the
XML.
She does not have VS on her machine.
I assume she has or could have IIS.

Or maybe a Windows Form app that can display the HTML?
I believe there is a browser control that can be inserted inti a Window
Form.

Of course a web site would be the simplest for me to generate but I don't
know how to host it on her machine without VS.
Can a web site be precompiled and used without VS?

I'm looking for suggestions


Thanks












Examle of the file
<DataItem>

<Contents>

<![CDATA[

<p>

Titles & Names...

</p>


]]>

</Contents>

....

</DataItem>
 
G

Guest

Someone generates an XML file.
The data in the file is HTML.
She sends the file to me.
I upload it to my site.
A page on the site will extract the HTML and assign it to a Literal so it is
displayed.

The probem is that it is error prone for her not to see HTML in a browser..
It would appear that she could develop the HTML in a HTML editor then cut
and pasete into the XML.

But I only showed one section - there are actually many sections in the
file.
And the HTML is usually quite simple.

If she could just view it before sending it to me would be sufficient.

Is there any way I could generate a web site that knows how to display the
document and that she could install on her machine and use that to view the
XML.
She does not have VS on her machine.
I assume she has or could have IIS.

Or maybe a Windows Form app that can display the HTML?
I believe there is a browser control that can be inserted inti a Window
Form.

Of course a web site would be the simplest for me to generate but I don't
know how to host it on her machine without VS.
Can a web site be precompiled and used without VS?

I'm looking for suggestions

Thanks

Examle of the file
<DataItem>

<Contents>

<![CDATA[

<p>

Titles & Names...

</p>

]]>

</Contents>

...

</DataItem>

XSLT?
 
C

Cal Who

Someone generates an XML file.
The data in the file is HTML.
She sends the file to me.
I upload it to my site.
A page on the site will extract the HTML and assign it to a Literal so it
is
displayed.

The probem is that it is error prone for her not to see HTML in a browser.
It would appear that she could develop the HTML in a HTML editor then cut
and pasete into the XML.

But I only showed one section - there are actually many sections in the
file.
And the HTML is usually quite simple.

If she could just view it before sending it to me would be sufficient.

Is there any way I could generate a web site that knows how to display the
document and that she could install on her machine and use that to view
the
XML.
She does not have VS on her machine.
I assume she has or could have IIS.

Or maybe a Windows Form app that can display the HTML?
I believe there is a browser control that can be inserted inti a Window
Form.

Of course a web site would be the simplest for me to generate but I don't
know how to host it on her machine without VS.
Can a web site be precompiled and used without VS?

I'm looking for suggestions

Thanks

Examle of the file
<DataItem>

<Contents>

<![CDATA[

<p>

Titles & Names...

</p>

]]>

</Contents>

...

</DataItem>

XSLT?

I had never heard of XSLT so I had a little looking into to do. But I did
creat an XSLT file for my XML file and referenced it inside the XML file.
Then I clicked the XML file name and it opened in the browser which
displayed the HTML markup.

I copied that markup and inserted it into a file with an HTM extension and
then clicked that file name and the browser displayed the HTML.

Almost great. What I need is to click or do something to the XML file so
that a Browser displays the HTML markup formatted (that is, I don't want to
see the markup I need the marup to be executed by the browser)


Possible?

Thanks
 
C

Cal Who

Scott M. said:
As long as the HTML that is being written in the CDATA section is written
as XHTML, then extracting it is a breeze.

XHTML can be validated at http://validator.w3.org

-Scott
I need to validate by doing something locally. Most likely, simply seening
the HTML displayed in a browser. It has to be a simple process.


Thanks
 
S

Scott M.

Cal Who said:
I need to validate by doing something locally. Most likely, simply seening
the HTML displayed in a browser. It has to be a simple process.


Thanks

Unfortunately, it's not a simple matter. Seeing the markup interpreted by a
browser is hardly a way to "validate" the HTML. HTML is "interpreted" by
browsers, which means that it can be written incorrectly, but the browser
may still "interpret" it correctly. Not only that, but what one browser
interprets one way may very well be interpreted by a different browser (or
different version of the same browser) entirely differently. This is
exactly why XHTML was created - - to provide, not only a more strict way to
write HTML, but more importantly a way to validate it.

XSLT isn't going to tell you if you've used the tags and attributes
correctly, it's only going to tell you if the tags and attributes are
"well-formed". It wouldn't pick up on semantic errors like
<b><p>text</p></b>.

For this, you need to validate your HTML against a validator program.
Browsers don't validate - - they interpret.

-Scott
 
C

Cal Who

Scott M. said:
Unfortunately, it's not a simple matter. Seeing the markup interpreted by
a browser is hardly a way to "validate" the HTML.

What I need is to see how it looks in a browser.
I don't need to validate it.
Just want to see what it looks like.

You introduced the word "validate" and I picked it up - I shouldn't have -
sorry that only confuses.

The thing is that the data in the XML file (that is, not the elements
themself) is HTML.
So if I use a browser and XSLT to extract that data it gets treated as text
by the browser and displayed as markup.
I need it displayd formated.



Thanks
 
S

Scott M.

Cal Who said:
What I need is to see how it looks in a browser.
I don't need to validate it.
Just want to see what it looks like.

Are you saying you want the tags & attributes parsed by the browser or not?
If you do, then looking at the parsed results won't help because different
browsers can/will show the same markup differently, as I described. This is
why it's so important to ensure that the markup is written properly, which
is what validation will accomplish.

If you are saying that you want to see the actual markup as the result, like
this: <p>here is some really <b>important</b> text.</p>., then all you need
to do is use LINQ to XML to extract the CDATA and then use the
Server.HTMLEncode method on that text to encode the markup so that it will
be rendered instead of parsed.

-Scott
 
C

Cal Who

I'm sorry I'm taking too much of your time and not getting to the problem.
If I click on the following XML file the browser will extract the CDATA
using the XSLT file and display text. But you can see that the text is
really HTML markup (including things like <p>)
I need it (or something) to take that markup and format it as it would have
had the markup come from a host.
I need to see Sunday in bold type.

Thanks


THE XML FILE

<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="sample1.xslt"?>

<DefaultDataItems>

<DataItem>
<Header>
<![CDATA[
<h4>
COMING EVENTS
</h4>
]]>
</Header>
<Contents>
<![CDATA[
<p>The Festival will be held at p.m. <b>Sunday</b>
</p>
<p>
The event will include a variety of homemade food

</p>

]]>

</Contents>
</DefaultDataItems>

THE XSLT FILE
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="DefaultDataItems/DataItem">
<b>Header :</b><br /><xsl:value-of select="Header" /><br/>
<b>Contents:</b><br /><xsl:value-of select="Contents" /><br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
S

Scott M.

Cal Who said:
I'm sorry I'm taking too much of your time and not getting to the problem.

It's no problem at all, I just want to make sure I'm giving you relevant
information.
If I click on the following XML file the browser will extract the CDATA
using the XSLT file and display text. But you can see that the text is
really HTML markup (including things like <p>)
I need it (or something) to take that markup and format it as it would
have had the markup come from a host.
I need to see Sunday in bold type.

Ok, so while this works, it will ONLY work as long as the HTML that is
embedded into the CDATA section is "valid". If there are any HTML errors
(which) browsers don't alert you to, the browser *may* display something
that your eyeballs say is ok, but is actually incorrect HTML.

This is the biggest issue for people to understand about HTML, as I've said,
browsers don't "validate" what they are displaying, they simply "interpret"
what they've been given and different browsers are free to interpret the
same HTML differently.

While this solution *may* seem to work for you, the minute the CDATA has
improperly written HTML, this solution can fall apart.

This is exactly why validation is really the only bullet-proof way of
knowing that what your eyeballs are seeing is, in fact, what everyone's
eyeballs will see.

-Scott
Thanks


THE XML FILE

<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="sample1.xslt"?>

<DefaultDataItems>

<DataItem>
<Header>
<![CDATA[
<h4>
COMING EVENTS
</h4>
]]>
</Header>
<Contents>
<![CDATA[
<p>The Festival will be held at p.m. <b>Sunday</b>
</p>
<p>
The event will include a variety of homemade food

</p>

]]>

</Contents>
</DefaultDataItems>

THE XSLT FILE
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="DefaultDataItems/DataItem">
<b>Header :</b><br /><xsl:value-of select="Header" /><br/>
<b>Contents:</b><br /><xsl:value-of select="Contents" /><br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
G

Guest

Almost great. What I need is to click or do something to the XML file so
that a Browser displays the HTML markup formatted (that is, I don't want to
see the markup I need the marup to be executed by the browser)

You upload the file to the site and output it to a Literal Control.
Instead of showing its content in Literal, add a hyperlink and link it
to your XML file.

Hope this helps
 
C

Cal Who

Almost great. What I need is to click or do something to the XML file so
that a Browser displays the HTML markup formatted (that is, I don't want
to
see the markup I need the marup to be executed by the browser)

You upload the file to the site and output it to a Literal Control.
Instead of showing its content in Literal, add a hyperlink and link it
to your XML file.

Hope this helps

Yes, thanks
 
C

Cal Who

Thanks
Scott M. said:
Cal Who said:
I'm sorry I'm taking too much of your time and not getting to the
problem.

It's no problem at all, I just want to make sure I'm giving you relevant
information.
If I click on the following XML file the browser will extract the CDATA
using the XSLT file and display text. But you can see that the text is
really HTML markup (including things like <p>)
I need it (or something) to take that markup and format it as it would
have had the markup come from a host.
I need to see Sunday in bold type.

Ok, so while this works, it will ONLY work as long as the HTML that is
embedded into the CDATA section is "valid". If there are any HTML errors
(which) browsers don't alert you to, the browser *may* display something
that your eyeballs say is ok, but is actually incorrect HTML.

This is the biggest issue for people to understand about HTML, as I've
said, browsers don't "validate" what they are displaying, they simply
"interpret" what they've been given and different browsers are free to
interpret the same HTML differently.

While this solution *may* seem to work for you, the minute the CDATA has
improperly written HTML, this solution can fall apart.

This is exactly why validation is really the only bullet-proof way of
knowing that what your eyeballs are seeing is, in fact, what everyone's
eyeballs will see.

-Scott
Thanks


THE XML FILE

<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="sample1.xslt"?>

<DefaultDataItems>

<DataItem>
<Header>
<![CDATA[
<h4>
COMING EVENTS
</h4>
]]>
</Header>
<Contents>
<![CDATA[
<p>The Festival will be held at p.m. <b>Sunday</b>
</p>
<p>
The event will include a variety of homemade food

</p>

]]>

</Contents>
</DefaultDataItems>

THE XSLT FILE
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="DefaultDataItems/DataItem">
<b>Header :</b><br /><xsl:value-of select="Header" /><br/>
<b>Contents:</b><br /><xsl:value-of select="Contents" /><br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top