Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Generated tags for attributes can incorrectly have namespaces #18

Open
jesand opened this issue Aug 25, 2015 · 0 comments
Open

Generated tags for attributes can incorrectly have namespaces #18

jesand opened this issue Aug 25, 2015 · 0 comments

Comments

@jesand
Copy link

jesand commented Aug 25, 2015

When code is generated from a .xsd with namespaces, those namespaces are included in struct field tags for attribute elements. However, encoding/xml does not properly marshal/unmarshal such fields. Deleting the namespace manually from the struct tag corrects the issue.

Here's the command I ran:

$GOPATH/bin/xsd-makepkg -goinst=false -basepath=github.com/jesand/crowds/amt/gen -uri=http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd

The resulting code fails to unmarshal MinLength and MaxLength in the following XML:

<QuestionForm xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd">
          <Question>
            <QuestionIdentifier>nextmove</QuestionIdentifier>
            <DisplayName>The Next Move</DisplayName>
            <IsRequired>true</IsRequired>
            <QuestionContent>
              <Text>
                What are the coordinates of the best move for player "X" in this game?
              </Text>
            </QuestionContent>
            <AnswerSpecification>
              <FreeTextAnswer>
                <Constraints>
                  <Length minLength="2" maxLength="2" />
                </Constraints>
                <DefaultText>C1</DefaultText>
              </FreeTextAnswer>
            </AnswerSpecification>
          </Question>
</QuestionForm>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants