View previous topic :: View next topic |
Author |
Message |
Brix
Joined: 28 Oct 2006 Posts: 21 Location: EU, Denmark, Lyngby.
|
Posted: Wed Feb 07, 2007 9:47 am Post subject: Patch for XML, space in attributes |
|
|
Hey
I've made a simple patch to the XML subsystem, so it is possible to use spaces in attributes.
The patch is somewhat hacky, but atleast not anymore than the code it complements.
http://brix-verden.dk/d/xmlwhitespace.patch
- Brix |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Wed Feb 07, 2007 1:36 pm Post subject: |
|
|
Thanks for the patch! I'm not involved in arc's xml subsystem and tied up elsewhere at the moment, so I can't actually comment on it: I'm sure Clay will take a look at it once he's some time.
So, you're actively using Arc? Or just its XML components? Its always interesting to hear about these things! |
|
Back to top |
|
|
Brix
Joined: 28 Oct 2006 Posts: 21 Location: EU, Denmark, Lyngby.
|
Posted: Wed Feb 07, 2007 4:42 pm Post subject: |
|
|
I'm currently porting some of my projects (mostly games) and libraries from C++ with
ClanLib to D and ArcLib.
I chose Arc as it seemed like the game library that was put the most work in.
The library i'm currently porting/rewritting is a simple GUI system, designed for fullscreen menus. Using XML for defining the menu, like this:
Code: |
<image path="data/menu.jpg">
<area name="New Game" x="520" y="273" w="190" h="25" mouseover="data/menu-mo-newgame.jpg" clicked="data/menu-mo-newgame.jpg" />
<area name="Quit Game" x="520" y="357" w="190" h="25" mouseover="data/menu-mo-quitgame.jpg" clicked="data/menu-mo-quitgame.jpg" />
<keyinput name="Get name" x="76" y="505" w="195" h="25" textfont="data/kabel.ttf" textsize="16" textcolor="0,255,0" background="true" />
</image>
|
Right now, the library is able to do about the same as the C++ version, and the code is about half the size.
- Brix |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Fri Feb 09, 2007 3:34 pm Post subject: |
|
|
Great to hear!
Are your game projects uploaded somewhere? I expect you're using Arc 0.1? |
|
Back to top |
|
|
Brix
Joined: 28 Oct 2006 Posts: 21 Location: EU, Denmark, Lyngby.
|
Posted: Fri Feb 09, 2007 4:02 pm Post subject: |
|
|
Some of my older projects is at my website http://brix-verden.dk (danish website).
The ones I'm currently porting hasn't been released yet.
I'm actually using trunk, as it seemed the easiest thing to do, I don't believe the Arc 0.1 release was D1.0 compatible.
- Brix |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Sat Feb 10, 2007 3:35 am Post subject: |
|
|
Quote: | I'm actually using trunk, as it seemed the easiest thing to do, I don't believe the Arc 0.1 release was D1.0 compatible. |
Interesting! Are you using anything from arc.sprite? The code in arc.scenegraph is still a little rough around the edges, but I hope it'll eventually replace the sprite module. Still need to improve the ease-of-use though.
Just as a warning: while writing arc.examples.asteroids I've come across some shortcomings of arc.input and will do some cleaning and improving soonish: that'll possibly alter the public interface.
Also, I'm fixing and improving the physics system quite often; you don't use that yet, do you? |
|
Back to top |
|
|
Brix
Joined: 28 Oct 2006 Posts: 21 Location: EU, Denmark, Lyngby.
|
Posted: Sat Feb 10, 2007 6:16 am Post subject: |
|
|
Quote: | Interesting! Are you using anything from arc.sprite? The code in arc.scenegraph is still a little rough around the edges, but I hope it'll eventually replace the sprite module. Still need to improve the ease-of-use though. |
Yes I'm using Sprite quite a few places. I haven't looked into scenegraph yet.
Quote: | Just as a warning: while writing arc.examples.asteroids I've come across some shortcomings of arc.input and will do some cleaning and improving soonish: that'll possibly alter the public interface. |
Sure, no problem.
Quote: | Also, I'm fixing and improving the physics system quite often; you don't use that yet, do you? |
Nope, and I don't have a real use for it in the games I'm porting, except maybe for particles.
- Brix |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Tue Feb 13, 2007 5:22 am Post subject: |
|
|
Back to the patch:
I only got a basic understanding of XML, but wouldn't it have sufficed to remove the \s from the attribute splitting regular expression, i.e. changing \"|=\"|\s to \"|=\"?
Would this work? Or does XML allow arbitrary spacing between attribute name and =? |
|
Back to top |
|
|
Brix
Joined: 28 Oct 2006 Posts: 21 Location: EU, Denmark, Lyngby.
|
Posted: Tue Feb 13, 2007 6:17 am Post subject: |
|
|
Quote: | I only got a basic understanding of XML, but wouldn't it have sufficed to remove the \s from the attribute splitting regular expression, i.e. changing \"|=\"|\s to \"|=\"? |
I've just tried and it works well, at least with my test XML.
Quote: | Or does XML allow arbitrary spacing between attribute name and =? |
I'm not sure. It just seemed right to patch up around the "cheap hack" instead.
- Brix |
|
Back to top |
|
|
ChristianK
Joined: 26 Sep 2006 Posts: 159 Location: Berlin, Germany
|
Posted: Tue Feb 13, 2007 6:34 am Post subject: |
|
|
Yeah, it just wasn't obvious to me why 'length > 4' would be the right thing to check for. I've looked at the XML specification and committed the change to _attribSplitRe. |
|
Back to top |
|
|
Brix
Joined: 28 Oct 2006 Posts: 21 Location: EU, Denmark, Lyngby.
|
Posted: Tue Feb 13, 2007 6:58 am Post subject: |
|
|
Okay, very good.
- Brix |
|
Back to top |
|
|
|