Merge lp:~nbrinza/zorba/parse-fragment into lp:zorba

Proposed by Nicolae Brinza
Status: Superseded
Proposed branch: lp:~nbrinza/zorba/parse-fragment
Merge into: lp:zorba
Diff against target: 366 lines (+129/-37)
13 files modified
ChangeLog (+3/-0)
src/runtime/parsing_and_serializing/fragment_istream.h (+21/-10)
src/runtime/parsing_and_serializing/parse_fragment_impl.cpp (+2/-0)
src/store/naive/loader_dtd.cpp (+23/-17)
src/store/naive/loader_fast.cpp (+10/-10)
test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-31.xml.res (+3/-0)
test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-32.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-33.xml.res (+2/-0)
test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-31.xq (+16/-0)
test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-32.xq (+12/-0)
test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-33.xq (+16/-0)
test/rbkt/Queries/zorba/parsing_and_serializing/streamable.xml (+1/-0)
test/rbkt/Queries/zorba/parsing_and_serializing/wiki.xml (+18/-0)
To merge this branch: bzr merge lp:~nbrinza/zorba/parse-fragment
Reviewer Review Type Date Requested Status
Matthias Brantner Needs Fixing
Chris Hillery Pending
Review via email: mp+117814@code.launchpad.net

This proposal has been superseded by a proposal from 2012-08-29.

Commit message

Fixes for bugs #1023170, #1024033, #1027270

Description of the change

Fixes for bugs #1023170, #1024033, #1027270

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job parse-fragment-2012-08-01T22-40-58.445Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Pending.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

Could you please add the changes to the ChangeLog?

review: Needs Fixing
lp:~nbrinza/zorba/parse-fragment updated
10538. By Nicolae Brinza

Merged with Zorba trunk

10539. By Nicolae Brinza

Updated the Changelog with fixes for bugs #1016606 and #1024033

10540. By Nicolae Brinza

Updated the Changelog with the fix for the bug #1023170

10541. By Nicolae Brinza

Merged with Zorba trunk

10542. By Nicolae Brinza

Fix for bug #1099535 endless loop in xml:parse()

10543. By Nicolae Brinza

Merged with Zorba trunk

10544. By Nicolae Brinza

Updated Changelog to mention fix for bug #1099535

10545. By Nicolae Brinza

Merged with Zorba trunk

10546. By Nicolae Brinza

Fixed bug #1099648 -- XML parsing failures on Red Hat

10547. By Nicolae Brinza

Updated Changelog to mention the fix for bug #1099648

10548. By Nicolae Brinza

Merged with Zorba trunk

Unmerged revisions

10548. By Nicolae Brinza

Merged with Zorba trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2012-08-29 11:12:58 +0000
+++ ChangeLog 2012-08-29 15:25:22 +0000
@@ -4,11 +4,14 @@
44
5New Features:5New Features:
6 * Allow prolog variables to be referenced before they are declared (XQuery 3.0 feature)6 * Allow prolog variables to be referenced before they are declared (XQuery 3.0 feature)
7 * xml:parse (fragment parsing) now allows for a DOCTYPE declaration at the
8 beginning of the XML document (requested in bug #1016606).
79
8Optimizations:10Optimizations:
9 * New memory management for compiler expressions (no more ref counting)11 * New memory management for compiler expressions (no more ref counting)
1012
11Bug Fixes/Other Changes:13Bug Fixes/Other Changes:
14 * Fixed bug #1024033 and #1023170 (segfaults in parse-xml:parse())
12 * Fixed bug #898792 (Dynamically computed strings can now be cast to xs:QName)15 * Fixed bug #898792 (Dynamically computed strings can now be cast to xs:QName)
13 * Fixed bugs #899364 and 899363 (throw XQST0103 in case of non-distinct window16 * Fixed bugs #899364 and 899363 (throw XQST0103 in case of non-distinct window
14 variables)17 variables)
1518
=== modified file 'src/runtime/parsing_and_serializing/fragment_istream.h'
--- src/runtime/parsing_and_serializing/fragment_istream.h 2012-08-29 11:12:58 +0000
+++ src/runtime/parsing_and_serializing/fragment_istream.h 2012-08-29 15:25:22 +0000
@@ -30,8 +30,7 @@
30class FragmentIStream : public std::istream30class FragmentIStream : public std::istream
31{31{
32public:32public:
33 static const unsigned int BUFFER_SIZE = 4096;33 static const unsigned int DEFAULT_BUFFER_SIZE = 4096;
34 static const unsigned int LOOKAHEAD_BYTES = 3; // lookahead fetching is implemented, but currently not used
35 static const unsigned int PARSED_NODES_BATCH_SIZE = 1024;34 static const unsigned int PARSED_NODES_BATCH_SIZE = 1024;
36 35
37 // names of these states are orientative36 // names of these states are orientative
@@ -44,7 +43,8 @@
44public:43public:
45 std::istringstream* theIss;44 std::istringstream* theIss;
46 std::istream* theStream;45 std::istream* theStream;
47 char* theBuffer;46 StreamReleaser theStreamReleaser;
47 std::vector<char> theBuffer;
48 unsigned long bytes_in_buffer;48 unsigned long bytes_in_buffer;
49 unsigned long current_offset;49 unsigned long current_offset;
50 int current_element_depth;50 int current_element_depth;
@@ -64,7 +64,7 @@
64 std::istream(NULL),64 std::istream(NULL),
65 theIss(NULL),65 theIss(NULL),
66 theStream(NULL),66 theStream(NULL),
67 theBuffer(NULL),67 theStreamReleaser(nullptr),
68 bytes_in_buffer(0),68 bytes_in_buffer(0),
69 current_offset(0),69 current_offset(0),
70 current_element_depth(0),70 current_element_depth(0),
@@ -83,18 +83,30 @@
83 {83 {
84 return reached_eof && current_offset >= bytes_in_buffer;84 return reached_eof && current_offset >= bytes_in_buffer;
85 }85 }
86
87 StreamReleaser getStreamReleaser()
88 {
89 return theStreamReleaser;
90 }
91
92 void setStreamReleaser(StreamReleaser aReleaser)
93 {
94 theStreamReleaser = aReleaser;
95 }
8696
87 void reset()97 void reset()
88 {98 {
89 if (theBuffer)99 theBuffer.clear();
90 {
91 delete[] theBuffer;
92 }
93100
94 if (theIss)101 if (theIss)
95 {102 {
96 delete theIss;103 delete theIss;
97 }104 }
105
106 if (theStreamReleaser)
107 {
108 theStreamReleaser(theStream);
109 }
98110
99 if (ctxt)111 if (ctxt)
100 {112 {
@@ -104,7 +116,6 @@
104116
105 theIss = NULL;117 theIss = NULL;
106 theStream = NULL;118 theStream = NULL;
107 theBuffer = NULL;
108 bytes_in_buffer = 0;119 bytes_in_buffer = 0;
109 current_offset = 0;120 current_offset = 0;
110 current_element_depth = 0;121 current_element_depth = 0;
@@ -117,7 +128,7 @@
117 children = NULL;128 children = NULL;
118 only_one_doc_node = false;129 only_one_doc_node = false;
119 }130 }
120131
121 virtual ~FragmentIStream()132 virtual ~FragmentIStream()
122 {133 {
123 reset();134 reset();
124135
=== modified file 'src/runtime/parsing_and_serializing/parse_fragment_impl.cpp'
--- src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-08-29 11:12:58 +0000
+++ src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-08-29 15:25:22 +0000
@@ -197,6 +197,8 @@
197 if (result->isStreamable())197 if (result->isStreamable())
198 {198 {
199 state->theFragmentStream.theStream = &result->getStream();199 state->theFragmentStream.theStream = &result->getStream();
200 state->theFragmentStream.setStreamReleaser(result->getStreamReleaser());
201 result->setStreamReleaser(nullptr);
200 }202 }
201 else203 else
202 {204 {
203205
=== modified file 'src/store/naive/loader_dtd.cpp'
--- src/store/naive/loader_dtd.cpp 2012-08-29 11:12:58 +0000
+++ src/store/naive/loader_dtd.cpp 2012-08-29 15:25:22 +0000
@@ -153,13 +153,13 @@
153{153{
154 if (theFragmentStream->ctxt->input->length > 0 && theFragmentStream->current_offset < theFragmentStream->bytes_in_buffer)154 if (theFragmentStream->ctxt->input->length > 0 && theFragmentStream->current_offset < theFragmentStream->bytes_in_buffer)
155 {155 {
156 memmove(theFragmentStream->theBuffer, theFragmentStream->theBuffer + theFragmentStream->current_offset,156 memmove(&theFragmentStream->theBuffer[0], &theFragmentStream->theBuffer[0] + theFragmentStream->current_offset,
157 theFragmentStream->bytes_in_buffer - theFragmentStream->current_offset);157 theFragmentStream->bytes_in_buffer - theFragmentStream->current_offset);
158 }158 }
159 theFragmentStream->bytes_in_buffer -= theFragmentStream->current_offset;159 theFragmentStream->bytes_in_buffer -= theFragmentStream->current_offset;
160160
161 std::streamsize numChars = readPacket(*theFragmentStream->theStream, theFragmentStream->theBuffer + theFragmentStream->bytes_in_buffer,161 std::streamsize numChars = readPacket(*theFragmentStream->theStream, &theFragmentStream->theBuffer[0] + theFragmentStream->bytes_in_buffer,
162 FragmentIStream::BUFFER_SIZE+FragmentIStream::LOOKAHEAD_BYTES - theFragmentStream->bytes_in_buffer);162 theFragmentStream->theBuffer.size() - 1 - theFragmentStream->bytes_in_buffer);
163 if (numChars < 0)163 if (numChars < 0)
164 {164 {
165 theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));165 theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR));
@@ -171,13 +171,12 @@
171171
172 theFragmentStream->bytes_in_buffer += numChars;172 theFragmentStream->bytes_in_buffer += numChars;
173 theFragmentStream->current_offset = 0;173 theFragmentStream->current_offset = 0;
174 theFragmentStream->ctxt->input->base = (xmlChar*)(theFragmentStream->theBuffer);174 theFragmentStream->ctxt->input->base = (xmlChar*)(&theFragmentStream->theBuffer[0]);
175 theFragmentStream->ctxt->input->length = (theFragmentStream->bytes_in_buffer < FragmentIStream::BUFFER_SIZE? theFragmentStream->bytes_in_buffer : FragmentIStream::BUFFER_SIZE);175 theFragmentStream->ctxt->input->length = (theFragmentStream->bytes_in_buffer < (theFragmentStream->theBuffer.size()-1) ? theFragmentStream->bytes_in_buffer : (theFragmentStream->theBuffer.size()-1));
176 theFragmentStream->ctxt->input->cur = theFragmentStream->ctxt->input->base;176 theFragmentStream->ctxt->input->cur = theFragmentStream->ctxt->input->base;
177 theFragmentStream->ctxt->input->end = theFragmentStream->ctxt->input->base + theFragmentStream->ctxt->input->length;177 theFragmentStream->ctxt->input->end = theFragmentStream->ctxt->input->base + theFragmentStream->ctxt->input->length;
178 theFragmentStream->ctxt->checkIndex = 0;178
179179 if (theFragmentStream->bytes_in_buffer < theFragmentStream->theBuffer.size()-1)
180 if (theFragmentStream->bytes_in_buffer < FragmentIStream::BUFFER_SIZE+FragmentIStream::LOOKAHEAD_BYTES)
181 theFragmentStream->theBuffer[theFragmentStream->bytes_in_buffer] = 0;180 theFragmentStream->theBuffer[theFragmentStream->bytes_in_buffer] = 0;
182181
183 return !theFragmentStream->stream_is_consumed();182 return !theFragmentStream->stream_is_consumed();
@@ -212,12 +211,12 @@
212 theFragmentStream = static_cast<FragmentIStream*>(&stream);211 theFragmentStream = static_cast<FragmentIStream*>(&stream);
213212
214 // Prepare the input buffer and the parser context213 // Prepare the input buffer and the parser context
215 if (theFragmentStream->theBuffer == NULL)214 if (theFragmentStream->theBuffer.size() == 0)
216 {215 {
217 // Allocate input buffer216 // Allocate input buffer
218 theFragmentStream->theBuffer = new char[FragmentIStream::BUFFER_SIZE + FragmentIStream::LOOKAHEAD_BYTES+1];217 theFragmentStream->theBuffer.resize(FragmentIStream::DEFAULT_BUFFER_SIZE + 1);
219 theFragmentStream->theBuffer[FragmentIStream::BUFFER_SIZE + FragmentIStream::LOOKAHEAD_BYTES] = 0;218 theFragmentStream->theBuffer[FragmentIStream::DEFAULT_BUFFER_SIZE] = 0;
220219
221 // Create the LibXml parser context220 // Create the LibXml parser context
222 theFragmentStream->ctxt = xmlCreatePushParserCtxt(&theSaxHandler, this, NULL, 0, 0);221 theFragmentStream->ctxt = xmlCreatePushParserCtxt(&theSaxHandler, this, NULL, 0, 0);
223 if (theFragmentStream->ctxt == NULL)222 if (theFragmentStream->ctxt == NULL)
@@ -242,7 +241,7 @@
242241
243 // Initialize the parser input (only filename and the pointer to the current char)242 // Initialize the parser input (only filename and the pointer to the current char)
244 theFragmentStream->theBuffer[0] = ' '; // This assignment is needed for LibXml2-2.7.6, which tries to read the buffer when xmlPushInput() is called243 theFragmentStream->theBuffer[0] = ' '; // This assignment is needed for LibXml2-2.7.6, which tries to read the buffer when xmlPushInput() is called
245 input->cur = (xmlChar*)(theFragmentStream->theBuffer);244 input->cur = (xmlChar*)(&theFragmentStream->theBuffer[0]);
246 input->filename = (const char*)(xmlCanonicPath((const xmlChar*)theDocUri.c_str()));245 input->filename = (const char*)(xmlCanonicPath((const xmlChar*)theDocUri.c_str()));
247 xmlPushInput(theFragmentStream->ctxt, input);246 xmlPushInput(theFragmentStream->ctxt, input);
248 }247 }
@@ -316,7 +315,7 @@
316 }315 }
317 }316 }
318 317
319 /* 318 /*
320 std::cerr << "\n==================\n--> skip_root: " << theFragmentStream->root_elements_to_skip << " current_depth: " << theFragmentStream->current_element_depth 319 std::cerr << "\n==================\n--> skip_root: " << theFragmentStream->root_elements_to_skip << " current_depth: " << theFragmentStream->current_element_depth
321 << " state: " << theFragmentStream->ctxt->instate 320 << " state: " << theFragmentStream->ctxt->instate
322 << " about to parse: [" << theFragmentStream->ctxt->input->cur << "] " << std::endl;321 << " about to parse: [" << theFragmentStream->ctxt->input->cur << "] " << std::endl;
@@ -326,14 +325,21 @@
326 theFragmentStream->ctxt->input->length, 0);325 theFragmentStream->ctxt->input->length, 0);
327326
328 // If we didn't get an error and we haven't moved, we might have some freestanding text. Parse it as element character data.327 // If we didn't get an error and we haven't moved, we might have some freestanding text. Parse it as element character data.
329 if (theXQueryDiagnostics->errors().empty()328 if (theXQueryDiagnostics->errors().empty() && theFragmentStream->current_offset == 0)
330 &&
331 theFragmentStream->current_offset == 0)
332 {329 {
333 if (theFragmentStream->state == FragmentIStream::FRAGMENT_FIRST_START_DOC)330 if (theFragmentStream->state == FragmentIStream::FRAGMENT_FIRST_START_DOC)
334 FragmentXmlLoader::startDocument(theFragmentStream->ctxt->userData);331 FragmentXmlLoader::startDocument(theFragmentStream->ctxt->userData);
335 xmlParseCharData(theFragmentStream->ctxt, 0);332 xmlParseCharData(theFragmentStream->ctxt, 0);
336 theFragmentStream->current_offset = getCurrentInputOffset(); // update current offset333 theFragmentStream->current_offset = getCurrentInputOffset(); // update current offset
334
335 if (theXQueryDiagnostics->errors().empty() && theFragmentStream->current_offset == 0 && theFragmentStream->ctxt->checkIndex > 0)
336 {
337 // we still haven't moved, double the buffer size
338 theFragmentStream->theBuffer.resize((theFragmentStream->theBuffer.size()-1) * 2 + 1);
339 theFragmentStream->ctxt->input->base = (xmlChar*)(&theFragmentStream->theBuffer[0]);
340 theFragmentStream->ctxt->input->cur = theFragmentStream->ctxt->input->base;
341 theFragmentStream->ctxt->input->end = theFragmentStream->ctxt->input->base + theFragmentStream->ctxt->input->length;
342 }
337 }343 }
338344
339 if ( ! theXQueryDiagnostics->errors().empty())345 if ( ! theXQueryDiagnostics->errors().empty())
340346
=== modified file 'src/store/naive/loader_fast.cpp'
--- src/store/naive/loader_fast.cpp 2012-08-29 11:12:58 +0000
+++ src/store/naive/loader_fast.cpp 2012-08-29 15:25:22 +0000
@@ -668,16 +668,6 @@
668 << std::endl << " ordpath = " << elemNode->getOrdPath().show()668 << std::endl << " ordpath = " << elemNode->getOrdPath().show()
669 << std::endl);669 << std::endl);
670 670
671 // Add the base-uri if the parent document node is not being created, which happens when xml fragments are parsed
672 FragmentXmlLoader* fragmentLoader = dynamic_cast<FragmentXmlLoader*>(&loader);
673 if (fragmentLoader != NULL &&
674 fragmentLoader->theLoadProperties.getCreateDocParentLink() == false &&
675 fragmentLoader->getFragmentStream()->current_element_depth == 1)
676 {
677 zstring emptyStr;
678 elemNode->addBaseUriProperty(loader.theBaseUri, emptyStr);
679 }
680
681 // Process namespace bindings671 // Process namespace bindings
682 if (numBindings > 0)672 if (numBindings > 0)
683 {673 {
@@ -767,6 +757,16 @@
767 << attrNode->getOrdPath().show() << std::endl);757 << attrNode->getOrdPath().show() << std::endl);
768 }758 }
769 }759 }
760
761 // Add the base-uri if the parent document node is not being created, which happens when xml fragments are parsed
762 FragmentXmlLoader* fragmentLoader = dynamic_cast<FragmentXmlLoader*>(&loader);
763 if (fragmentLoader != NULL &&
764 fragmentLoader->theLoadProperties.getCreateDocParentLink() == false &&
765 fragmentLoader->getFragmentStream()->current_element_depth == 1)
766 {
767 zstring emptyStr;
768 elemNode->addBaseUriProperty(loader.theBaseUri, emptyStr);
769 }
770770
771 nodeStack.push((XmlNode*)elemNode);771 nodeStack.push((XmlNode*)elemNode);
772 nodeStack.push(NULL);772 nodeStack.push(NULL);
773773
=== added file 'test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-31.xml.res'
--- test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-31.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-31.xml.res 2012-08-29 15:25:22 +0000
@@ -0,0 +1,3 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ret><page/></ret><ret>
3</ret>
0\ No newline at end of file4\ No newline at end of file
15
=== added file 'test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-32.xml.res'
--- test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-32.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-32.xml.res 2012-08-29 15:25:22 +0000
@@ -0,0 +1,2 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<template head="test"/>
0\ No newline at end of file3\ No newline at end of file
14
=== added file 'test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-33.xml.res'
--- test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-33.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/parsing_and_serializing/parse-xml-fragment-33.xml.res 2012-08-29 15:25:22 +0000
@@ -0,0 +1,2 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<title xmlns:xml_split="http://xmltwig.com/xml_split">Accounting</title>
0\ No newline at end of file3\ No newline at end of file
14
=== added file 'test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-31.xq'
--- test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-31.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-31.xq 2012-08-29 15:25:22 +0000
@@ -0,0 +1,16 @@
1(:
2 Test parse-xml:parse() with streamable input
3:)
4
5import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
6import module namespace parse-xml = "http://www.zorba-xquery.com/modules/xml";
7import schema namespace opt = "http://www.zorba-xquery.com/modules/xml-options";
8
9let $xmlcontents := fetch:content(fn:resolve-uri("streamable.xml"))
10let $contents := parse-xml:parse(
11 $xmlcontents,
12 <opt:options>
13 <opt:parse-external-parsed-entity opt:skip-root-nodes="0" />
14 </opt:options>)
15for $article at $pos in $contents
16return <ret>{ $article }</ret>
017
=== added file 'test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-32.xq'
--- test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-32.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-32.xq 2012-08-29 15:25:22 +0000
@@ -0,0 +1,12 @@
1(:
2 Test parse-xml:parse() with a single top element which has an attribute
3:)
4
5import module namespace parse-xml = "http://www.zorba-xquery.com/modules/xml";
6import schema namespace opt = "http://www.zorba-xquery.com/modules/xml-options";
7
8parse-xml:parse(
9 "<template head='test'></template>",
10 <opt:options>
11 <opt:parse-external-parsed-entity opt:skip-root-nodes="0"/>
12 </opt:options>)
013
=== added file 'test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-33.xq'
--- test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-33.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/parsing_and_serializing/parse-xml-fragment-33.xq 2012-08-29 15:25:22 +0000
@@ -0,0 +1,16 @@
1import module namespace parse-xml = "http://www.zorba-xquery.com/modules/xml";
2import schema namespace opt = "http://www.zorba-xquery.com/modules/xml-options";
3import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
4
5variable $xmlcontents := fetch:content(resolve-uri("wiki.xml"));
6
7let $contents := parse-xml:parse(
8 $xmlcontents,
9 <opt:options>
10 <opt:parse-external-parsed-entity opt:skip-root-nodes="1" />
11 </opt:options>)
12
13for $article at $pos in $contents
14let $title := $article//title
15return
16 $title
017
=== added file 'test/rbkt/Queries/zorba/parsing_and_serializing/streamable.xml'
--- test/rbkt/Queries/zorba/parsing_and_serializing/streamable.xml 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/parsing_and_serializing/streamable.xml 2012-08-29 15:25:22 +0000
@@ -0,0 +1,1 @@
1<page />
02
=== added file 'test/rbkt/Queries/zorba/parsing_and_serializing/wiki.xml'
--- test/rbkt/Queries/zorba/parsing_and_serializing/wiki.xml 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/parsing_and_serializing/wiki.xml 2012-08-29 15:25:22 +0000
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2<xml_split:root xmlns:xml_split="http://xmltwig.com/xml_split">
3 <page>
4 <title>Accounting</title>
5 <revision>
6 <text xml:space="preserve"><redirect><link label="Accountancy">Accountancy</link><template head="R from related word}
7Aѕ lоng аѕ thеrе wіll реорlе іn thіѕ wоrld, thеrе wіll bе buѕіnеѕѕ, аnd аѕ lоng аѕ thеrе іѕ buѕіnеѕѕ, thеrе wіll bе ассоuntіng. Aссоuntіng іѕ іnvоlvеd іn vіrtuаllу еvеrуthіng іn оur lіvеѕ whеthеr wе knоw іt оr nоt, аnd іtѕ іmроrtаnсе саn ѕоmеtіmеѕ bе оvеrlооkеd. Evеrуthіng nееdѕ ассоuntіng. Frоm а bаѕеbаll сар уоu wеаr, tо thе fооd уоu еаt, tо thе соmраnу уоu wоrk fоr, оr еvеn thе muѕіс уоu hеаr оn thе rаdіо, ассоuntіng іѕ nееdеd аnd wаѕ іnvоlvеd іn аll оf thоѕе thіngѕ ѕtерѕ оf рrоduсtіоn оr ореrаtіоn.
8
9An ассоuntаnt mеаѕurеѕ, аggrеgаtеѕ аnd rероrtѕ fіnаnсіаl іnfоrmаtіоn nесеѕѕаrу fоr thе ѕаkе оf dесіѕіоn mаkіng bу оrgаnіzаtіоnаl mаnаgеrѕ, оwnеrѕ, іnvеѕtоrѕ, gоvеrnmеnt аgеnсіеѕ аnd оthеr uѕеrѕ. Frоm thе рrеvіоuѕ ѕtаtеmеnt, wе саn ѕее thе іndісаtіоn thаt ѕhоwѕ hоw ассоuntіng іѕ іmроrtаnt іn саrееrѕ. Evеrуthіng nееdѕ ассоuntіng. Whеthеr уоu аrе а dосtоr, оr аn оrdіnаrу оffісе wоrkеr, уоu wоuld ѕtіll nееd tо рlау wіth numbеrѕ аnd tаkе іntо ассоunt thе соѕt оf thіngѕ thаt уоu uѕеd оr uѕеd bу ѕоmеоnе еlѕе. Tіmеlу аnd ассurаtе іnfоrmаtіоn оn ореrаtіоnѕ іѕ сruсіаl tо ѕuссеѕѕ іn thе rесеnt dауѕ оf rаріdlу сhаngіng buѕіnеѕѕ еnvіrоnmеnt, аnd thе ассоuntаnt іѕ thе оnе rеѕроnѕіblе fоr thе сrіtісаl buѕіnеѕѕ funсtіоn thаt mоѕtlу thоugh іndіrесtlу аffесtѕ оur саrееr аnd еvеrуdау lіfе.
10
11In thе саrееr реrѕресtіvе еvеrу оссuраtіоn muѕt саrеfullу mаnаgе thеіr mоnеу, thеіr саѕh іnflоwѕ аnd оutflоwѕ. Jоbѕ ѕuсh аѕ іndереndеnt соntrасtоrѕ hаvе tо аnаlуzе hоw muсh thе јоb іѕ gоіng tо соѕt thеm аnd hоw muсh thеу аrе gоіng tо сhаrgе fоr thе јоb. Thеу muѕt trасk аll thеіr еxреnѕеѕ аnd еѕtіmаtеѕ іn оrdеr tо nоt undеr соѕt аnd tо сhаrgе аррrорrіаtе рrісеѕ. In ѕіmрlеѕt fоrm, thіѕ іѕ ассоuntіng. If nоt ассurаtеlу trасkеd аnd еѕtіmаtеd, thаt соntrасtоr'ѕ buѕіnеѕѕ wіll nоt рrоfіt аnd еvеntuаllу gо оut оf buѕіnеѕѕ. Sаmе thіng gоеѕ fоr bіg buѕіnеѕѕ, іf thаt соmраnу оr fіrmѕ dоеѕ nоt ассurаtеlу hаndlе thе ореrаtіоnѕ оf іtѕ саѕh flоwѕ, іt wіll nоt ѕuѕtаіn fоr lоng. Mоrе аnd mоrе tоdау еmрlоуееѕ ѕuсh аѕ ѕесrеtаrіеѕ аnd rесерtіоnіѕtѕ аrе bеіng tаught bаѕіс ассоuntіng рrасtісеѕ tо hеlр аіd thе ассоuntаntѕ аnd tо kеер рrореr bооkkееріng. Thіѕ wау thеѕе еmрlоуееѕ саn mаnаgе thе lоwеr іmроrtаnсе іtеmѕ оf а buѕіnеѕѕ аnd lеаvе trаnѕасtіоnѕ оf hіghеr ѕіgnіfісаnсе tо thе ассоuntаnt tо аnаlуzе аnd іntеrрrеt fоr dесіѕіоn mаkіng рurроѕеѕ.
12[http://whatacountingis.com What Accounting Is All About]
13
14Hаndlіng аll thе саlсulаtіоnѕ оf ассоuntіng саn bе tеdіоuѕ аnd bоthеrѕоmе but саn mаkе аll thе dіffеrеnсе оnе'ѕ fіnаnсеѕ. Yоu саn ѕtrаtеgісаllу рlаn аhеаd tо ѕаvе fоr уоur rеtіrеmеnt, уоur сhіldrеn'ѕ соllеgе fund, оr luxurу оr twо lаtеr dоwn thе rоаd. Wе саn ѕее thе іmроrtаnсе оf thіѕ соnсерt bу nоtісіng соmраnіеѕ tоdау whоѕе ореrаtіоnѕ аrе ѕtrісtlу fіnаnсіаl аdvіѕіng. It саn bе соnсludеd thаt іn thе еrа thаt wе аrе lіvіng іn tоdау, Fаmіlіеѕ, аnd rеtіrееѕ dереnd оn thе сrеdіbіlіtу оf fіnаnсіаl rероrtіng fоr thеіr futurеѕ аnd lіvеlіhооdѕ. Wіth fіnаnсіаl рrеѕѕurе аmоuntіng іn mаnу реорlеѕ' lіvеѕ, ассоuntіng іѕ ѕееn аѕ іmроrtаnt іn ѕо mаnу wауѕ thаt іt іѕ аlmоѕt іmроѕѕіblе tо lіvе wіthоut іt.
15[http://whatacountingis.com What Accounting Is All About]"></template></redirect></text>
16 </revision>
17 </page>
18</xml_split:root>

Subscribers

People subscribed via source and target branches