xml namespaces and xsd's

Milian Wolff mail at milianw.de
Fri Jun 11 20:26:38 UTC 2010


Ruan Strydom, 11.06.2010:
> Hi Milian, my apologies, my eyes must have deceived me. (I've added your
> name to my dictionary)
> 
> You see the reason why I am struggling with this is:
> 
> The xml is a tree, a bunch of declaration instances and context's, the XSD
> defines this but is also XML ie: while I am editing the XSD I need it to be
> parsed as plain XML but when it is included it needs to be parsed as a
> Schema similar to DTD.
> 
> Example:
> 
> <complexType name="blah">
> 	.....
> </complexType>
> 
> this declares an instance of 'complexType' but also declares a type 'blah'
> creating a conflict. When searching the chain at a certain position which
> one do I return? Both is at the same location, both have the same range
> for their context's?

Hm ok... This is a tough one indeed. But how would the "two chains for a 
document" solve this? You would still have two declarations at the same 
point...

So yeah, you might actually need to store that type info in a separate place. 
Note: you can store stuff in the ItemRepository, CPP uses that for Macros e.g.
Dunno how easy or hard or easy it is...

Anyhow, you might actually be able to reuse e.g. some existing Qt XML parser 
(assuming they are fast) for the case where you want to see whether an item is 
valid or not in a xml file including that XSD. So you'd essentially have the 
DUChain for editing a file and some separate stuff to validate files & do code 
completion in files using that XSD...

The "problem" would of course be reporting uses etc. pp. in a KDevelop-
integrated way. But this might still be possible somehow, I have to think 
about it... I still hope to merge both declaration into one but I dunno how it 
would work...

> ps: Anyone watching the soccer, I can not help but to ask as I can hear the
> 'vuvuzelas' in the streets/neighborhood, as I stay in SA.
> 
> http://en.wikipedia.org/wiki/Vuvuzela
> 
> Cheers
> 
> On Friday 11 June 2010 21:39:20 Milian Wolff wrote:
> > Ruan Strydom, 11.06.2010:
> > > Hi,  sorry I know the mail is a bit long....
> > > 
> > > Problem 1: (XSD)
> > > The parser and builders works pretty well, but to be able to add
> > > completion to XML I have to implement XSD. The problem is that if I am
> > > going to build declarations and context's for the XSD document I will
> > > loose the pretty tree structure that is currently built.
> > > 
> > > I have thought of two options:
> > > 
> > > 1) Parse the XSD into a separate structure for completion (perhaps
> > > using an existing api) ie SchemaCompletionHelper or something?
> > > 
> > > 2) When Millian has made his changes to support multiple top context's
> > > I can create a special top context 'sub document' for XSD schemas?
> > > 
> > > Millian: would option 2 be possible with your changes?
> > 
> > Meh, I'm written with a single 'l' :P
> > 
> > 
> > Anyhow, can't you use nested contexts to emulate a tree?
> > 
> > > DTD is a bit of a mess still, it works but not great if it becomes a
> > > problem I would need to either find a way t fix it or switch to option
> > > 1 for it.
> > > 
> > > 
> > > Problem 2: (Namespaces)
> > > 
> > > How does one declare the following: Ns::SomeClass? I have created
> > > namespace declarations and namespace aliases and imports ie xmlns::ord=
> > > "http://..../orders.xsd" (not committed yet) but when using it what is
> > > this called? What kind of
> > > declaration is the namespace part in Ns::SomeClass or <ord:order .. >
> > > how does cpp do it? (could not find it)
> > 
> > You need contexts. I've just added preliminary namespace support to PHP,
> > 
> >  maybe that helps you?
> >  
> > > Supporting namespace's in XML without proper schema language support is
> > > going to be a bit of a hack but I am hoping to get some value from
> > > hacking it, the imports (declarations not contexts) and namespaces will
> > > be in the chain, so on completion it can be used to find the schema to
> > > complete with, if using method 1. Else using method 2 the uses and
> > > imported contexts will simply point to it, if the change of Millian
> > > will allow cross 'sub document' imports.
> > 
> > Could you explain that a bit more? What would be the two documents? Do
> > they actually have different "languages"? Or is it simply two XML
> > chains? The
> > 
> >  latter works even now...
> >  
> > > Thanks allot
> > 
> > http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-
> > everything.html
> > 
> > :P ;-)
> > :
> > > ps: Where do you guys find the time?
> > 
> > being student helps a lot :P


-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100611/f6acd594/attachment.sig>


More information about the KDevelop-devel mailing list