Giter VIP home page Giter VIP logo

Comments (6)

droyo avatar droyo commented on July 29, 2024

This is certainly a bug. Looking at SubDeedType in DeedV2.xsd, I see this:

<xs:complexType name="SubDeedType">
  <xs:sequence>
    <xs:element ref="f:UIC" minOccurs="0" maxOccurs="unbounded">
      ...

and the element being referenced is element UIC in FieldsSchema.xsd

<xs:element name="UIC" >
  <xs:complexType>
    <xs:sequence>
      <xs:element name="CompanyControl" type="xs:string" minOccurs="1" maxOccurs="1"  />
        ...

The xsd package tries to simplify schema by flattening references, like those in SubDeedType, and by naming anonymous types like the one in the UIC element. The documents are much easier to parse & generate code for when there are no references and all types have a name.

You can see this 'simplification' using the aqwari.net/xml/cmd/xsdparse tool. Here's a bit of what it transforms the SubDeedType into:

<xs:complexType name="SubDeedType">
  <xs:complexContent>
    <xs:restriction base="xs:anyType">
      <xs:sequence>
        <xs:element name="UIC" type="_anon148" minOccurs="0" maxOccurs="unbounded" ...

Can you spot the error? _anon148 is not in DeedV2's namespace, it's in FieldsSchema. It should be

        <xs:element name="UIC" type="f:_anon148" minOccurs="0" maxOccurs="unbounded" ...

from go-xml.

droyo avatar droyo commented on July 29, 2024

After reviewing the code, the bug is in the flattenRef function; when copying a reference to an object in another namespace, it fails to qualify any names contained within.

from go-xml.

arjanvaneersel avatar arjanvaneersel commented on July 29, 2024

I took a look at the flattenRef function, tried to check where this bug could be, but I couldn't find it. Probably, because even after reading the code, logging things, I still don't get completely what's going on.

from go-xml.

droyo avatar droyo commented on July 29, 2024

I should have time to look at this on the weekend. I believe the error is not handling attributes such as "type", which can contain a QName, here.

from go-xml.

droyo avatar droyo commented on July 29, 2024

I've added a test that reproduces the issue in a much smaller example, in the import-type-from-otherns branch.

from go-xml.

droyo avatar droyo commented on July 29, 2024

Thanks for waiting @arjanvaneersel , I ran the command you provided after merging #66 and it produces output now. Please reopen if the issue isn't fixed for you.

from go-xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.