I see.  So it looks like you may be looking for some tooling to
automatically generate a dynamic xsd schema for a "document view" style JCR
xml import file.  In that case, many of the details of the xsd schema would
have to be dynamically determined by inspecting whatever JCR node types are
currently defined in your target server.

Also, you may consider if you are you using well defined "structured" node
types with a fixed set of allowed properties in your xml documents.  If
not, then the xsd schema would have to be very relaxed and may not be too
useful for validation as the allowed property and element names would be
unknown for any unstructured content.  But, perhaps knowing the "defined"
properties and children could be useful to provide hints to the "code
completion" capabilities of the editor?

Anyways, the registered JCR node type details are available for
introspection via apis on the server side.  It should be possible to dig
some of the details out of the JCR node type definitions and return a
dynamic xsd schema file from a servlet.

Regards,
Eric

On Fri, Feb 14, 2020 at 7:17 AM John Kramer <john.kra...@panerabread.com>
wrote:

> Sure, we use IntelliJ as a source code editor. And we build our project
> using maven and the plugin content-package-maven-plugin. All of our nodes
> are represented as XML files in our source. For example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jcr:root
>   xmlns:sling="http://sling.apache.org/jcr/sling/1.0";
>   xmlns:jcr="http://www.jcp.org/jcr/1.0";
>   jcr:primaryType="sling:Folder"/>
>
> IntelliJ (and plenty of other editors) validate and even autocomplete xml
> automatically based on the provided namespace. Because it cannot retrieve
> the namespaces http://sling.apache.org/jcr/sling/1.0 or
> http://www.jcp.org/jcr/1.0 it won't do that (of course it will still
> validate xml syntax).
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kra...@panerabread.com <mailto:john.kra...@panera.com>
> m: 314-435-2370
>
> On 2/13/20, 23:22, "Eric Norman" <enor...@apache.org> wrote:
>
>     Hi John,
>
>     Would it be possible for you to provide any more details about the use
>     cases where you would be using validated xml files instead of JSON
> files?
>
>     Regards,
>     Eric
>
>     On Thu, Feb 13, 2020, 10:45 AM John Kramer <
> john.kra...@panerabread.com>
>     wrote:
>
>     > That's disappointing. Have you guys ever considered producing an XSD?
>     > Would make it easier to understand, validate, etc.
>     >
>     > John Kramer
>     > Java Software Engineer
>     > E-Commerce Web Team
>     > e: john.kra...@panerabread.com <mailto:john.kra...@panera.com>
>     > m: 314-435-2370
>     >
>     > On 2/13/20, 02:39, "Julian Sedding" <jsedd...@gmail.com> wrote:
>     >
>     >     Warning:  This email originated from outside of Panera. Beware of
>     > clicking links and attachments.
>     >
>     >
>     >     Hi John
>     >
>     >     XML namespace names are usually URIs, supposedly to avoid
> collisions.
>     >     However, they are not required to be a URI nor are they required
> to
>     >     point to an actual document. The Wikipedia article on XML
> namespaces
>     >     has more detail:
>     >     https://en.wikipedia.org/wiki/XML_namespace#Namespace_names
>     >
>     >     The last sentence of the linked section sums it up nicely:
>     >
>     >     "In general, however, users should assume that the namespace URI
> is
>     >     simply a name, not the address of a document on the Web."
>     >
>     >     Regards
>     >     Julian
>     >
>     >     On Wed, Feb 12, 2020 at 10:08 PM John Kramer
>     >     <john.kra...@panerabread.com> wrote:
>     >     >
>     >     > Hi guys,
>     >     >
>     >     > Sorry if this question is a bit naïve.
>     >     >
>     >     > I see the xml namespace http://sling.apache.org/jcr/sling/1.0
> all
>     > over source files, but that link is a 404. Where can I actually look
> at the
>     > namespace definitions?
>     >     >
>     >     > Thanks!
>     >     >
>     >     > John Kramer
>     >     > Java Software Engineer
>     >     > E-Commerce Web Team
>     >     > e: john.kra...@panerabread.com<mailto:john.kra...@panera.com>
>     >     > m: 314-435-2370
>     >
>     >
>     >
>
>
>

Reply via email to