Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
45 views

How to sign XML document created using XmlSerializer and autogenerated classes from xsd.exe

I am having problems signing XML file created using auto-generated classes using xsd.exe on XML Schema. My schema looks like this: <?xml version="1.0" encoding="utf-8"?> <...
Nikola's user avatar
  • 105
0 votes
0 answers
46 views

Can an XSD have two elements with same name whose type is determined by an attribute value

I need to make an XSD schema (version 1.0) that is used for creating XML files by our clients, and for validation of the XML by us. Is it possible to make a XSD schema for the following XML file: <?...
Nikola's user avatar
  • 105
2 votes
3 answers
135 views

.NET 8.0 Not Normalizing Whitespace for xs:token Elements?

I'm working with C# and .NET 8.0.6. I have an XSD that declares a "root" element with xs:token content. When I validate a document with an instance element that has padded content, the ...
voidp's user avatar
  • 87
0 votes
1 answer
490 views

How to fix the attribute is not declared while performing xml validation

How to resolve "The 'Level' attribute is not declared." error with next xml file: <Settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://...
volody's user avatar
  • 7,169
0 votes
3 answers
179 views

XML Serialize difference between VS2022 & VS2019?

We use VS2019 for the project. We have some unit tests like this: // Arrange var expectedXml = "<?xml version=\"1.0\" encoding=\"utf-16\"?><LeadData xmlns:xsi=\&...
urlreader's user avatar
  • 6,557
0 votes
0 answers
343 views

DDL Database generation from XSD

I have been provided with an XSD and an XML file. I need to save the information on the XML file onto an SQL database which does not exist yet. I've tried using tools like Altova XMLspy and XSD2DB to ...
Henrique Araújo's user avatar
0 votes
1 answer
578 views

How to programmatically convert schema to C# class in .NET core

I'm looking for a way to convert schema to C# class in .NET core. In .NET framework, i was using class XmlCodeExporter to achieve this but seems this has not been ported to .NET For example, here is a ...
Nick's user avatar
  • 123
0 votes
1 answer
354 views

.NET 6 - reading Xml with schema as string

I'm trying to load an xml file which schema comes as a string: using (MemoryStream memStream = GenerateStreamFromString(XsdSchemas.the_schema_string)) { // tried this one too => using TextReader ...
AlexB's user avatar
  • 4,528
0 votes
1 answer
171 views

What is a valid pattern for an XSD restriction consisting of an xs:float and an xs:string?

I try to validate by XSD an attribute that can contain a float type or a word "exist". After search in the net I found this solution, but it did not work when I tried this pattern: <pre ...
NET PERFECTDEV's user avatar
0 votes
1 answer
304 views

How to tell xsd.exe to use a specific .NET type for a custom xs:simpleType?

In my XSD I have some type definitions like this: <xs:simpleType name="Ref_System"> <xs:restriction base="xs:string"> <xs:pattern value="[a-fA-F0-9]{...
gehho's user avatar
  • 9,219
0 votes
1 answer
282 views

How to add element conditionally to XSD based on the value of another element

I have a scenario, where the first element (Mode) can have a value of either Add/Edit/Delete. Now, I need to have another element (ID) based on the value of the first element. if the first element ...
Chaitwo's user avatar
  • 269
0 votes
0 answers
214 views

How to deserialize multiple xsd versions into one class?

My application reads in a certain type of XML files. I was provided with an XSD that I could deserialize using Visual Studio's xsd tool. Now, there are new versions of this XSD that should also be ...
fbindel's user avatar
  • 23
0 votes
0 answers
292 views

Data at the root level is invalid. Line 1, position 1. Is it error with the xml format?

Im having a problem with reading my xml with an error of Data at the root level is invalid. Line 1,position 1. This is my code below: string soapmessage = response.Content; XmlDocument ...
Daniel's user avatar
  • 139
0 votes
0 answers
56 views

When does the XSLT document() function run schema validation on the external XML file?

Suppose I'm calling XslCompiledTransform.Transform on a reader created with ValidationType.Schema, XmlSchemaValidationFlags.ProcessSchemaLocation and with a resolver capable of finding the actual XSD ...
Jirka Hanika's user avatar
  • 13.5k
0 votes
0 answers
40 views

Where is a list of all possibilities of XmlSchemaExceptions throw in .NET?

I want to create a translation for the most common exceptions throwed by XmlSchemaExceptions using XmlReader in C# .NET. Didn't find anything on the web yet and don't want to manually generate ...
eze_quiel's user avatar
0 votes
1 answer
117 views

Change in XML serialization related to nillable attribute

I would like to know if anyone knows about some change in dot net libraries, that causes different way of serialization on nillable elements. Three months ago, our system was producing this kind of ...
Peter Boško's user avatar
0 votes
1 answer
101 views

Saxon EE .NET version evaluation, getting Method not found exception while validating the XSD

I am using Saxon 10.5 version .NET evaluation version. When trying to compile XSD its throwing below error. Method not found: 'Void System.IO.FileStream..ctor(System.String, System.IO.FileMode, ...
user3083416's user avatar
0 votes
0 answers
45 views

Create one class used in all .cs files?

I have to create a Windows service in C# that will exchange 6 types of XML messages between Oracle database and IBM MQ queue. I have created the XML classes using XSD schemas and xsd.exe. However, I ...
littleO's user avatar
  • 33
2 votes
3 answers
509 views

Multiple Versions C# classes/XSD using XSD.exe

I am using XSD.exe to convert a pretty complex XML-Schema (XSD-file) to C# Classes. I am then using XmlSerializer to read XML into memory and work with the data. In the future, the XSD will change. So ...
a.rlx's user avatar
  • 54
0 votes
1 answer
61 views

Pass complex value to object for XML serialization

I have XSD file which was base to generate (by xsd.exe tool) C# classes for serialization. DotNetCore 3.1. Below is generated code public partial class Deklaracje { public PozycjeSzczegolowe ...
Jacek's user avatar
  • 12k
0 votes
1 answer
70 views

How to create an XML file via the following XSD

Based on the Schema i'm supposed to build an XML File looking exactly like the XML File i show below, i'm not able to change the structure or anything about it. <?xml version="1.0" ...
HarderDaniel's user avatar
0 votes
2 answers
133 views

Problems creating an xml file using an xsd file in c#

I need to create an XML file from an XSD file via a class. I'm new to programming so I followed this tutorial to make my first test XML and it worked out fine: Generating XML file using XSD file But ...
HarderDaniel's user avatar
0 votes
1 answer
81 views

How Do I Deserialize Into Local Collections in .NET?

I am trying to build a data pipeline in .NET. I have been given an xsd and have used the XML Schema Definition Tool to generate C# classes that represent the object model. In order to load this data ...
Robin Zimmerman's user avatar
4 votes
0 answers
534 views

'xscgen' is not recognized as an internal or external command

I'm using the dotnet-xscgen to create .cs files from xsd files in my project. My project file looks like the following <Target Name="PreBuild" BeforeTargets="PreBuildEvent"> ...
sonu davidson..'s user avatar
0 votes
1 answer
160 views

Force writing of default attribute values to xml file

I am working on a system that loads from and writes to XML files, it also parses these files in an a schema aware manor. However I need to interface with schema unaware applications. When I save my ...
Austin's user avatar
  • 115
1 vote
2 answers
85 views

XML date validation using XSD assertion with Saxon.Api (.NET version)

The validation rule: The EndDate should be greater than the StartDate when EndDate is not null/empty. I'm getting an error on the last entry of employer while I'm expecting none. Am I doing something ...
Crysis's user avatar
  • 13
4 votes
1 answer
5k views

ArrayOfXElement to DataSet in C#

No, there is no appropriate answer in stack overflow yet. I am getting ArrayOfXElement in .net Core through Connected Services. But, I need to convert it into DataSet. How can I do that? I wrote the ...
Ken's user avatar
  • 41
0 votes
1 answer
36 views

Identify optional elements in XSD in c# once imported with CodeDom

I've analysed an XSD document inside which are some optional elements. Within the produced C# code I find every int, decimal, datetime,... elements with an additional field xxxFieldSpecified. I ...
philippe's user avatar
0 votes
2 answers
3k views

Cannot switch to Unicode Error When Executing a Private Method

Hello I am receiving an error (-<OrderUpdateReply>-<Error><ErrorDescription>There is no Unicode byte order mark. Cannot switch to Unicode.</ErrorDescription></Error>&...
Michele's user avatar
  • 57
0 votes
2 answers
130 views

Output xsd sequence information after simple element with dataset

I work with the xsd.exe to create a DataSet class for vb.net. All output data are contained inside this DataSet so I can use the DataSet.writexml(writer as XMLWriter) method to output the data to a ...
gamps's user avatar
  • 18
2 votes
1 answer
521 views

How to manage "NO-BREAK SPACE" used for formatting of XDocument?

Some users are trying to upload a document with U+00A0 NO-BREAK SPACE symbols used for formatting: <myConfig>   <defaultConfig>     <defaultTitle>Hello!</defaultTitle>   </...
astef's user avatar
  • 9,398
0 votes
0 answers
349 views

How does C# XML validation against XSD work? [duplicate]

I have created a library to validate the XML file with the XSD file using XmlReaderSettings. It works fine until the user fills data in the XSD file then changes XSD extension to XML and uses the ...
Akethanut's user avatar
0 votes
1 answer
31 views

How to access XSDocument element?

I have the following XSD file and i cannot obtain the inner element with the name "document": I have tried so far the following to no avail: XDocument doc=Xdocument.Load([path]); XNamespace ns="...
Bercovici Adrian's user avatar
0 votes
0 answers
240 views

Unexpected node type Element when generating classes

I have an XSD and would like to serialise it into a C# class. My current process is Go to https://www.liquid-technologies.com/online-xsd-to-xml-converter to convert the XSD to XML and then convert ...
Computer's user avatar
  • 2,207
4 votes
1 answer
1k views

XML validate using XSDs with imports and includes in .net core

I want to validate XML documents against xsds with includes and imports, without includes and imports this code work. These are 4 xsds used to validate xml. Main.xsd <?xml version="1.0" encoding="...
Dulkith's user avatar
  • 326
-1 votes
1 answer
42 views

how do we deal with not knowing the prefix/namespace?

How do I iterate through a specific xpath against an XmlDocument that has no prefix/namespace ? I'm parsing XML like so : var doc = new XmlDocument(); doc.LoadXml(input); var ...
Alex Gordon's user avatar
  • 60.4k
0 votes
2 answers
1k views

Extend existing XSD schema with custom attribute

I need to add some custom attribute to xml file that is validated by existing, already defined schema. Given existing xml element: <existingElement attr1="1" attr2="2" /> Validated with ...
ghord's user avatar
  • 13.8k
1 vote
1 answer
837 views

Java Service - SOAP Responses return always NULL to .NET

I have an SOAP 1.1 Service developed with Spring Boot in Java which responses without any problems to any of my requests and deliver a valid SOAP-response. Now the problem is as soon as I add this ...
lschaertel's user avatar
0 votes
2 answers
72 views

how to iterate through intersection of nodes

How can I iterate only through the common nodes between two documents? Right now, I am able to iterate through all the nodes of my document: var xmlBody = @"<?xml version="1.0" encoding="UTF-8"?&...
Alex Gordon's user avatar
  • 60.4k
1 vote
1 answer
213 views

Xml schema validation does not fail on trailing line-feed

Using the XmlReader, I'm performing schema validation on XML elements who's datatype does not allow line-feeds. If the value contains a line-feed at the beginning or anywhere before the end of the ...
Justin Rocco's user avatar
1 vote
0 answers
70 views

.NET XMLSerializer ignores attributes on serialize [duplicate]

I have a class generated by the xsd.exe tool. It doesn't matter what class, the same problem occurs always which is that every attribute having a type other than string is being ignored when the ...
mh133's user avatar
  • 145
0 votes
1 answer
1k views

Wildcard ##any error xml schema validation

Getting the error above while validating the XSD against the schema in C#. Schema looks for the listed tags and other tags coming in are optional. Below is my XSD file. How the xml file will need to ...
user565992's user avatar
0 votes
2 answers
1k views

Validate XML without XSD

I have an XML file coming in and need that to have a few specific tags without that I cannot process that file. How can I make sure if those tags are there or not , I tried using the XSD validation ...
user565992's user avatar
0 votes
1 answer
1k views

What is the best tool for generating C# classes out of XSD? [closed]

Is there a modern and regularly updated tool for generating C# v.7+ classes of XSD? The only tool I know is xsd2code but it is not free and its last update, according to the official site was "Update ...
nmrlqa4's user avatar
  • 679
0 votes
0 answers
217 views

Getting The complexType 'MaximumPowerType' has already been declared from an AMAZON submit call

Amazon documentation is not clear so I am turning here for help. Five days ago our console program that feeds various data to Amazon from our system started to toss back this error. ...
j.hull's user avatar
  • 440
0 votes
1 answer
153 views

Creating web service from WSDL involving complex type without XSD

I am creating a web service that reflects my WSDL. This WSDL contains complex type which I assume is because it has an XSD as well(which I don't have). The question is can I create a proxy class of ...
Hamza Farrukh's user avatar
0 votes
0 answers
127 views

Unexpected output of xsd.exe

Consider the following simple schema: <xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="MyRoot"> &...
Boris's user avatar
  • 8,911
0 votes
1 answer
201 views

When validating xml against xsd in SaxonEE/dotNet; how do I invoke SetInvalidityHandler?

All I have is: "You can call SetInvalidityHandler(IInvalidityHandler inHandler). This will cause each validity error to be reported to your supplied handler. The error is reported by way of a (poorly ...
walbury's user avatar
  • 68
1 vote
1 answer
1k views

Change autogenerated class' XmlSerialization's namespace handling

I'm currently in the process to create a bunch of files that should then be used by a different programm. Most of them are XML-Files. Naturally, I extracted the .xsd files from the program and used ...
SourceOverflow's user avatar
3 votes
1 answer
1k views

Howto create code from wsdl and separated Xsd

i got a local wsdl file referencing two separate Xsd files. how can I create the relate [c#] classes to that service ? I tried to use wsdl.exe , but it ignores the Xsd files located in the same ...
cortadillo0815's user avatar

1
2 3 4 5
10