Click to See Complete Forum and Search --> : Help with an XML file


WalstonNet
06-20-2009, 02:34 PM
I am setting up a cms system for a client (Power CMS from WebAssist). I keep running into a problem with the xml. WebAssist support told me that I could add a stylesheet dropdown to the wysiwyg editor, by creating and referencing an xml file. So I created the file, I don't really know a whole lot about xml, well nothing really, but I need to get this done this weekend, and it looks like they don't answer their support tickets on the weekends. So I am desperate for a little help.

I don't see an upload option here, so I will just copy and paste the xml file at the end of this post. If someone who knows xml could look at it and let me know if it looks correct, as in there are no errors in it. I think there might be because every time I reference it in one of the config files, it makes the wysiwyg editor go blank. I unreference it and it goes back to normal. So I think there may be something with my xml file. Any help would be greatly appreciated! I am just trying to get a style dropdown in the editor so my client can use the styles from the site's stylesheet so everything stays consistent, and so that she doesn't have to select a font, a font color, a font size, attribute, etc. You get it. So I just need to know if this xml file is correct. Help, please? Thank you!!!

Here's the xml file:

<?xml version="1.0" encoding="utf-8" ?>

<?xml-stylesheet type="text/css" href="http://foxfirenews.com/css/styles.css"?>

<style name="text" element="span"><attribute name="class" value="text"></style>

<style name="textitalic" element="span"><attribute name="class" value="textitalic"></style>

<style name="textunderline" element="span"><attribute name="class" value="textunderline"></style>

<style name="textunderlineitalic" element="span"><attribute name="class" value="textunderlineitalic"></style>

<style name="smalltext" element="span"><attribute name="class" value="smalltext"></style>

<style name="title" element="span"><attribute name="class" value="title"></style>

<style name="smallbold" element="span"><attribute name="class" value="smallbold"></style>

<style name="bold" element="span"><attribute name="class" value="bold"></style>

<style name="whitesmall" element="span"><attribute name="class" value="whitesmall"></style>

<style name="redtext" element="span"><attribute name="class" value="redtext"></style>

<style name="redlarge" element="span"><attribute name="class" value="redlarge"></style>

<style name="redsmallbold" element="span"><attribute name="class" value="redsmallbold"></style>

<style name="redtitle" element="span"><attribute name="class" value="redtitle"></style>

<style name="redsmall" element="span"><attribute name="class" value="redsmall"></style>

<style name="whitesmallbold" element="span"><attribute name="class" value="whitesmallbold"></style>

<style name="table" element="span"><attribute name="class" value="table"></style>

<style name="error" element="span"><attribute name="class" value="error"></style>

<style name="forminput" element="span"><attribute name="class" value="forminput"></style>

<style name="formerror" element="span"><attribute name="class" value="formerror"></style>

WalstonNet
06-20-2009, 06:39 PM
No one can tell me if this xml file is valid?

Charles
06-20-2009, 07:05 PM
No, that's not valid XML. There is no root element.

WalstonNet
06-20-2009, 07:21 PM
Thank you Charles. Would you be willing to tell me how I could fix it? I'm clueless when it comes to xml, but take instruction well. Would you be so kind as to help me fix it, please?

Thank you for responding!!!

Charles
06-20-2009, 08:16 PM
We can easily make that well-formed by adding a root element. But we can't make it valid without knowing just what that root needs to be. Do you have a DTD or some specs. for that file?

WalstonNet
06-20-2009, 08:27 PM
Oh man, I don't have any idea what you just said. I don't have a DTD or specs, or maybe I do, but I don't know what they are so I don't know. I am just trying to get a stylesheet dropdown into a wysiwyg editor, WebAssist Power CMS to be exact.

I was told be their support that I needed to make a path to the xml file I created in two javascript files, here is what that is in both javascript files:

FCKConfig.EditorAreaCSS = 'http://foxfirenews.com/css/styles.css'; // relative to fckeditor/editor/fckeditor.html
FCKConfig.BodyClass = '';
FCKConfig.StylesXmlPath = '../mystyles.xml'; // relative to fckeditor/editor/fckeditor.html

So I did that and then created the xml file the way they told me to, but it doesn't work. After your last post I did think about something, I added <Styles> and </Styles> to that file to see if that helped. I then uploaded it again and re-referenced it in the two js files, and now I don't get a blank editor, but I still don't get the dropdown to work, it's just empty. I am sooooooo lost.

Even though WebAssist's support doesn't work on the weekends, they're not much help even when they are in because they won't walk me through stuff, they just assume I know everything, which if I did, I wouldn't need support from them, so they're not much help. So I thought I'd try posting in an xml forum to see if I could get some help.

Can you give me an example of what a root element might be and what a DTD is so I can try to get you that information?

Charles
06-20-2009, 09:15 PM
Somewhere, somehow they have described how the XML file should look. With luck they have given an example. If you can, please post those or give a link.

WalstonNet
06-20-2009, 09:28 PM
Ok, what I did was just printed the whole support ticket into a pdf and attached that. Hopefully that will give some info you understand that I don't.

Thanks again for your help!!!

Charles
06-21-2009, 05:47 AM
If you look at the example given on page 3 of that document you will see that the root element needs to be "Styles". And you have some other fatal errors there. XML is case sensitive so your other elements need to be "Style" and "Attribute" not "style" and "attribute".

WalstonNet
06-21-2009, 12:07 PM
So I have everything correct except capitalizing those things???

Charles
06-21-2009, 12:31 PM
No, you have also omitted the root element "Styles".

WalstonNet
06-21-2009, 12:35 PM
Can you tell me how to add it???? Please?
Does "element" need to be capitalized too?

WalstonNet
06-21-2009, 12:39 PM
Here's what I've changed:

<?xml version="1.0" encoding="utf-8" ?>

<?xml-stylesheet type="text/css" href="http://foxfirenews.com/css/styles.css"?>

<Styles>

<Style name="text" element="span"><Attribute name="class" value="text"></Style>

<Style name="textitalic" element="span"><Attribute name="class" value="textitalic"></Style>

<Style name="textunderline" element="span"><Attribute name="class" value="textunderline"></Style>

<Style name="textunderlineitalic" element="span"><Attribute name="class" value="textunderlineitalic"></Style>

<Style name="smalltext" element="span"><Attribute name="class" value="smalltext"></Style>

<Style name="title" element="span"><Attribute name="class" value="title"></Style>

<Style name="smallbold" element="span"><Attribute name="class" value="smallbold"></Style>

<Style name="bold" element="span"><Attribute name="class" value="bold"></Style>

<Style name="whitesmall" element="span"><Attribute name="class" value="whitesmall"></Style>

<Style name="redtext" element="span"><Attribute name="class" value="redtext"></Style>

<Style name="redlarge" element="span"><Attribute name="class" value="redlarge"></Style>

<Style name="redsmallbold" element="span"><Attribute name="class" value="redsmallbold"></Style>

<Style name="redtitle" element="span"><Attribute name="class" value="redtitle"></Style>

<Style name="redsmall" element="span"><Attribute name="class" value="redsmall"></Style>

<Style name="whitesmallbold" element="span"><Attribute name="class" value="whitesmallbold"></Style>

<Style name="table" element="span"><Attribute name="class" value="table"></Style>

<Style name="error" element="span"><Attribute name="class" value="error"></Style>

<Style name="forminput" element="span"><Attribute name="class" value="forminput"></Style>

<Style name="formerror" element="span"><Attribute name="class" value="formerror"></Style>

</Styles>

Charles
06-21-2009, 12:47 PM
You are getting closer. In XML all elements must be closed and properly nested. So <Attribute name="class" value="text"/>And make friends with The Validator (http://validator.w3.org/).

WalstonNet
06-21-2009, 01:08 PM
Ok, what about this:

<?xml version="1.0" encoding="utf-8" ?>

<?xml-stylesheet type="text/css" href="http://foxfirenews.com/css/styles.css"?>

<Styles>

<Style name="text" element="span"><Attribute name="class" value="text"/></Style>

<Style name="textitalic" element="span"><Attribute name="class" value="textitalic"/></Style>

<Style name="textunderline" element="span"><Attribute name="class" value="textunderline"/></Style>

<Style name="textunderlineitalic" element="span"><Attribute name="class" value="textunderlineitalic"/></Style>

<Style name="smalltext" element="span"><Attribute name="class" value="smalltext"/></Style>

<Style name="title" element="span"><Attribute name="class" value="title"/></Style>

<Style name="smallbold" element="span"><Attribute name="class" value="smallbold"/></Style>

<Style name="bold" element="span"><Attribute name="class" value="bold"/></Style>

<Style name="whitesmall" element="span"><Attribute name="class" value="whitesmall"/></Style>

<Style name="redtext" element="span"><Attribute name="class" value="redtext"/></Style>

<Style name="redlarge" element="span"><Attribute name="class" value="redlarge"/></Style>

<Style name="redsmallbold" element="span"><Attribute name="class" value="redsmallbold"/></Style>

<Style name="redtitle" element="span"><Attribute name="class" value="redtitle"/></Style>

<Style name="redsmall" element="span"><Attribute name="class" value="redsmall"/></Style>

<Style name="whitesmallbold" element="span"><Attribute name="class" value="whitesmallbold"/></Style>

<Style name="table" element="span"><Attribute name="class" value="table"/></Style>

<Style name="error" element="span"><Attribute name="class" value="error"/></Style>

<Style name="forminput" element="span"><Attribute name="class" value="forminput"/></Style>

<Style name="formerror" element="span"><Attribute name="class" value="formerror"/></Style>

</Styles>

And what about the root element styles? Do I still need that too or was that it? I'm confused!

WalstonNet
06-21-2009, 02:28 PM
Why can't you just define the actual styles in the xml file without referring to the css file? Can't you just put the styles in the xml file itself and avoid the css all together?