@@ 90-99 (lines=10) @@ | ||
87 | */ |
|
88 | public function schemaValidate() |
|
89 | { |
|
90 | if (!$this->xml_data) { |
|
91 | \sasco\LibreDTE\Log::write( |
|
92 | \sasco\LibreDTE\Estado::DOCUMENTO_FALTA_XML, |
|
93 | \sasco\LibreDTE\Estado::get( |
|
94 | \sasco\LibreDTE\Estado::DOCUMENTO_FALTA_XML, |
|
95 | substr(get_class($this), strrpos(get_class($this), '\\')+1) |
|
96 | ) |
|
97 | ); |
|
98 | return null; |
|
99 | } |
|
100 | $this->xml = new \sasco\LibreDTE\XML(); |
|
101 | $this->xml->loadXML($this->xml_data); |
|
102 | $schema = $this->xml->getSchema(); |
|
@@ 122-131 (lines=10) @@ | ||
119 | return null; |
|
120 | } |
|
121 | $result = $this->xml->schemaValidate($xsd); |
|
122 | if (!$result) { |
|
123 | \sasco\LibreDTE\Log::write( |
|
124 | \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_SCHEMA, |
|
125 | \sasco\LibreDTE\Estado::get( |
|
126 | \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_SCHEMA, |
|
127 | substr(get_class($this), strrpos(get_class($this), '\\')+1), |
|
128 | implode("\n", $this->xml->getErrors()) |
|
129 | ) |
|
130 | ); |
|
131 | } |
|
132 | return $result; |
|
133 | } |
|
134 |
@@ 142-151 (lines=10) @@ | ||
139 | // generar XML que se enviará |
|
140 | if (!$this->xml_data) |
|
141 | $this->xml_data = $this->generar(); |
|
142 | if (!$this->xml_data) { |
|
143 | \sasco\LibreDTE\Log::write( |
|
144 | \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_GENERAR_XML, |
|
145 | \sasco\LibreDTE\Estado::get( |
|
146 | \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_GENERAR_XML, |
|
147 | substr(get_class($this), strrpos(get_class($this), '\\')+1) |
|
148 | ) |
|
149 | ); |
|
150 | return false; |
|
151 | } |
|
152 | // validar schema del documento antes de enviar |
|
153 | if (!$this->schemaValidate()) |
|
154 | return false; |
@@ 46-55 (lines=10) @@ | ||
43 | if (!$this->xml_data) { |
|
44 | $this->xml_data = $this->generar(); |
|
45 | } |
|
46 | if (!$this->xml_data) { |
|
47 | \sasco\LibreDTE\Log::write( |
|
48 | \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_GENERAR_XML, |
|
49 | \sasco\LibreDTE\Estado::get( |
|
50 | \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_GENERAR_XML, |
|
51 | substr(get_class($this), strrpos(get_class($this), '\\')+1) |
|
52 | ) |
|
53 | ); |
|
54 | return false; |
|
55 | } |
|
56 | // validar schema del documento antes de enviar |
|
57 | if (!$this->schemaValidate()) { |
|
58 | return false; |