The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> All text content of a website in a single XML
ZlsetrdX
post Oct 20 2008, 06:54 PM
Post #1





Group: Members
Posts: 3
Joined: 20-October 08
Member No.: 6,941



I'm a newbie building my Website and also just getting into XML. I want to have all the text content of my Website in a single XML file, organized in text blocks for each section (profile, services, etc). Then marking every blocks in the XML so I can refer to each independent block from each different HTML page instead of having each block inside the HTML. I have no idea on whether this is possible or not, or how to do it. Please help!
God bless you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Tom H.
post Oct 20 2008, 08:09 PM
Post #2


Advanced Member
****

Group: Members
Posts: 129
Joined: 24-August 06
Member No.: 14



A Google search for "tidy convert to xml" might send you in the right direction.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 20 2008, 08:28 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Hm. I thought this was going to happen on the server? You need some program or programming anyhow.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ZlsetrdX
post Oct 21 2008, 02:23 PM
Post #4





Group: Members
Posts: 3
Joined: 20-October 08
Member No.: 6,941



Thanks, Tom H. However, I'm following the XHTML tutorial of W3schools so I think I'm already writing my website in XHTML.
This is my website. Sorry for my poor explanation. What I mean is like this:

1) Move all the text content of my website to mywebsite.xml, organized in text blocks corresponding to each web page
E.g.: I cut the text content from the HMTL of the "my profile" web page and paste it to the XML file as a text block under a suitable heading. By text content I mean all the text that is viewable, like "Autodidact. Freelance English-Spanish translator and style proofreader..."

2) Mark each text block in the XML
E.g.: I mark the above mentioned text block with an id, "profile"

3) Place a link in the page's HTML to the corresponding text block in mywebsite.xml, so it calls the text when the page is loaded
E.g.: where the original text content of the "my profile" page was, I place a link to the corresponding text block marked "profile", so the text is called and viewable when the page is loaded

That way I'd manage text content more easily. For example, the text of my menu entries is the same in all pages. I want that when I need to modify the text of a menu entry (e.g. replacing "graphic design" by "visual art"), I can just do it in the XML file and that's all, instead of making the change in every web page. Also having all of my website's text content stored in a single file makes it easier to locate and modify strings.

How can this be done? Maybe Xpointer would do it? Another way?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 21 2008, 03:16 PM
Post #5


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



I don't have any experience doing this with a single XML file, but see the FAQ entry How do I include one file in another? Some of the HTML preprocessors can generate multiple HTML files from a single input file, and I'm sure other content management systems can do something similar.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 21 2008, 03:29 PM
Post #6


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(ZlsetrdX @ Oct 21 2008, 09:23 PM) *

Thanks, Tom H. However, I'm following the XHTML tutorial of W3schools so I think I'm already writing my website in XHTML.
This is my website. Sorry for my poor explanation. What I mean is like this:

1) Move all the text content of my website to mywebsite.xml, organized in text blocks corresponding to each web page
E.g.: I cut the text content from the HMTL of the "my profile" web page and paste it to the XML file as a text block under a suitable heading. By text content I mean all the text that is viewable, like "Autodidact. Freelance English-Spanish translator and style proofreader..."

2) Mark each text block in the XML
E.g.: I mark the above mentioned text block with an id, "profile"

This sounds unpractical. If you have many almost identical pages (such as product pages in an online store) you might store the unique information in a data base.

QUOTE
3) Place a link in the page's HTML to the corresponding text block in mywebsite.xml, so it calls the text when the page is loaded
E.g.: where the original text content of the "my profile" page was, I place a link to the corresponding text block marked "profile", so the text is called and viewable when the page is loaded

But where will you store information about the HTML elements used in the text block? E.g., a menu contains a separate A element for every link, so in this simple model you must make each link text a separate text block and insert each such text block in its own A element.

QUOTE
That way I'd manage text content more easily. For example, the text of my menu entries is the same in all pages. I want that when I need to modify the text of a menu entry (e.g. replacing "graphic design" by "visual art"), I can just do it in the XML file and that's all, instead of making the change in every web page.

An easier way is to let the server include the menu's HTML from an external text file (using SSI or PHP), see also Darin's link.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 21 2008, 11:03 PM
Post #7


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE(ZlsetrdX @ Oct 21 2008, 08:54 AM) *

I'm a newbie building my Website and also just getting into XML. I want to have all the text content of my Website in a single XML file, organized in text blocks for each section (profile, services, etc). Then marking every blocks in the XML so I can refer to each independent block from each different HTML page instead of having each block inside the HTML. I have no idea on whether this is possible or not, or how to do it. Please help!


I think you should look at what happened to the people in Iceland who fell for having home loans in Japanese yen.

Anyway, this all seems like a Bad Idea. XHTML is a Bad Idea; XML is a metasyntax for storing serialised information, which is not what you need. It's attractively "readable" (which of course it was meant to be), but a database is the way to store structured content on your server.

Where is your website? What is its content all about?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 22 2008, 09:08 AM
Post #8


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(ZlsetrdX @ Oct 21 2008, 09:23 PM) *
I'm following the XHTML tutorial of W3schools


Speaking of which, their XML tutorial shows various examples on how to display XML in browsers, but the only reliable way should be to use a server-side script that creates ordinary (X)HTML of the XML content before sending the page to the visitor's browser. OTOH you don't have to use XML to structure the content on the server, you can use e.g. (server-script) variables, data base entries or even ordinary HTML tags instead of XML (as a silly example I keep the whole news archive of a site in one large hidden HTML document, and let PHP insert selected parts of it into the web pages shown to visitors).

The other W3school examples have pretty serious usability problems:

* If you display XML directly in the browser (styled with CSS or with XSLT) the structural/semantic meanings of the XML elements will be unfamiliar to both users and browsers, so it relies on the style sheet to be readable (in contrast, browsers apply their default styles on HTML elements if no other style sheet is supplied). Alas none of the examples specify a style media type, making it possibly problematic for print or for blind users. Also you can't create links with style sheets, and AFAIK style sheets can't let you put text in browser window's TITLE bar (where a <title> element is usually rendered), if you'd want that.

* You can also let the Javascript DOM insert XML content into existing HTML elements, but this requires a newer browser with javascript enabled. Since search engines don't run javascript they will see none of the XML content.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ZlsetrdX
post Oct 23 2008, 01:13 PM
Post #9





Group: Members
Posts: 3
Joined: 20-October 08
Member No.: 6,941



A preprocessor is an app, isn't it? Well, I'd prefer not to use any editors, apps, or any tools other than languages I can write myself (I like to write code, the syntax and stuff, and since I'm not a pro I have chance to try and mess up).

Mine is a personal website mostly about my translation services, not a large one but some elements are always repeated.

I think I'll go with PHP. BTW, any real examples you know of would be very appreciated.
Thanks everyone. God bless you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 23 2008, 01:19 PM
Post #10


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE(ZlsetrdX @ Oct 23 2008, 08:13 PM) *

A preprocessor is an app, isn't it?


Not necessarily. PHP can be a preprocessor. I haven't played enough with XML to be able to give any specific advice, pretty much confused myself, but you will need programming, even if not a program in the sense you mean. Something on the server must read from the XML file, grab what it wants and do something with it, right?

Not sure what this does, but take a look.
http://php.net/xml
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 23 2008, 02:43 PM
Post #11


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE(pandy @ Oct 24 2008, 03:19 AM) *

QUOTE(ZlsetrdX @ Oct 23 2008, 08:13 PM) *

A preprocessor is an app, isn't it?


Not necessarily. PHP can be a preprocessor. I haven't played enough with XML to be able to give any specific advice, pretty much confused myself, but you will need programming, even if not a program in the sense you mean. Something on the server must read from the XML file, grab what it wants and do something with it, right?



What's an "App"? Just an (application) program? Then PHP is certainly an "app". But is it a "preprocessor"? Well, usually that means something that processes something before the More Important Other Thing processes it, in which case... hmm, any answer seems just about equally as meaningless as any other.

But yes, the basic point the OP is missing is that XML is just a way of representing (or storing, if you like) structured information.
QUOTE


Not sure what this does, but take a look.
http://php.net/xml


Well, it's the PHP library of functions for handling XML. But storing your website content in XML is going to be a bigger job than storing it in a database, and most hosts seem to provide PHP+MySQL (or equivalent) as standard these days, so what's the point?

This post has been edited by Brian Chandler: Oct 23 2008, 02:44 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 23 2008, 03:20 PM
Post #12


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



I am reminded of the story of Mel.

Anyway, the preprocessor that I use is written in Perl, so I've been able to make small changes when necessary. But I'm not sure what you're really asking for at this point.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 07:13 PM