xml-validation

Xsd recursion of complexTypes

I am just learning XML/XSD and am struggling with the implementation of an XML-schema which models a folder structure. What I had in mind was defining a complexType for the folder which can have additional folder instances that represent subfolders. Using the xsd schema validator here always returns that the schema is invalid. I tried ...

Getting started with XSD validation with .NET

Here is my first attempt at validating XML with XSD. The XML file to be validated: <?xml version="1.0" encoding="utf-8" ?> <config xmlns="Schemas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <levelVariant> <filePath>SampleVariant</filePath> </levelVariant> <levelVariant> ...

Fluent NHibernate OptimisticLock.None() causes "The string 'none' is not a valid Boolean value."

I'm using the following mapping: public class LoadMap : IAutoMappingOverride<Load> { public void Override(AutoMapping<Load> mapping) { mapping.HasMany(x => x.Bids).OptimisticLock.None(); mapping.Version(x => x.Version); } } But when I try to create the session I get the following exception: [FormatException...

.NET IsValidXml Extension Method Performance

I have a legacy application that I inherited that passes a lot of XML around as Strings. I often need the ability to check if a String will be valid XML. What is the fastest and least expensive way to check if a string is valid XML in .NET? I'm working in .NET 3.5 and would most likely use this as an extension method (off of string) i...

validating an XML schema with empty attributes

I am having trouble validating my xml schema. I get these errors on the schema 113: 18 s4s-elt-invalid-content.1: The content of '#AnonType_user' is invalid. 164: 17 s4s-elt-invalid-content.1: The content of '#AnonType_festival' is invalid. Element 'sequence' is invalid, misplaced, or occurs too often. and becuase...

Validate filled elements but ignore empty elements

Yaneeve was kind enough to fix my schema for me which was causing lots of problems This isn't so much of a problem but i would be nice to have this work Some of my elements are empty such as a mobile number or fax number. I need to validate the length of the element to make sure they have the correct number of digits but i don't want ...

XML Schema: Namespace issues when importing shared elements

When trying to import shared definitions from a XML Schema, I can properly reference shared types, but referencing shared elements causes validation errors. This is the schema that imports the shared definitions (example.xsd): <?xml version="1.0" encoding="UTF-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.o...

How can I stop rails validating xml?

I'm submitting to a rails webservice the following message: xmlPostData = "<message> <message-text>" + MESSAGE_WITH_XML + "</message-text> <name>" + subject + "</name> <f1>" + toPhone + "</f1> <f2>" + fromPhone + "</f2> </message>"; The problem...

VB.Net Validate an xml against a schema (strange problem)

I have written a small XML validator, that takes in an XML file and an XML schema and validates the XML files against that schema. It works well, except for an XML file, with this content: <?xml version="1.0" encoding="utf-8"?> <xc:program xmlns:xc="http:\\www.something.com\Schema\XC10" xc:version="4.0.22.0" > <xc:namespaceDecls> ...

Help me convert .NET 1.1 Xml validation code to .NET 2.0 please.

It would be fantastic if you could help me rid of these warnings below. I have not been able to find a good document. Since the warnings are concentrated in just the private void ValidateConfiguration( XmlNode section ) section, hopefully this is not terribly hard to answer, if you have encountered this before. Thanks! 'System.Configur...

How to validate, on run time, xml against xsd without save the file on local folder?

I need to validate XMLs files against XSDs. The XML will be downloaded from URL and I will keep it as StremReader or XmlDocument. The XSD will return from DataBase as nvarchar(max). I am prohibited to save the files locally. Has anybody an example how to deal with this situation? I am trying this way but I am getting the XmlException "Ro...

How to Create an XmlSchema instance from a String or an .xsd stored as a resource

I have an .xsd file stored as a resource in my vb.net project. I need to create an instance of the XmlSchema class using this resource. Any examples of creating an XmlSchema I can locate do one of the following: Create the xmlschema by adding elements and attributes manually like this example. Create the xmlschema using an XmlTextRea...

Creating Valid XML Against Schema with XSLT

I'm sorting a list of elements based on type, as defined in my schema. I know that XSLT can validate against a given schema, but what I want to do is check to make sure that my operation (a copy in this case) is valid before I do it. Simplified code: Incoming Data: <?xml version="1.0"?> <sch:foo xmlns:sch="http://www.whatever.com/sche...

How do I validate xml using an xml schema?

Is it possible to validate the following xml with the following schema? I'd like to validate the xml without specifying the schema in the xml file. I'm not sure if this is possible or not, but would appreciate some help figuring out how to do it. I keep getting the following error when I attempt to validate the xml. org.xml.sax.SAXPar...

Validating XBRL instance documents in .NET

Hi I'm currently working with creation and validation of XBRL instance documents in C#, and I've run into some problems regarding the XBRL instance schema file: http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd According to the .NET schema validator, the schema is not valid. It throws the following exception: System.Xml.Schema.Xm...

XML validation with XSD: how to avoid caring about the sequence of the elements?

Hello everyone: I have following XSD code: <xsd:complexType name="questions"> <xsd:sequence> <xsd:element name="location" type="location"/> <xsd:element name="multipleChoiceInput" type="multipleChoiceInput" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="textInput" type="textInput" minOccurs="0" max...

Validating XML with XSDs ... but still allow extensibility

Maybe it's me, but it appears that if you have an XSD <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; <xs:element name="User"> <xs:complexType> <xs:sequence> <xs:element name="Given...

Validating XML in Perl with libxml and an XSD file

I am trying to have my perl script get an Xxml file from online and validate it according to an XSD file. The code to do this is as follows: my $url = shift @ARGV; my $response = $ua->get($url) || die "Can't fetch file"; my $file = $response->content; my $schema_file = "schema.xsd"; my $schema = XML::LibXML::Schema->new(location => $s...

Validation Problem: EntityRef: expecting ';' -- What Should I do?

Hi I've got some XML that won't validate. I've narrowed down the problem to this bit: <script type="text/javascript">document.getelementbyid("oxm-1f4a4485-5a1d-45f9-a989-9c65a0b9ceb6").src="http://bid.website.net/display?l=h4siaaaaaaaaad2nmq6cqbrenycw7qjyolfccxmregvcoae0u0sly_agtvaewwn4bg_havwbnebpvmzkkzra_kzzdvoloq4u-hjnp7sii0rxcbzz5vl...

XML Validation: Error Parsing Attribute Name

Hi, I've got an XML validation problem. This bit: <script type="text/javascript"> oxm_ad = {"website":"cca9e4b4-7ed2-848z-ffea-067efabc891a", "size":"468x60", "floor":"0.01", "beacon":"<div id='beacon_017a6c9ega' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'><img src='http://www.website.com/openx/www/delivery/lg.p...