NLog: Could not find schema information for - xsd

It seems this answer continues to evade me, and I haven't found a suitable answer on "the internets" yet.
I'm using NLog. The first few lines of my config file are:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
Sometimes when I build my VS2019 project, there are no informational messages. Other times, seemingly without changing anything, I get messages like:
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:nlog'.
Could not find schema information for the attribute 'autoReload'.
...and so on, until it stops after 101 messages. "The maximum number of errors or warnings has been reached."
I'm in a phase now where I'm getting these messages now instead of not getting them. I've never figured this out. Why do I get them, and other times I don't? More importantly, what do I need to do to get rid of these messages for good?
When I look at the XSD in that URL, it complains about a line in the officially "published" XSD. It doesn't like connectionString, as shown in the XSD here:
<xs:annotation>
<xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
</xs:annotation>
Is their "official" XSD the problem here? I don't think that's the case, as I have another project in this solution with basically the same nlog.config, and that doesn't report any informational messages when I rebuild the solution. Just this project. What am I missing?
Thanks in advance!
UPDATE: Today, after not making any changes whatsoever to my code, those messages are gone. I didn't do a full compare of the XSD between now and when I posted this. The connectionStrings part is still in their XSD, as it was before. Doesn't look like it has changed at all. What's happening here?

The XSD is not valid because this is not well-formed xml:
<xs:annotation>
<xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
</xs:annotation>
it should be:
<xs:annotation>
<xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
</xs:annotation>
or perhaps:
<xs:annotation>
<xs:documentation><![CDATA[Name of the connection string (as specified in <connectionStrings> configuration section.]]></xs:documentation>
</xs:annotation>
I recommend that you fix that before looking at anything else.

Related

Modelling Cassandra from XML & C#

I am very beginner to Cassandra. I am finding it difficult to model the XML file attached.
My requirement is:
I get many XML files as given below on daily basis. I need to write a C# program to read the XML and store in Cassandra.
Once stored, the data would be read by 1000's of customers 1000's of times. Once the data is stored, it would NOT be updated again.
NOTE: It is possible that each parent node (Ex: Customer/Site...) may appear more no. of times. i.e i may have Customer2, Site2, another EquipmentDetails node etc.
My XML:
<?xml version="1.0" standalone="yes"?>
<MyAnalystXMLReport>
<MC-DomainID ID="XYZ123">
<Customer Name="CUSTOMER1" ID="53043">
<Site Name="SITE1" ID="488688">
<EquipmentDetails>
<EquipmentDescription>Test Desc</EquipmentDescription>
<EquipmentRefId>T3567111</EquipmentRefId>
<ComponentDescription>COM Oil</ComponentDescription>
<ComponentRefId>
</ComponentRefId>
<AnanlystNo>1235LKJU</AnanlystNo>
<ComponentType>TestComp</ComponentType>
<Sample SampleNo="976023696">
<SampleCondition>USUAL</SampleCondition>
<AnalysisComments>Test Comments</AnalysisComments>
<DateRecieved>2015-12-10</DateRecieved>
<DateAnalysed>2015-12-18</DateAnalysed>
<EquipmentLife>
</EquipmentLife>
<LubricantLife>
</LubricantLife>
<TopUpVolume>0</TopUpVolume>
<FuelUsed>
</FuelUsed>
<Tests>
<TestGroup Name="Group NAME1" ID="667">
<Test Name="Test Name1" ID="1785">
<Result>171.3</Result>
</Test>
</TestGroup>
<TestGroup Name="Group NAME2" ID="617">
<Test Name="Test NAME2" ID="1763">
<Result>153.40</Result>
</Test>
</TestGroup>
</Tests>
</Sample>
</EquipmentDetails>
</Site>
</Customer>
</MC-DomainID>
</MyAnalystXMLReport>
How would i model this XML in efficient way to achieve this requirement?
And what is the easiest way to store this data data & model in Cassandra using C#. Any example would be greatly appreciated.
Thanks for your help.
So to begin, modelling data for use in Cassandra is a bit different than a traditional RDBMS. My first suggestion would be to look at this link:
http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling
Basically Cassandra using a table-per-query methodology to determine the data models. This means that you need to know how your application will query the data and then model your logical and physical persistance models after that. DataStax has some excellent tutorial videos on Cassandra in general and Data modelling specifically. See here:
https://academy.datastax.com/courses/ds220-data-modeling
As far as how to use it from C#, there is a good video on how to get started using c# here:
https://academy.datastax.com/demos/getting-started-apache-cassandra-and-c-net

Preventing special characters in tridion component field and changes in schema

In component, I should not allow any special characters to be entered. When I try to enter a comma, it should suggest "no special characters allowed". Please suggest where do I make the necessary changes. I tried making some changes in schema(source) like adding but not working.
<xsd:element name="FileName">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="[a-zA-Z0-9_.' !##$%^*()_+={}|/:;,>?/`~ ]"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
What you're asking for is a custom validation that may not be best accommodated via the Schema (XSD). You may be able to do it there via a feature called facets. Check the sdllive docs for examples. You can make it give you validation error messages, but you cannot customize the messages themselves, and they are ugly and scary looking for the average content editor.
The other approaches are:
1) develop a custom event via the Event System. This is the easiest option IMO. Simply throw an exception with a custom message on a Compenent Save event in the Init phase.
2) develop a custom GUI extension to do the validation. This IMO is more work than the above, but is achievable.

Using <xs:appinfo> to specify version information

I have found few examples of "standard" usage of <xs:appinfo>. This one is interesting: http://docstore.mik.ua/orelly/xml/schema/ch15_01.htm#ch15-77057, however I would like to provide info like "used since v1.3" or "deprecated since v1.1". Any suggestion?
Both <xs:documentation> and <xs:appinfo> allow as children any other XML elements without limitations (along with just text).
The XSD language does not specify what exactly that extra XML and its meaning might be.
It purpose is just to allow for anyone to extend particular schema/components with
some extra (structured) information, which could be processed/used further automatically.
So, it is completely up to you how to design that extra XML (which would extend your documentation) and how to process and use it.
For that matter, one usage of such extra XML is to format the annotation text with HTML. In that case, that custom XML will be simply XHTML.

I need my BizTalk map to stop converting xml:lang to ns1:lang

I have a map in BizTalk 2009 that is converting some data into an XML document to be sent on to another system. The target schema includes some elements with xml:lang attributes. BizTalk generates those as ns1:lang. The target system requires that the prefix xml be used.
Here is a simplified example to show what BizTalk is doing:
sample.xsd
<xs:schema targetNamespace="http://example.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="common.xsd"
namespace="http://www.w3.org/XML/1998/namespace" />
<xs:element name="example">
<xs:complexType>
<xs:attribute ref="xml:lang" />
</xs:complexType>
</xs:element>
</xs:schema>
common.xsd
<xs:schema xmlns:xml="http://www.w3.org/XML/1998/namespace"
targetNamespace="http://www.w3.org/XML/1998/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="lang" type="xs:language" />
</xs:schema>
Example of map output
<ns0:example xmlns:ns0="http://example.com/"
xmlns:ns1="http://www.w3.org/XML/1998/namespace"
ns1:lang="en-US" />
Is there some way to convince BizTalk to use the xml prefix?
As far as I know, there is no builtin way for achieving this.
There are, however, two solutions that I can see:
Use a Custom XML StyleSheet
If you right-clik on the map and look carefully in the generated xsl stylesheet, you'll see a XML namespace declaration like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="http://www.w3.org/XML/1998/namespace"
...
>
...
<xsl:attribute name="ns1:lang">
...
This is the default behaviour of the BizTalk mapper and you cannot do anything about it. However, if you proceed to extract the generated XSLT and use this as the backend for your map, you can change this declaration to match the expected outcome.
First, copy the stylesheet to the location of your project.
Include this stylesheet as a file in your BizTalk project
Update the stylesheet, so that the namespace declaration and the matching attribute prefix are correct.
The resulting xsl stylesheet looks like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
...
>
...
<xsl:attribute name="xml:lang">
...
Now you can use this custom stylesheet as a backend for the map.
In Visual Studio, open the map.
Click anywhere on a blank space in the BizTalk designer surface.
In the map properties, locate the Custom XSL Path and specify the location of your custom stylesheet.
Use a Custom Pipeline Component
What you're after is that the message is correct for your target recipient. So the idea is to change the offending namespace prefix as part of sending the message outside BizTalk. The transformation happens during the processing of the send pipeline.
Nic Barden has blogged and provided some source code about this here. You can use his sample as the basis for performing replacement of namespace prefixes, rather than replacing namespaces themselves.
I strongly encourage you to check out the whole series of posts he's done about Developing Streaming Pipeline Components. Nic has made an extensive and thorough job of describing all that's needed to author robust and enterprise-class pipeline components.
Part 1
Part 2
Part 3
Part 4
Part 5
The easier way to do it and have everything work is to just add the namespace declaration at the beginning of the schema definition like this.
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<xs:import schemaLocation="xml.xsd" namespace="http://www.w3.org/XML/1998/namespace" />
In addition to Maxime's suggestions, here are the other possibilities I've found:
Ignore it and hope that the vendor’s API will take it.
I don’t think this will work. When I test the map, BizTalk gives me this error:
Output validation error: Prefix 'ns1' cannot be mapped to namespace name reserved for "xml" or "xmlns".
Hello, BizTalk!? You’re the one who decided to use ns1. Don’t complain about it to me!
Use an XSL-based script functoid to force the output.
This is based on the suggestion I received on the BizTalk forums. It requires that we fudge the output schema to use a dummy attribute that gets replaced with the xml:lang attribute by the functoid.`
Add a search/replace expression
Take the orchestration that calls the map and add an expression after it that would take the XML we’re sending to the vendor and run it through a search/replace regex to fix the namespace prefixes.

SPWeb.ProcessBatchData() create strange folder name in sharepoint document library

i am using SPWeb.ProcessBatchData() method to batch create folders inside one document library. everything works fine expect after folders have been created, folders all have very strange name. for example if my document library's name is 000, then the folder name's is "1._000". I tried a lot of other properties, but i have no luck to find out how to set the folder name right. Can some one help me on this?
Cheers
You are right about the webservices are a bit more strict on the characters you can put in and it cannot process the same amount of requests, but you can work around that I guess :)
What you can do though if you really want to use the ProcessBatchData method is, re-use the result you receive back from the method. If it's correct, you will get all the ListItemId's back from each folder. Using the Id's you can create another batch to rename the Title's of the items.
But if I were you, I would switch and use the webservice and workaronud that :)
this is the correct syntax of the XML to create a folder truly titled:
<?xml version="1.0" encoding="utf-8"?>
<ows:Batch OnError="Continue">
<Method ID="Test">
<SetList Scope="Request">82d62a9a-55ba-49c8-a9b8-68ec965a5931</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">New</SetVar>
<SetVar Name="Type">1</SetVar>
<SetVar Name="owsfileref">/sites/1/docs/folder1</SetVar>
</Method>
</ows:Batch>
the critical line is this one:
<SetVar Name="Type">1</SetVar>
"Type" is the accepted alias of the FSObjType field
Regards,
Ahmad

Resources