0

Is there any way that language setting or format setting can cause XML to be formatted wrongly? I have a particular case in which XML generated with the duplicate value of ID. enter image description here

As you can see above, there are two entity types with the same ID (IDENT1). This format gives me an error that The XML file does not meet the XML schema requirements.

It's important to say that it happens only in a particular pc, and I couldn't replicate it on other pc. I suspect that it's maybe related to language setting formatting etc.

What can be the cause?

Ido Segal
  • 430
  • 2
  • 7
  • 20
  • If the `Id` attribute is declared to be of type `ID` in the XML schema, the attribute values must be unique within the XML document. See http://www.datypic.com/sc/xsd/t-xsd_ID.html – mzjn Aug 14 '20 at 09:16
  • I know that, but this behavior only happens in a specific pc. When I'm exporting the same in other pc, it's unique. – Ido Segal Aug 14 '20 at 09:18
  • Ir seems extremely unlikely that this has anything to do with "language setting" or "format setting". – mzjn Aug 14 '20 at 09:22
  • Do you have any idea what can be the cause? It seems that there is an issue with '0' every XML generated with dup IDENT1. (Only in a specific PC) – Ido Segal Aug 14 '20 at 09:24
  • I have no idea. What do you mean by "When I'm exporting the same in other pc"? What software do you use? The question is only tagged with "xml". – mzjn Aug 14 '20 at 09:27
  • I exporting an XML file from a web app. The issue I described above, happens on a specific laptop. I couldn't replicate it on my pc. – Ido Segal Aug 14 '20 at 09:30
  • 1
    @IdoSegal, please edit your post and share both (1) your input XML and (2) XSD in a textual format. – Yitzhak Khabinsky Aug 14 '20 at 13:14

2 Answers2

1

Is there any way that language setting or format setting can cause XML to be formatted wrongly?

This isn't a format issue, it's a content issue.

The answer is yes. There are any number of things that can cause the content of an XML document to be incorrect. And there's no way we can guess the cause in your particular case. You just need to debug it: track back through the history to see what process corrupted the document, then find out what's wrong with that process.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
1

Precision in vocabulary helps:

  • Format is rarely used in XML other than perhaps in the context of pretty printing – it's easier to read XML formatted with line breaks and indentation.

    You may or may not like how your XML is formatted, but your error has nothing to do with presentational whitespace.

    Less precisely, one might say that some data is formatted as XML. This begins to get at the notion that something is wrong with substance of the data as represented in XML. The next two more commonly used terms will help here.

  • Well-formed is used to describe textual data that meets the rules required for being XML. Your XML is well-formed.

  • Valid is used to describe whether XML meets the additional rules specified by a schema (DTD, XSD, Relax NG, Schematron, etc). To say that "the XML file does not meet the XML schema requirements" is to say that your XML is invalid (according to the rules of some schema).

If you're observing that validity varies per machine, then most likely it is the association between the XML and a schema file that is the difference. (Possible but less likely: The tool used for validation or the application program issuing the error might vary, or included/imported/referenced XML or schema files might vary, etc.) To resolve your problem, focus on how you're associating a schema with your XML file differently on one machine vs the other.

See also

kjhughes
  • 106,133
  • 27
  • 181
  • 240