Skip to content

<xsd:attribute ref="xml:space" use="required"> Reference attribute conversion failed #156

@dhbloo

Description

@dhbloo

The sample code is as follows, the input file name is AUTOSAR_00048.xsd

func MyTestXsdNormalize(filename string) error {
	doc , err := os.ReadFile(filename)
	if err != nil {
		return err
	}
	doctrees, err := xsd.Normalize(doc)
	if err != nil {
		logger.GetLogger().Warningf("Failed to load schema %q: %v", filename, err)
		return err
	}

	// Write to file a.xml
	f, err := os.Create("AUTOSAR_00048_doctrees.xsd")
	for _, t := range doctrees {
		var result = xmltree.MarshalIndent(t, "", "  ")
		f.Write(result)
	}
	f.Close()
}

It was found that some refs were not converted successfully. For example, after converting the input file, the 180055 line of the output file AUTOSAR_00048_doctrees.xsd in the attachment has the following content:

<xsd:attribute ref="xml:space" use="required" type="xsd:anySimpleType">
where the ref="XML:space" should be replaced.

Here is the output file:
AUTOSAR_00048_doctrees.zip
Here is the input file:
AUTOSAR_00048.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions