Skip to content

Commit

Permalink
Generala lo schema.xml pulito dall'.xsd ufficiale solo la prima volta…
Browse files Browse the repository at this point in the history
…. Mantiene repositorato anche questo.
  • Loading branch information
s2software committed Jan 4, 2019
1 parent e62e862 commit 378b76c
Show file tree
Hide file tree
Showing 4 changed files with 1,338 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,4 +1,3 @@
/.settings
/.buildpath
/.project
/tmp
14 changes: 8 additions & 6 deletions fatturapa.php
Expand Up @@ -366,12 +366,14 @@ public function get_schema()
protected function _build_schema()
{
// https://www.phpflow.com/php/how-to-convert-xsd-into-array-using-php/
$doc = new DOMDocument();
$doc->preserveWhiteSpace = true;
$doc->load(self::_filepath('schema/FatturaPA_1.2.1.xsd'));
@mkdir(self::_filepath('tmp'));
$doc->save(self::_filepath('tmp/schema.xml'));
$xmlfile = file_get_contents(self::_filepath('tmp/schema.xml'));
if (!file_exists(self::_filepath('schema/schema.xml')))
{
$doc = new DOMDocument();
$doc->preserveWhiteSpace = true;
$doc->load(self::_filepath('schema/FatturaPA_1.2.1.xsd'));
$doc->save(self::_filepath('schema/schema.xml'));
}
$xmlfile = file_get_contents(self::_filepath('schema/schema.xml'));
$parseObj = str_replace($doc->lastChild->prefix.':',"",$xmlfile);
$obj = simplexml_load_string($parseObj);
$json = json_encode($obj);
Expand Down
2 changes: 2 additions & 0 deletions schema/Leggimi.txt
@@ -0,0 +1,2 @@
- FatturaPA_1.2.1.xsd: file XSD ufficiale scaricato da qui https://www.fatturapa.gov.it/export/fatturazione/it/normativa/f-2.htm
- schema.xml: schema pulito generato dal costruttore della classe FatturaPA partendo dal file FatturaPA_1.2.1.xsd; da eliminare se si vuole rigenerare

0 comments on commit 378b76c

Please sign in to comment.