Index: /FCKeditor/trunk/editor/_source/classes/fckstyle.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckstyle.js	(revision 850)
+++ /FCKeditor/trunk/editor/_source/classes/fckstyle.js	(revision 851)
@@ -516,6 +516,6 @@
 					//      has matches in the attribute value.
 					if ( attValue == null ||
-							( typeof attValue == 'string' && element.getAttribute( attName, 2 ) == attValue ) ||
-							attValue.test( element.getAttribute( attName, 2 ) ) )
+							( attValue.test && attValue.test( element.getAttribute( attName, 2 ) ) ) ||
+							( typeof attValue == 'string' && element.getAttribute( attName, 2 ) == attValue ) )
 						FCKDomTools.RemoveAttribute( element, attName ) ;
 				}
Index: /FCKeditor/trunk/editor/_source/classes/fckxml.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckxml.js	(revision 851)
+++ /FCKeditor/trunk/editor/_source/classes/fckxml.js	(revision 851)
@@ -0,0 +1,108 @@
+﻿/*
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2007 Frederico Caldeira Knabben
+ *
+ * == BEGIN LICENSE ==
+ *
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ *
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ *
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ *
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ *
+ * == END LICENSE ==
+ *
+ * FCKXml Class: class to load and manipulate XML files.
+ * (IE specific implementation)
+ */
+
+var FCKXml = function()
+{
+	this.Error = false ;
+}
+
+FCKXml.GetAttribute = function( node, attName, defaultValue )
+{
+	var attNode = node.attributes.getNamedItem( attName ) ;
+	return attNode ? attNode.value : defaultValue ;
+}
+
+/**
+ * Transforms a XML element node in a JavaScript object. Attributes defined for
+ * the element will be available as properties, as long as child  element
+ * nodes, but the later will generate arrays with property names prefixed with "$".
+ *
+ * For example, the following XML element:
+ *
+ *		<SomeNode name="Test" key="2">
+ *			<MyChild id="10">
+ *				<OtherLevel name="Level 3" />
+ *			</MyChild>
+ *			<MyChild id="25" />
+ *			<AnotherChild price="499" />
+ *		</SomeNode>
+ *
+ * ... results in the following object:
+ *
+ *		{
+ *			name : "Test",
+ *			key : "2",
+ *			$MyChild :
+ *			[
+ *				{
+ *					id : "10",
+ *					$OtherLevel :
+ *					{
+ *						name : "Level 3"
+ *					}
+ *				},
+ *				{
+ *					id : "25"
+ *				}
+ *			],
+ *			$AnotherChild :
+ *			[
+ *				{
+ *					price : "499"
+ *				}
+ *			]
+ *		}
+ */
+FCKXml.TransformToObject = function( element )
+{
+	if ( !element )
+		return null ;
+
+	var obj = {} ;
+
+	var attributes = element.attributes ;
+	for ( var i = 0 ; i < attributes.length ; i++ )
+	{
+		var att = attributes[i] ;
+		obj[ att.name ] = att.value ;
+	}
+
+	var childNodes = element.childNodes ;
+	for ( i = 0 ; i < childNodes.length ; i++ )
+	{
+		var child = childNodes[i] ;
+
+		if ( child.nodeType == 1 )
+		{
+			var childName = '$' + child.nodeName ;
+			var childList = obj[ childName ] ;
+			if ( !childList )
+				childList = obj[ childName ] = [] ;
+
+			childList.push( this.TransformToObject( child ) ) ;
+		}
+	}
+
+	return obj ;
+}
Index: /FCKeditor/trunk/editor/_source/classes/fckxml_gecko.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckxml_gecko.js	(revision 850)
+++ /FCKeditor/trunk/editor/_source/classes/fckxml_gecko.js	(revision 851)
@@ -22,72 +22,66 @@
  */
 
-var FCKXml = function()
-{}
+FCKXml.prototype =
+{
+	LoadUrl : function( urlToCall )
+	{
+		this.Error = false ;
+		var oFCKXml = this ;
 
-FCKXml.prototype.LoadUrl = function( urlToCall )
-{
-	this.Error = false ;
-	var oFCKXml = this ;
+		var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
+		oXmlHttp.open( "GET", urlToCall, false ) ;
+		oXmlHttp.send( null ) ;
 
-	var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
-	oXmlHttp.open( "GET", urlToCall, false ) ;
-	oXmlHttp.send( null ) ;
+		if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
+			this.DOMDocument = oXmlHttp.responseXML ;
+		else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
+			this.DOMDocument = oXmlHttp.responseXML ;
+		else
+			this.DOMDocument = null ;
 
-	if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
-		this.DOMDocument = oXmlHttp.responseXML ;
-	else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
-		this.DOMDocument = oXmlHttp.responseXML ;
-	else
-		this.DOMDocument = null ;
+		if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )
+		{
+			this.Error = true ;
+			if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )
+				alert( 'URL requested: "' + urlToCall + '"\r\n' +
+							'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +
+							'Response text:\r\n' + oXmlHttp.responseText ) ;
 
-	if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )
+		}
+	},
+
+	SelectNodes : function( xpath, contextNode )
 	{
-		this.Error = true ;
-		if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )
-			alert( 'URL requested: "' + urlToCall + '"\r\n' +
-						'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +
-						'Response text:\r\n' + oXmlHttp.responseText ) ;
+		if ( this.Error )
+			return new Array() ;
 
+		var aNodeArray = new Array();
+
+		var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
+				this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
+		if ( xPathResult )
+		{
+			var oNode = xPathResult.iterateNext() ;
+			while( oNode )
+			{
+				aNodeArray[aNodeArray.length] = oNode ;
+				oNode = xPathResult.iterateNext();
+			}
+		}
+		return aNodeArray ;
+	},
+
+	SelectSingleNode : function( xpath, contextNode )
+	{
+		if ( this.Error )
+			return null ;
+
+		var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
+				this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
+
+		if ( xPathResult && xPathResult.singleNodeValue )
+			return xPathResult.singleNodeValue ;
+		else
+			return null ;
 	}
-}
-
-FCKXml.prototype.SelectNodes = function( xpath, contextNode )
-{
-	if ( this.Error )
-		return new Array() ;
-
-	var aNodeArray = new Array();
-
-	var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
-			this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
-	if ( xPathResult )
-	{
-		var oNode = xPathResult.iterateNext() ;
-		while( oNode )
-		{
-			aNodeArray[aNodeArray.length] = oNode ;
-			oNode = xPathResult.iterateNext();
-		}
-	}
-	return aNodeArray ;
-}
-
-FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
-{
-	if ( this.Error )
-		return null ;
-
-	var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
-			this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
-
-	if ( xPathResult && xPathResult.singleNodeValue )
-		return xPathResult.singleNodeValue ;
-	else
-		return null ;
-}
-
-FCKXml.GetAttribute = function( node, attName, defaultValue )
-{
-	var attNode = node.attributes.getNamedItem( attName ) ;
-	return attNode ? attNode.value : defaultValue ;
-}
+} ;
Index: /FCKeditor/trunk/editor/_source/classes/fckxml_ie.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckxml_ie.js	(revision 850)
+++ /FCKeditor/trunk/editor/_source/classes/fckxml_ie.js	(revision 851)
@@ -23,74 +23,66 @@
  */
 
-var FCKXml = function()
+FCKXml.prototype =
 {
-	this.Error = false ;
-}
+	LoadUrl : function( urlToCall )
+	{
+		this.Error = false ;
 
-FCKXml.prototype.LoadUrl = function( urlToCall )
-{
-	this.Error = false ;
+		var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
 
-	var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
+		if ( !oXmlHttp )
+		{
+			this.Error = true ;
+			return ;
+		}
 
-	if ( !oXmlHttp )
+		oXmlHttp.open( "GET", urlToCall, false ) ;
+
+		oXmlHttp.send( null ) ;
+
+		if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
+			this.DOMDocument = oXmlHttp.responseXML ;
+		else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
+		{
+			this.DOMDocument = FCKTools.CreateXmlObject( 'DOMDocument' ) ;
+			this.DOMDocument.async = false ;
+			this.DOMDocument.resolveExternals = false ;
+			this.DOMDocument.loadXML( oXmlHttp.responseText ) ;
+		}
+		else
+		{
+			this.DOMDocument = null ;
+		}
+
+		if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )
+		{
+			this.Error = true ;
+			if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )
+				alert( 'URL requested: "' + urlToCall + '"\r\n' +
+							'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +
+							'Response text:\r\n' + oXmlHttp.responseText ) ;
+		}
+	},
+
+	SelectNodes : function( xpath, contextNode )
 	{
-		this.Error = true ;
-		return ;
+		if ( this.Error )
+			return new Array() ;
+
+		if ( contextNode )
+			return contextNode.selectNodes( xpath ) ;
+		else
+			return this.DOMDocument.selectNodes( xpath ) ;
+	},
+
+	SelectSingleNode : function( xpath, contextNode )
+	{
+		if ( this.Error )
+			return null ;
+
+		if ( contextNode )
+			return contextNode.selectSingleNode( xpath ) ;
+		else
+			return this.DOMDocument.selectSingleNode( xpath ) ;
 	}
-
-	oXmlHttp.open( "GET", urlToCall, false ) ;
-
-	oXmlHttp.send( null ) ;
-
-	if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
-		this.DOMDocument = oXmlHttp.responseXML ;
-	else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
-	{
-		this.DOMDocument = FCKTools.CreateXmlObject( 'DOMDocument' ) ;
-		this.DOMDocument.async = false ;
-		this.DOMDocument.resolveExternals = false ;
-		this.DOMDocument.loadXML( oXmlHttp.responseText ) ;
-	}
-	else
-	{
-		this.DOMDocument = null ;
-	}
-
-	if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )
-	{
-		this.Error = true ;
-		if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )
-			alert( 'URL requested: "' + urlToCall + '"\r\n' +
-						'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +
-						'Response text:\r\n' + oXmlHttp.responseText ) ;
-	}
-}
-
-FCKXml.prototype.SelectNodes = function( xpath, contextNode )
-{
-	if ( this.Error )
-		return new Array() ;
-
-	if ( contextNode )
-		return contextNode.selectNodes( xpath ) ;
-	else
-		return this.DOMDocument.selectNodes( xpath ) ;
-}
-
-FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
-{
-	if ( this.Error )
-		return null ;
-
-	if ( contextNode )
-		return contextNode.selectSingleNode( xpath ) ;
-	else
-		return this.DOMDocument.selectSingleNode( xpath ) ;
-}
-
-FCKXml.GetAttribute = function( node, attName, defaultValue )
-{
-	var attNode = node.attributes.getNamedItem( attName ) ;
-	return attNode ? attNode.value : defaultValue ;
-}
+} ;
Index: /FCKeditor/trunk/editor/_source/internals/fckregexlib.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckregexlib.js	(revision 850)
+++ /FCKeditor/trunk/editor/_source/internals/fckregexlib.js	(revision 851)
@@ -91,4 +91,6 @@
 // All variables defined in a style attribute or style definition. The variable
 // name is returned with $2.
-StyleVariableAttName : /#\(\s*("|')(.+?)\1[^\)]*\s*\)/g
+StyleVariableAttName : /#\(\s*("|')(.+?)\1[^\)]*\s*\)/g,
+
+RegExp : /^\/(.*)\/([gim]*)$/
 } ;
Index: /FCKeditor/trunk/editor/_source/internals/fckstyles.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckstyles.js	(revision 850)
+++ /FCKeditor/trunk/editor/_source/internals/fckstyles.js	(revision 851)
@@ -283,7 +283,9 @@
 		var xml = new FCKXml() ;
 		xml.LoadUrl( stylesXmlPath ) ;
+		
+		var stylesXmlObj = FCKXml.TransformToObject( xml.SelectSingleNode( 'Styles' ) ) ;
 
 		// Get the "Style" nodes defined in the XML file.
-		var styleNodes = xml.SelectNodes( 'Styles/Style' ) ;
+		var styleNodes = stylesXmlObj.$Style ;
 
 		// Add each style to our "Styles" collection.
@@ -292,5 +294,5 @@
 			var styleNode = styleNodes[i] ;
 
-			var element = FCKXml.GetAttribute( styleNode, 'element', '' ).toLowerCase() ;
+			var element = ( styleNode.element || '' ).toLowerCase() ;
 
 			if ( element.length == 0 )
@@ -305,27 +307,57 @@
 
 			// Get the attributes defined for the style (if any).
-			var attNodes = xml.SelectNodes( 'Attribute', styleNode ) ;
+			var attNodes = styleNode.$Attribute || [] ;
 
 			// Add the attributes to the style definition object.
 			for ( var j = 0 ; j < attNodes.length ; j++ )
 			{
-				styleDef.Attributes[ FCKXml.GetAttribute( attNodes[j], 'name' ) ] =
-					FCKXml.GetAttribute( attNodes[j], 'value' ) ;
+				styleDef.Attributes[ attNodes[j].name ] = attNodes[j].value ;
 			}
 
 			// Get the styles defined for the style (if any).
-			var cssStyleNodes = xml.SelectNodes( 'Style', styleNode ) ;
+			var cssStyleNodes = styleNode.$Style || [] ;
 
 			// Add the attributes to the style definition object.
-			for ( var j = 0 ; j < cssStyleNodes.length ; j++ )
+			for ( j = 0 ; j < cssStyleNodes.length ; j++ )
 			{
-				styleDef.Styles[ FCKXml.GetAttribute( cssStyleNodes[j], 'name' ) ] =
-					FCKXml.GetAttribute( cssStyleNodes[j], 'value' ) ;
+				styleDef.Styles[ cssStyleNodes[j].name ] = cssStyleNodes[j].value ;
 			}
 
-			// TODO: Implement overrides loading.
+			// Load override definitions.
+			var cssStyleOverrideNodes = styleNode.$Override ;
+			if ( cssStyleOverrideNodes ) 
+			{
+				for ( j = 0 ; j < cssStyleOverrideNodes.length ; j++ )
+				{
+					var overrideNode = cssStyleOverrideNodes[j] ;
+					var overrideDef = 
+					{
+						Element : overrideNode.element
+					} ;
+					
+					var overrideAttNode = overrideNode.$Attribute ;
+					if ( overrideAttNode )
+					{
+						overrideDef.Attributes = {} ;
+						for ( var k = 0 ; k < overrideAttNode.length ; k++ )
+						{
+							var overrideAttValue = overrideAttNode[k].value || null ;
+							if ( overrideAttValue )
+							{
+								// Check if the override attribute value is a regular expression.
+								var regexMatch = overrideAttValue && FCKRegexLib.RegExp.exec( overrideAttValue ) ;
+								if ( regexMatch )
+									overrideAttValue = new RegExp( regexMatch[1], regexMatch[2] || '' ) ;
+							}
+							overrideDef.Attributes[ overrideAttNode[k].name ] = overrideAttValue ;
+						}
+					}
+					
+					styleDef.Overrides.push( overrideDef ) ;
+				}
+			}
 
 			var style = new FCKStyle( styleDef ) ;
-			style.Name = FCKXml.GetAttribute( styleNode, 'name', element ) ;
+			style.Name = styleNode.name || element ;
 			
 			if ( style.GetType() == FCK_STYLE_OBJECT )
Index: /FCKeditor/trunk/editor/fckeditor.html
===================================================================
--- /FCKeditor/trunk/editor/fckeditor.html	(revision 850)
+++ /FCKeditor/trunk/editor/fckeditor.html	(revision 851)
@@ -105,4 +105,5 @@
 LoadScript( '_source/internals/fcktablehandler.js' ) ;
 LoadScript( '_source/internals/fcktablehandler_' + sSuffix + '.js' ) ;
+LoadScript( '_source/classes/fckxml.js' ) ;
 LoadScript( '_source/classes/fckxml_' + sSuffix + '.js' ) ;
 
Index: /FCKeditor/trunk/fckpackager.xml
===================================================================
--- /FCKeditor/trunk/fckpackager.xml	(revision 850)
+++ /FCKeditor/trunk/fckpackager.xml	(revision 851)
@@ -115,4 +115,5 @@
 		<File path="editor/_source/internals/fcktablehandler.js" />
 		<File path="editor/_source/internals/fcktablehandler_ie.js" />
+		<File path="editor/_source/classes/fckxml.js" />
 		<File path="editor/_source/classes/fckxml_ie.js" />
 
@@ -210,4 +211,5 @@
 		<File path="editor/_source/internals/fcktablehandler.js" />
 		<File path="editor/_source/internals/fcktablehandler_gecko.js" />
+		<File path="editor/_source/classes/fckxml.js" />
 		<File path="editor/_source/classes/fckxml_gecko.js" />
 
Index: /FCKeditor/trunk/fckstyles.xml
===================================================================
--- /FCKeditor/trunk/fckstyles.xml	(revision 850)
+++ /FCKeditor/trunk/fckstyles.xml	(revision 851)
@@ -50,6 +50,10 @@
 	# These are core styles available as toolbar buttons.
 
-	<Style name="Bold" element="b" />
-	<Style name="Italic" element="i" />
+	<Style name="Bold" element="b">
+		<Override element="strong" />
+	</Style>
+	<Style name="Italic" element="i">
+		<Override element="em" />
+	</Style>
 	<Style name="Underline" element="u" />
 	<Style name="Strikethrough" element="strike" />
