You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sebastian Gooren (JIRA)" <ji...@apache.org> on 2008/08/21 01:56:44 UTC

[jira] Created: (WICKET-1796) When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception

When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception
--------------------------------------------------------------------------------------

                 Key: WICKET-1796
                 URL: https://issues.apache.org/jira/browse/WICKET-1796
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.4
         Environment: n/a
            Reporter: Sebastian Gooren


When using

@Override
    public String getMarkupType()
    {
        return "xml";
    }

in a webpage, I cannot use getLocalizer().getString( "xyz", this ) anymore. I traced it back to

Caused by: org.xml.sax.SAXParseException: Document root element "order", must match DOCTYPE root "null".

Apparently, the wicket localizer (org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource, line 142) decides to look for an XML properties file. Normally, this would be ok. But now, since I have an XML file in place which is the markup for the webpage, localization breaks. Wicket thinks that my markup file is an XML properties file.

Right now it's either XML markup and no localization for that page, or HTML markup.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-1796) When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag resolved WICKET-1796.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-M4

Please see below for an example on how to configure another file extension for xml properties files. E.g. by changing it to "xmlProperties" any conflicts can be avoided.

	/**
	 * @throws Exception
	 */
	public void testRenderHomePage_3() throws Exception
	{
		IPropertiesFactory myFac = new MyPropertiesFactory(tester.getApplication());
		tester.getApplication().getResourceSettings().setPropertiesFactory(myFac);

		executeTest(XmlPage_3.class, "XmlPageExpectedResult_3.xml");
	}

	/**
	 * 
	 */
	private class MyPropertiesFactory extends PropertiesFactory
	{
		/**
		 * Construct.
		 * 
		 * @param application
		 */
		public MyPropertiesFactory(Application application)
		{
			super(application);

			getPropertiesLoaders().clear();
			getPropertiesLoaders().add(new PropertiesFilePropertiesLoader());
			getPropertiesLoaders().add(new XmlFilePropertiesLoader("xmlProperties"));
		}
	}


> When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-1796
>                 URL: https://issues.apache.org/jira/browse/WICKET-1796
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: n/a
>            Reporter: Sebastian Gooren
>             Fix For: 1.4-M4
>
>
> When using
> @Override
>     public String getMarkupType()
>     {
>         return "xml";
>     }
> in a webpage, I cannot use getLocalizer().getString( "xyz", this ) anymore. I traced it back to
> Caused by: org.xml.sax.SAXParseException: Document root element "order", must match DOCTYPE root "null".
> Apparently, the wicket localizer (org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource, line 142) decides to look for an XML properties file. Normally, this would be ok. But now, since I have an XML file in place which is the markup for the webpage, localization breaks. Wicket thinks that my markup file is an XML properties file.
> Right now it's either XML markup and no localization for that page, or HTML markup.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1796) When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception

Posted by "Sebastian Gooren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624358#action_12624358 ] 

Sebastian Gooren commented on WICKET-1796:
------------------------------------------

a) tricky, as I expected. Of course, it should still be possible to have properties in an XML file when the markup type is XML.
b) that would mean you need to cache that the given XML file cannot be handled, to prevent it from being parsed/checked on every run. Not sure if you handle that case; I know you cache properties the other way around (on succesfully loading them).

My suggestion is this:
Put xml properties in files with a ".properties.xml" extension and (combined with your option (a)) ignore ".xml" when the markup type is XML.

As a purist (haha) I would even say: drop the simple ".xml" extension for XML properties, and always put them in a ".properties.xml" file. But unfortunately, that would break all existing applications out there using simple ".xml" properties files.

> When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-1796
>                 URL: https://issues.apache.org/jira/browse/WICKET-1796
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: n/a
>            Reporter: Sebastian Gooren
>
> When using
> @Override
>     public String getMarkupType()
>     {
>         return "xml";
>     }
> in a webpage, I cannot use getLocalizer().getString( "xyz", this ) anymore. I traced it back to
> Caused by: org.xml.sax.SAXParseException: Document root element "order", must match DOCTYPE root "null".
> Apparently, the wicket localizer (org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource, line 142) decides to look for an XML properties file. Normally, this would be ok. But now, since I have an XML file in place which is the markup for the webpage, localization breaks. Wicket thinks that my markup file is an XML properties file.
> Right now it's either XML markup and no localization for that page, or HTML markup.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1796) When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624271#action_12624271 ] 

Juergen Donnerstag commented on WICKET-1796:
--------------------------------------------

It is a known problem. Localizer searches for *.properties and *.xml but doesn't know that it should it ignore the xml file if the markup type is xml as well. And we don't validate the <properties>.xml schema neither. The problem really is that Localizer for good reason (see mails in the archive) knows only about the component class, its locale, style and variant. Just the information needed to search for the file (properties or xml).

What are the options to fix it:
a) add the component markup type and forward it to the localizer as well. Thus telling localizer to ignore *.xml files. But wait: all *.xml files or just specific ones? For all combination of locales, style and variant?
b) define a xml namespace for xml properties files and only if present, localizer should handle it. If not exception are ignored (may be logged)

any other idea?

> When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-1796
>                 URL: https://issues.apache.org/jira/browse/WICKET-1796
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: n/a
>            Reporter: Sebastian Gooren
>
> When using
> @Override
>     public String getMarkupType()
>     {
>         return "xml";
>     }
> in a webpage, I cannot use getLocalizer().getString( "xyz", this ) anymore. I traced it back to
> Caused by: org.xml.sax.SAXParseException: Document root element "order", must match DOCTYPE root "null".
> Apparently, the wicket localizer (org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource, line 142) decides to look for an XML properties file. Normally, this would be ok. But now, since I have an XML file in place which is the markup for the webpage, localization breaks. Wicket thinks that my markup file is an XML properties file.
> Right now it's either XML markup and no localization for that page, or HTML markup.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1796) When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception

Posted by "Sebastian Gooren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624196#action_12624196 ] 

Sebastian Gooren commented on WICKET-1796:
------------------------------------------

Note: A workaround is available. I can put a <WebpageName>.properties file in place. As long as it contains all localized strings used in the webpage, it works.

Unfortunately, this means duplicating a lot of strings from my Application.properties into this secondary properties file.

> When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-1796
>                 URL: https://issues.apache.org/jira/browse/WICKET-1796
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: n/a
>            Reporter: Sebastian Gooren
>
> When using
> @Override
>     public String getMarkupType()
>     {
>         return "xml";
>     }
> in a webpage, I cannot use getLocalizer().getString( "xyz", this ) anymore. I traced it back to
> Caused by: org.xml.sax.SAXParseException: Document root element "order", must match DOCTYPE root "null".
> Apparently, the wicket localizer (org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource, line 142) decides to look for an XML properties file. Normally, this would be ok. But now, since I have an XML file in place which is the markup for the webpage, localization breaks. Wicket thinks that my markup file is an XML properties file.
> Right now it's either XML markup and no localization for that page, or HTML markup.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1796) When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception

Posted by "Sebastian Gooren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625147#action_12625147 ] 

Sebastian Gooren commented on WICKET-1796:
------------------------------------------

Great solution! Thanks Juergen.

> When markup type is XML, getLocalizer().getString( "xyz", (WebPage) ) throws Exception
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-1796
>                 URL: https://issues.apache.org/jira/browse/WICKET-1796
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: n/a
>            Reporter: Sebastian Gooren
>             Fix For: 1.4-M4
>
>
> When using
> @Override
>     public String getMarkupType()
>     {
>         return "xml";
>     }
> in a webpage, I cannot use getLocalizer().getString( "xyz", this ) anymore. I traced it back to
> Caused by: org.xml.sax.SAXParseException: Document root element "order", must match DOCTYPE root "null".
> Apparently, the wicket localizer (org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource, line 142) decides to look for an XML properties file. Normally, this would be ok. But now, since I have an XML file in place which is the markup for the webpage, localization breaks. Wicket thinks that my markup file is an XML properties file.
> Right now it's either XML markup and no localization for that page, or HTML markup.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.