The XSD schema "lzx.xsd" is already generated by the current build process.
There is no need to do anything with the openlaszlo compiler to generate
this xsd from my point of view (at least by now).

It ist just needed that the compiler ignores / cuts any prefix and acceptes
schema definitions.
I don't think that this is a big issue to solve, you just need a
pre-processor that iterates through the tags and cuts away the prefix.

Makes me think if I just include this pre-process in my projects. You can
then run a ANT-Task to modify the sources into the format the openlaszlo
compiler "eats". However it can be no big deal to modify the openlaszlo
compiler to ignore schema definitions and prefixes and build this
functionality into the compiler.

And I think it would even makes sense from a "theoretical" point of view,
XMLNS would behave like "Generics" (the famous <String,XYZ> type safe List,
Maps, et cetera) in the Java programming language: Generics in Java are
just interesting in the IDE/for validation, the Java compiler will actually
cut away any generics and use the raw types. Actually the compiler does not
care about your Generics. The same way OpenLaszlo compiler could ignore the
prefix and schema definitions: Those are important to validate / make the
XML documents "type safe". Of course validation is something different from
generics but with some imagination you can see some common ground.

Sebastian

2011/11/24 Raju Bitter <[email protected]>

> It would make sense to use XML Schema files instead of DTDs.
> http://jira.openlaszlo.org/jira/browse/LPP-7502
>
> Not sure anyone would have time to work on the compiler/build process
> to support XML Schema generation. How did the unreleased IDE deal with
> that problem? Could that approach be re-used here?
>
> On Wed, Nov 23, 2011 at 9:12 PM, [email protected]
> <[email protected]> wrote:
> > Okay correct would be for example (asuming that lzx.xsd is in the same
> > folder like the test.lzx):
> >
> > test.lzx:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <lzx:canvas xmlns:lzx="http://www.laszlosystems.com/2003/05/lzx";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://www.laszlosystems.com/2003/05/lzx lzx.xsd ">
> >
> >     <lzx:view name="asddsa">
> >
> >     </lzx:view>
> >
> > </lzx:canvas>
> >
> > Question:
> > Would it be an idea to make the compile in OpenLaszlo ignore the prefix
> of
> > ANY tag ?
> >
> > Also to ignore other statements like schema or ":", currently it seems
> to be
> > impossible to define a lzx file with valid schema, even if you simple use
> > this template:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <canvas xmlns="http://www.laszlosystems.com/2003/05/lzx";
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:schemaLocation="http://www.laszlosystems.com/2003/05/lzx lzx.xsd ">
> > </canvas>
> > => Results in a exception:
> >
> > Compilation Errors
> >
> > test.lzx:3:130: Syntax error: the token ":" was not expected at this
> > position.test.lzx:3:126: found an unknown attribute named
> "schemaLocation"
> > on element canvas, check the spelling of this attribute name
> >
> > The compile should accept those prefix and schema definitions, and just
> > ignore them.
> > That way you can use arbitrary prefix, which would make it more easy to
> > combine for example a "project" or any kind of custom xsd with the global
> > xsd.
> >
> > Making the same with a DTD is a lot more difficult as you need to
> manually
> > write a task that combines the DTD into a single file. Also namespaces
> seem
> > to be more up-to-date in features to handle complex schemas.
> >
> > Further:
> > The xsd the current build process produces is not correct:
> > It ignores the possibility to define attribute values in inherited
> classes,
> > example:
> >
> > <class name="blabla" extends="view" width="200">
> >
> > </class>
> >
> > => is invalid. I guess this is something we could live with, you need to
> > define such attributes in the instance:
> > <blabla width="200" />
> > => would be okay again. However this should be clearly written down in
> the
> > docs.
> >
> >
> > Sebastian
> >
> >
> > 2011/11/23 [email protected] <[email protected]>
> >>
> >> Starting from my DTD question it seems like another question would be
> how
> >> to correctly define XMLNS definitions for a XML file.
> >>
> >> Is there an example file that uses the current .xsd ?
> >>
> >> XMLNS is somehow more flexible as DTDs are.
> >> But can openlaszlo handle that?
> >>
> >> for example prefixes for xml tags? How does the laszlo-compiler handle
> for
> >> example:
> >>
> >> <xi:myCustomView>
> >>
> >> ?
> >>
> >> Does the compile ignore the xi tag or does it anything with it?
> >>
> >> Sebastian
> >>
> >> --
> >> Sebastian Wagner
> >> http://www.openmeetings.de
> >> http://www.webbase-design.de
> >> http://www.wagner-sebastian.com
> >> [email protected]
> >
> >
> >
> > --
> > Sebastian Wagner
> > http://www.openmeetings.de
> > http://www.webbase-design.de
> > http://www.wagner-sebastian.com
> > [email protected]
> >
>



-- 
Sebastian Wagner
http://www.openmeetings.de
http://www.webbase-design.de
http://www.wagner-sebastian.com
[email protected]

Reply via email to