Loading ...
Sorry, an error occurred while loading the content.

Re: Starting with nxml

Expand Messages
  • Steinar Bang
    ... I tried changing ... to ... in the
    Message 1 of 7 , Nov 30, 2006
    • 0 Attachment
      >>>>> Florent Georges <darkman_spam@...>:

      > Steinar Bang wrote:
      > Hi

      >> I get the error because the file contains an xsi:schemaLocation
      >> instance.

      > This attribute has to be explicitelly allowed in RNG grammars.

      I tried changing
      <element name="project">
      <interleave>
      ...
      to
      <element name="project">
      <attribute>
      <anyName/>
      </attribute>
      <interleave>
      ...

      in the generated RNG schema, and then used trang to translate it into,
      | element project {
      attribute * { text },

      But that wasn't enough.

      > You can dig the archives for similar discussions. But I wonder if
      > an editing tool like nXML would have to permit the XSI attributes on
      > elements (for example if the grammar is translated from WXS), and
      > maybe have some support for them (completion for schema paths,
      > completion for types, etc.).

      Here's an earlier thread on this list:
      http://comments.gmane.org/gmane.emacs.nxml.general/998

      Norm Walsh suggests using a wrapper grammar to add the xsi:
      attributes. That's probably a good idea, but I'll try modifying the
      grammar first to see if I can make it work... hm... changing the
      attribute declaration to:
      | element project {
      attribute xsi:schemaLocation { text },
      gave me the error message
      File mode specification error: (error "Undefined prefix xsi at position 136 in /media/sda8/bangste/p4/depot/ccr/MAIN/maven.rnc")

      Ok I changed (half-guessing, and using nxml to expand what's allowed)
      the attribute declaration in the maven.rng file to look like this:
      <element name="project">
      <attribute>
      <name ns="http://www.w3.org/2001/XMLSchema-instance">schemaLocation</name>
      </attribute>
      ...

      Then ran the schema through trang to get the following in maven.rnc:
      default namespace = "http://maven.apache.org/POM/4.0.0"
      namespace ns1 = "http://www.w3.org/2001/XMLSchema-instance"

      start =
      notAllowed
      | element project {
      attribute ns1:schemaLocation { text },
      (element parent {
      ...

      And that's enough to make the Maven POM files validate. Thanx!

      I guess the next step will be to figure out what's meant by an
      extension grammar, but for now this quick hack works for me.

      Thanx again!
    Your message has been successfully submitted and would be delivered to recipients shortly.