Sybase ASE - xmlvalidate with xml schema - xsd

I receive inputs to a procedure as xml and I've prepared the xml schema and would like to validate the input with the schema and throw an error if the input doesn't comply. I am trying to use xmlvalidate() option 'schemavalidate=yes' but couldn't figure out where to store my xml schema. The examples indicate a http url as the xml schema but should I host my xml schema? or should I store it as a database "text" column? Could someone guide me how to store and use the xml schema to use xmlvalidate()? We are at Sybase ASE 15.7
Appreciate your help!
Just adding the below question as hurdled in my next step on this:
I've hosted my xml schema and trying to use xmlvalidate as below:
xmlvalidate(#purgeTableInfo, option 'schemavalidate=yes, nonamespaceschemalocation="http://myhost:5000/purgeschema"')
The required access to this purge schema has been provided to the unix box/login that hosts the database. We are able to ping to "myhost" from the unix box on which sybase is running. But, I am still getting the below error.
"XMLVALIDATE(): XML parser fatal error <<An exception occurred!
Type:NetAccessorException, Message:Could not create the socket for URL
'{0}'. Error={1>> at line 0, offset 0.
Sybase error code=14702
Severity Level=16, State=0, Transaction State=0"
Does anyone know what would be the reason and how should I go about fixing this?
Any help on this would be great!

According to the documentation, to validate against a dtd, your schema needs to be hosted. Your xml should be stored in a text column in the database, not your xml schema. There are a number of examples in the documents, which should guide you in the right direction.

Related

Disable Schema Validation for Cosmos DB?

I'm using Cosmos DB in Azure. I recently changed the schema to add more information. However, I'm confused because Cosmos uses SQL to query the database. Further, it seems I can't query based on the new schema because I receive the following error messsage:
Message: {"errors":[{"severity":"Error","location":{"start":22,"end":29},"code":"SC2001","message":"Identifier 'comment' could not be resolved."}]}
So I'm wondering is it possible to disable schema validation so I can query on the new comment attribute, without getting this error message.
Further, I'm confused how Cosmos DB can be considered a NoSQL database if it behaves much the same as MySQL.
Edit: The query I am using is
SELECT * FROM c
WHERE comment = ""
The error is not related to the schema, the error is saying your query is incorrectly written.
Following the official documentation (for example, https://learn.microsoft.com/azure/cosmos-db/sql/sql-query-getting-started#query-the-json-items)
The query should be:
SELECT * FROM c
WHERE c.comment = ""
Keep in mind that that query is not checking for documents that do not have the comment property, it's basically filtering documents that do have the comment property with an empty string value.

Unable to use Code data type in Mongoose Schema

I wanted to store a data type of Code in my MongoDB database per the docs.
The issue is that when I use Mongoose to specify this type, I get an error:
ReferenceError: Code is not defined
And yes, Mongoose's doc's don't have a type of Code.
Say I want to save Javascript code in my MongoDB database, how could I do so?
For more insight into why I am doing this: I want to save Puppeteer scripts in the database, and using the FS module add them to a file, execute them and send the results as a response object back to the client.
Right now, the code is saved as String, which seems to cause execution errors.
For more information, please don't hesitate to ask.
Thank you,

Spark-Solr Connector trying to add already existing field with stored=true

I am using Spark-Solr connector 3.4.0 with Solr cloud version 7.6.0 in a Spark 2.2.1 Cluster . We have an existing Solr collection with a predefined schema for it. Most of the fields have the stored parameter set to true, but there are certain fields where we explicitly set stored=false. When we try to push data to Solr using the spark-solr connector, we get the following error-
org.apache.solr.api.ApiBag$ExceptionWithErrObject: error processing commands, errors: [{add-field={name=taxonomy, indexed=true, multiValued=true, docValues=true, stored=true, type=string}, errorMessages=[Field 'item_id_channel' already exists.
]}],
at org.apache.solr.handler.SchemaHandler.handleRequestBody(SchemaHandler.java:92)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:2541)
at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:709)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:515)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:323)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
The error says the item_id_channel already exists, but this error is only raised for fields for which we have defined stored=false (in the Solr schema). I get that the connector wishes to create the schema again for some reason, but it sets the stored parameter to true which clashes with the predefined schema definition on Solr for this field.
My question is - Is there a way to tell the connector (probably through some option?) that we want the stored to be set to true for certain fields? And probably a generic way to define other solr parameters for the fields?
We found the issue that was causing the error. There was a bug in older versions of spark-solr connector, because of which the connector was trying to add existing fields to the solr schema in case the value of stored was true. This was fixed in 3.5.5 release. Hence, once we upgraded our connector to version 3.5.14, the ingestion stared working without any errors.

Server error when sorting generated entity with field name with underscore

I am getting error.internalServerError when sorting generated entity in generated table view. It leads to error only in case of fields with database names with underscore. For example project_owner.
In my console I am getting this:
GET http://localhost:9000/api/projects?cacheBuster=1489187431846&page=0&size=20&sort=image_logo_url,asc&sort=id 500 (Internal Server Error)
Is it a bug, or only my local problem?! Thanks.
The problem is in wrong parsing. See this URL for more information:
https://jira.spring.io/browse/DATACMNS-816
I thought, that when I generate field with name project_owner, it will be stored as project_owner, but entity name will be camelCase -> projectOwner.
So If you have the same issue, check your entity names and refactor them to camelCase syntax.

BizTalk Schema development Could not find schema information for the element

Please find the below sample XML format, for which I'm trying to build a schema's on BizTalk Solution.
I was receiving the warning messages as
warning BEC2004: Could not find schema information for the element 'ORX'.
warning BEC2004: Could not find schema information for the element 'NONSIGNONMSGSRQV1'.
warning BEC2004: Could not find schema information for the element 'NONSONRQ'.
warning BEC2004: Could not find schema information for the element 'CLIENT'.
warning BEC2004: Could not find schema information for the element 'ID'.
warning BEC2004: Could not find schema information for the element 'USERPASS'.
etc..
.....
.....
<?xml version="1.0" encoding="UTF-8"?>
<?ORX ORXHEADER="200" VERSION="201" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE" ?>
<ORX>
<NONSIGNONMSGSRQV1>
<NONSONRQ>
<CLIENT>123456765</CLIENT>
<ID>arout_int</ID>
<USERPASS>IM_Developer</USERPASS>
<LANGUAGE>ENG</LANGUAGE>
<APPID>WASSUP</APPID>
<APPOVER>1</APPOVER>
</NONSONRQ>
</NONSIGNONMSGSRQV1>
<NONVERMSGSRQV1>
<NONEMPLOYERHISTTRNRQ>
<COOKIE>1234576540</COOKIE>
<COOKIETAN>12345612340</COOKIETAN>
<BILLINGO1>45674567890</BILLINGO1>
<BILLINGO2>1245673567890</BILLINGO2>
<PURPOSE>
<CODE>PROGRAM</CODE>
</PURPOSE>
<EMPLOYERHISTRQ>
<EMPLOYEEID>123004567</EMPLOYEEID>
</EMPLOYERHISTRQ>
</NONEMPLOYERHISTTRNRQ>
</NONVERMSGSRQV1>
</ORX>
After I did some Googling, I got some knowledge from the link Validating XML Instance having issues I tried to remove target name space of Schema properties, but BizTalk solutions is not allowing to remove the targetnamespace, which is already there for the schema.
Please could any one suggest me, how could I apply that settings to my XML schema development, as my XML document doesn't have targetnamespace?
I have solved this issue by reading BizTalk 2006 Recipes: A Problem-Solution Approach,
Steps: Open the schema -> Goto Schema Node -> Schema node properties -> remove the namespace, then solved the problem.

Resources