Sign in to follow this  

[.net] XML and the content pipeline

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi folks ! I'm currently wondering how I should get my code to compile - in fact the XML part of the content pipeline. I've got a simple class to store my XML content for later use as a font resource:: [Serializable] public class nice_FontData { public Char character; public float TU; public float TV; public float TUWidth; public float TVHeight; public float charWidth; public float charHeight; } The XML definition looks like this:: <?xml version="1.0" encoding="us-ascii"?> <XnaContent> <Asset Type="System.Collections.Generic.List[niceEngine.baseTypes.nice_FontData]"></Asset> <character> </character> <TU>0</TU> <TV>0</TV> <charWidth>7.201172</charWidth> <charHeight>14</charHeight> <TUWidth>0.015625</TUWidth> <TVHeight>0.0546875</TVHeight> ... </XnaContent> However, if I setup the XML to compile as XNA content, the build fails with:: There was an error while deserializing intermediate XML. Cannot find type "niceEngine.baseTypes.nice_FontData" Any suggestions ? I'm freakin' out on that ....

Share this post


Link to post
Share on other sites
This is just a guess, but maybe include the namespace with niceEngine.baseTypes.nice_FontData?

edit - oh, is niceEngine a type, or an instance of a type?

Just out of curiosity though, why not just use Xna's spritefonts?

[Edited by - gharen2 on February 11, 2008 4:04:47 PM]

Share this post


Link to post
Share on other sites
> This is just a guess, but maybe include the namespace with niceEngine.baseTypes.nice_FontData?

That would be::
namespace niceEngine.baseTypes
{
...
public class nice_FontData{ ... }
...
}

So niceEngine and baseTypes are part of the namespace. Or do did I get you wrong ?

As I first tried the XNA font system it was very, very slow - so that was back in the RC1 state of the framework. The font is only needed to implement statistics and a console system in my engine - and perhaps subtitles. Do you have some experience on the current performance ?

-edit-
Maybe I should say that niceEngine is using 3d only :-) For text output I create a vertex quad for each character and render them in a batch to screen...

Nevertheless I will need XML content capabilities not only for fonts (for animations, LUA like scripts and so forth).

[Edited by - - hAk - on February 12, 2008 2:16:23 AM]

Share this post


Link to post
Share on other sites
Yes I see now, niceEngine.baseTypes is a namespace. I thought they were types. How evil of you to make your namespace names camel case :P .

I use Xna 2.0, and haven't seen any problems at all with xna's font stuff. I can't speak for the previous versions, I only only dabbled with xna until recently.

[Edited by - gharen2 on February 12, 2008 1:20:01 PM]

Share this post


Link to post
Share on other sites
Yeah sorry for that - I got used to it since my Delphi times :-)
Just migrated the font stuff to spriteFonts and it's even faster than working with vertex batches ^__^ - THX for your opinion - right decision for me so far.

However, I will need the XML part sooner or later. Still can't figure out what the problem could be. Must the class be declared in a separate C# project ? Please say NO :-( Wouldn't be a problem at all, but a little bit strange from MS...

Share this post


Link to post
Share on other sites
Hello hAk, I think you are correct that you need the class in a separate project.

The content processor is like a subproject to your main project, and so it builds first. You need to be able reference your class within the content processor to load it. You can't add your main project because it'll create a circular reference. So you'd need two new projects on your solution, one Library and one ContentPipelineExtension.

If you don't prefer that you can get around this by not using the content processor and using what is provided by System.XML.Serialization.


Quote:
Original post by - hAk -
Hi folks !

I'm currently wondering how I should get my code to compile - in fact the XML part of the content pipeline.
I've got a simple class to store my XML content for later use as a font resource::

[Serializable]
public class nice_FontData
{
public Char character;
public float TU;
public float TV;
public float TUWidth;
public float TVHeight;
public float charWidth;
public float charHeight;
}

The XML definition looks like this::

<?xml version="1.0" encoding="us-ascii"?>
<XnaContent>
<Asset Type="System.Collections.Generic.List[niceEngine.baseTypes.nice_FontData]"></Asset>
<character> </character>
<TU>0</TU>
<TV>0</TV>
<charWidth>7.201172</charWidth>
<charHeight>14</charHeight>
<TUWidth>0.015625</TUWidth>
<TVHeight>0.0546875</TVHeight>
...
</XnaContent>

However, if I setup the XML to compile as XNA content, the build fails with::
There was an error while deserializing intermediate XML. Cannot find type "niceEngine.baseTypes.nice_FontData"

Any suggestions ? I'm freakin' out on that ....


Share this post


Link to post
Share on other sites

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this