Oracle PLSQL CreateSchemaBasedXML using multiple schemas - oracle

I am trying to perform XSD validation against an XML document within PLSQL and I'm having an issue with getting it working.
I have created an XMLTYPE object, which when I call isSchemaBased() against it returns 0 (false). Now obviously the XMLTYPE needs to be schema based in order to be validated, I found that you can make a schema based version by calling createSchemaBasedXML against the XMLTYPE. The problem I am having is that my schema is broken into two parts (combining the schema files is not an option unfortunately), which means that when I try and createSchemaBasedXML specifying the main schema it fails because it is unable to resolve a reference which is imported from the second XSD document.
-- lxml is the XMLTYPE which has been populated with the XML before this point
dbms_xmlschema.registerSchema(
schemaURL => mainSchemaURL,
schemaDoc => mainSchemaDoc,
local => true,
genTypes => true,
genTables => false,
force => true,
enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE);
dbms_xmlschema.registerSchema(
schemaURL => importedSchemaURL,
schemaDoc => importedSchemaDoc,
local => true,
genTypes => true,
genTables => false,
force => true,
enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE);
if lxml.isSchemaBased() = 1 then
dbms_output.put_line('Schema based');
else
dbms_output.put_line('Non-schema based');
end if;
dbms_ouput.put_line('About to apply schema');
lxml := lxml.createSchemaBasedXML(mainSchemaURL);
dbms_ouput.put_line('We don't get this far');
lxml := lxml.createSchemaBasedXML(importedSchemaURL);
Is there any way of being able to import both the mainSchemaURL and the importedSchemaURL at the same time so that the imported schema references within the main schema don't cause the failure;
ORA-31079: unable to result reference to type [type containing imported type]
Any help or pointers would be greatly appreciated.
UPDATE: I am working with Oracle version 11g

The answer was provided by 'odie_63' on the Oracle forums [here][1]
In the end it was a case of specifying the schemaLocation for the import of the importedSchema
[1]: https://forums.oracle.com/message/11135111 "CreateSchemaBasedXML using multiple schemas
"

Related

Where is Oracle APEX source code framework located

Recently i start learning Oracle APEX and i have a question (i'm familiar with plsql):
Where is the source code for APEX located, in which schema ?
EG: For this piece of code where can i find APEX_COLLECTION.COLLECTION_EXISTS souce code :
IF :P9_HOW_MANY is NOT NULL and :P9_HOW_MANY > 0 then
IF NOT APEX_COLLECTION.COLLECTION_EXISTS (p_collection_name => 'CHILDREN') THEN
APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION(
p_collection_name => 'CHILDREN');
END IF;
APEX_COLLECTION.ADD_MEMBERS(
p_collection_name => 'CHILDREN',
p_c001 => apex_application.g_f01,
p_c002 => apex_application.g_f03,
p_c003 => apex_application.g_f04,
p_c004 => apex_application.g_f02
);
End IF;
Thank you.
I think i found the answer, i will leave this here in case it helps anyone:
APEX_COLLECTION
APEX_ITEM
ETC..
all are public synonyms located in SYS schema and the source code is in APEX_190200 schema on the WWV_FLOW_COLLECTION package.

LOGSTASH - Issue with JDBC input connected to HSQL DB database when selecting ARRAY columns

I'm having troubles to successfully import HSQL DB database content using Logstash's JDBC input plugin.
The problem occurs when I try to fetch a column that is of type ARRAY.
Please note that if I try to fetch non-array columns, it works just fine.
I get the following error message from Logstash :
[WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::OrgLogstash::MissingConverterException: Missing Converter handling for full class name=org.hsqldb.jdbc.JDBCArray, simple name=JDBCArray>}
[INFO ][logstash.pipeline ] Pipeline has terminated {:pipeline_id=>"hsql", :thread=>"#<Thread:0x7b626752 run>"}
Please find below the input part of the Logstash conf file (PLATFORM_DESTINATION_CANDIDATES is the name of a column in a table.)
input {
jdbc {
jdbc_driver_library => "hsqldb_2.5.0.jar"
jdbc_driver_class => "org.hsqldb.jdbc.JDBCDriver"
jdbc_connection_string => "jdbc:hsqldb:hsql://localhost/probe"
jdbc_user => "SA"
statement => "SELECT PLATFORM_DESTINATION_CANDIDATES FROM PUBLIC.MESSAGES_SENT"
connection_retry_attempts => 10
}
}
Did any of you encounter this kind of problem, and how did you solve it ?
Thanks.
OS : windows 10
Logstash version : 6.3.1
HSQLDB driver version : 2.5.0 (LINK)
I do not know if it is the best solution, but I managed to solve my issue. Here is how.
I replaced the line :
statement => "SELECT PLATFORM_DESTINATION_CANDIDATES FROM PUBLIC.MESSAGES_SENT"
with :
statement => SELECT concat_ws('', PLATFORM_DESTINATION_CANDIDATES , '') AS str_platforms
It has the consequence to put in the field str_platforms of type string data that looks like : ARRAY[1,2,3,4]
With the following ruby line, I then remove unwanted characters ( ARRAY[ and ] ) from the field :
ruby {
code => "event.set('listRxUnits',event.get('str_platforms').split('ARRAY[')[1].split(']')[0])"
}

How to register binary XML schema (using Oracle12c)?

I have a problem with registering BINARY XML schema using Oracle 12c version.
If I'm correct BINARY scheme registration option is available since Oracle 11g version? But using 12c it shows me an error that BINARY option is still not declared.
BEGIN
DBMS_XMLSCHEMA.REGISTERSCHEMA
(
SCHEMAURL => 'http://localhost:8080/public/leagues.xsd',
SCHEMADOC => bfilename('XMLDIR', 'LEAGUES.xsd'),
GENTYPES => FALSE,
OPTIONS => REGISTER_BINARYXML
);
END;
/
As a result of this, I receive an error :
PLS-00201: identifier 'REGISTER_BINARYXML' must be declared
Because that option (register_binaryxml) should be invoked through dbms_xmlschema package as dbms_xmlschema.register_binaryxml.
That is, replace options => register_binaryxml with options => dbms_xmlschema.register_binaryxml

Laravel localization file format error: array() versus [] format

I am struggling a bit with localization in Laravel 5.3 (with php 7). The default localizaiton file format in Laravel 5.3 is using brackets, as in this example:
return [
'footer.contact.email' => 'Email:',
]
That's what I have been using in my app and it's working fine. But now I am trying to work with some packages to help with translations, for example:
https://github.com/potsky/laravel-localization-helpers
https://github.com/barryvdh/laravel-translation-manager
But both of those generate localization files in the "old" laravel 4.x array format. For example
return array(
'footer' => array(
'contact' => array(
'email' => 'Email:',
),
),
);
As I understand it I should have no issue with this localization file format in my laravel 5.3 app, however it's always throwing an exception:
[2016-12-02 13:26:01] local.ERROR: ErrorException: htmlspecialchars() expects parameter 1 to be string, array given in C:\100_source_code\consulting_platform_laravel\maingig\vendor\laravel\framework\src\Illuminate\Support\helpers.php:519
Stack trace:
#0 C:\100_source_code\consulting_platform_laravel\maingig\vendor\sentry\sentry\lib\Raven\Breadcrumbs\ErrorHandler.php(36): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'htmlspecialchar...', 'C:\\100_source_c...', 519, Array)
I really cant understand why this format is not working with my app. I bet it is something trivial that I am missing, but any help would be very welcome!
Thanks,
Christian
After a few extra hours of stepping through the code I found the source of the problem.
For example, I got these in my original lang file:
'footer.subscribe' => 'SUBSCRIBE TO OUR NEWSLETTER',
'footer.subscribe.intro' => 'Be the first to know about our latest news...',
'footer.subscribe.privacy' => 'Privacy Policy',
'footer.subscribe.tos' => 'Terms of Service',
'footer.subscribe.tac' => 'Terms and Conditions',
As I tried to use both of the packages mentioned in my original question they produced the following output:
'footer' =>
array (
'subscribe' =>
array (
'intro' => 'TODO: intro',
'privacy' => 'TODO: privacy',
'tos' => 'TODO: tos',
'tac' => 'TODO: tac',
),
),
As you can see the generated file dropped the value for the text footer.subscribe and only kept the child element, intro, privacy, tos and tas in this case. Therefore a request for trans('footer.subscribe') returns an array and not the text.
Now that I know this I will change the format of my original translation file!
c.

Unable to programmatically create tags in GitHub - ISO8601 timestamp is invalid

In my lumen app I'm trying to programmatically create tags a GitHub repo. My setup is working great except something is up with the tagger.date that I can't figure out. The API is telling me that the timestamp is not valid:
[Github\Exception\RuntimeException]
Invalid request.
2016-07-10T13:32:07+0000 is not a valid date-time.
However the timestamp included in the error message appears to be correctly formatted based on the documentation.
$github->git()->tags()->create(
$githubConfig['namespace'],
$githubConfig['repository'],
[
'tag' => $this->version->patchTag(),
'tagger' => [
'name' => config('github.tagger.name'),
'email' => config('github.tagger.email'),
'date' => Carbon::now()->toIso8601String()
],
'message' => 'This release was automatically published by [Game-Watcher](https://github.com/bkuhl/game-watcher).',
'object' => $masterBranch['commit']['sha'],
'type' => 'commit'
]
);
This fiddle indicates the time format is valid.
Try using Carbon::now()->toAtomString() instead.
Carbon's common formatting methods are "wrappers for the common formats provided in the DateTime class".
The documentation for DateTime::ISO8601 carries this warning:
Note: This format is not compatible with ISO-8601, but is left this way for backward compatibility reasons. Use DateTime::ATOM or DATE_ATOM for compatibility with ISO-8601 instead.
The relevant difference appears to be with the timezone offset. DateTime::ISO8601 uses +0000 for UTC, while DateTime::ATOM uses +00:00.

Resources