Problem with BaseX inserting a namespace … how do I stop it
Monday, 2 April 2012 · 17 messages · last reply 5 Apr 2012
MH
Mike Hawkes2 Apr 2012 14:44 #
Hi
I have a weird problem ... I'm running a query via the PHP interface and run the following query:
declare variable $DB external;insert node
<audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B'
UID='i1'
guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0'
sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active'
date='2012-04-02T12:21:05+00:00'/>
into doc($DB)/root/auditlog
--
BaseX log shows that it gets the query as-is.
When I look at the data within the database by running the XQuery
/root/auditlog
I find that BaseX has inserted a namespace attribute as follows:
<audit xmlns="http://www.w3.org/1999/xhtml"
QID="C54B14ED-C748-4DF0-87F2-91F505BE207B"
UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/>
How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP.
The PHP script is as follows:
$audit = "declare variable \$DB external; " .
"insert node <audit QID='$queryID' UID='$userID' " .
"guid='$guid' sessionID='" . session_id() . "' " .
"mode='active' " .
"date='$dateTime'/> into doc(\$DB)/root/auditlog";
$query = $session->query( $audit );
$query->bind( 'DB', $DB);
$query->bind( 'SYSDATA', $SYSDATA );
$query->execute();
$query->close();
Thanks in advance for any suggestions.
Mike
CG
Christian Grün2 Apr 2012 15:11 #
Hi Mike,
thanks for your report. It would be great if you could provide us with a small example that allows us to reproduce the issue (an export of your original database with the namespace (which is being added to the new node) may suffice).
Best,
Christian
Quoted text · Mike Hawkes · 53 lines
On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: > Hi > > I have a weird problem ... I'm running a query via the PHP interface and run the following query: > > declare variable $DB external; > > insert node > <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' > UID='i1' > guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' > sessionID='48090b7f0e3a62a42a0457a3e88301ca' > mode='active' > date='2012-04-02T12:21:05+00:00'/> > into doc($DB)/root/auditlog > > -- > BaseX log shows that it gets the query as-is. > > When I look at the data within the database by running the XQuery > > /root/auditlog > > I find that BaseX has inserted a namespace attribute as follows: > > <audit xmlns="http://www.w3.org/1999/xhtml" > QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" > UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> > > How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. > > The PHP script is as follows: > > $audit = "declare variable \$DB external; " . > "insert node <audit QID='$queryID' UID='$userID' " . > "guid='$guid' sessionID='" . session_id() . "' " . > "mode='active' " . > "date='$dateTime'/> into doc(\$DB)/root/auditlog"; > > $query = $session->query( $audit ); > $query->bind( 'DB', $DB); > $query->bind( 'SYSDATA', $SYSDATA ); > $query->execute(); > $query->close(); > > > Thanks in advance for any suggestions. > > Mike > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
MH
Mike Hawkes2 Apr 2012 15:24 #
Thanks for the reply
... it's really weird. If I close the database and shut down the server, then restart/reopen, the problem starts. Do the following ...
drop database test
create database test /initialdb.xml
and then run the PHP, it all works as expected.
Close the database, shut down the server, then run the PHP and BaseX inserts the namespace. In both cases BaseX audit log shows:
14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms
14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms
14:00:00.711 [127.0.0.1:49788] BIND(4) SYSDATA OK 0.04 ms
14:00:00.713 [127.0.0.1:49788] EXEC(4) OK 1.93 ms
14:00:00.713 [127.0.0.1:49788] CLOSE(4) OK 0.03 ms
So it also doesn't show a namespace.
The code is literally as below.
Cheers
Mike
Quoted text · Christian Grün · 65 lines
On 2 Apr 2012, at 14:11, Christian Grün wrote: > Hi Mike, > > thanks for your report. It would be great if you could provide us with > a small example that allows us to reproduce the issue (an export of > your original database with the namespace (which is being added to the > new node) may suffice). > > Best, > Christian > ____________________________ > > On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> Hi >> >> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >> >> declare variable $DB external; >> >> insert node >> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >> UID='i1' >> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >> mode='active' >> date='2012-04-02T12:21:05+00:00'/> >> into doc($DB)/root/auditlog >> >> -- >> BaseX log shows that it gets the query as-is. >> >> When I look at the data within the database by running the XQuery >> >> /root/auditlog >> >> I find that BaseX has inserted a namespace attribute as follows: >> >> <audit xmlns="http://www.w3.org/1999/xhtml" >> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >> >> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >> >> The PHP script is as follows: >> >> $audit = "declare variable \$DB external; " . >> "insert node <audit QID='$queryID' UID='$userID' " . >> "guid='$guid' sessionID='" . session_id() . "' " . >> "mode='active' " . >> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >> >> $query = $session->query( $audit ); >> $query->bind( 'DB', $DB); >> $query->bind( 'SYSDATA', $SYSDATA ); >> $query->execute(); >> $query->close(); >> >> >> Thanks in advance for any suggestions. >> >> Mike >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CG
Christian Grün2 Apr 2012 15:30 #
Sorry, I still got some questions..
Quoted text · Mike Hawkes · 2 lines
> drop database test > create database test /initialdb.xml
The database you're creating seems to be called "test"; what's "initialdb.xml"?
Quoted text · Mike Hawkes · 3 lines
> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms > 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms > 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms
The log info implies you're having "root" and "auditlog" nodes, and the addressed database is called "WYP", is that right? Could you pass us on the missing snippets?
Christian
Quoted text · Christian Grün · 67 lines
> On 2 Apr 2012, at 14:11, Christian Grün wrote: > >> Hi Mike, >> >> thanks for your report. It would be great if you could provide us with >> a small example that allows us to reproduce the issue (an export of >> your original database with the namespace (which is being added to the >> new node) may suffice). >> >> Best, >> Christian >> ____________________________ >> >> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>> Hi >>> >>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >>> >>> declare variable $DB external; >>> >>> insert node >>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >>> UID='i1' >>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >>> mode='active' >>> date='2012-04-02T12:21:05+00:00'/> >>> into doc($DB)/root/auditlog >>> >>> -- >>> BaseX log shows that it gets the query as-is. >>> >>> When I look at the data within the database by running the XQuery >>> >>> /root/auditlog >>> >>> I find that BaseX has inserted a namespace attribute as follows: >>> >>> <audit xmlns="http://www.w3.org/1999/xhtml" >>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >>> >>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >>> >>> The PHP script is as follows: >>> >>> $audit = "declare variable \$DB external; " . >>> "insert node <audit QID='$queryID' UID='$userID' " . >>> "guid='$guid' sessionID='" . session_id() . "' " . >>> "mode='active' " . >>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >>> >>> $query = $session->query( $audit ); >>> $query->bind( 'DB', $DB); >>> $query->bind( 'SYSDATA', $SYSDATA ); >>> $query->execute(); >>> $query->close(); >>> >>> >>> Thanks in advance for any suggestions. >>> >>> Mike >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
MH
Mike Hawkes2 Apr 2012 15:40 #
The database contains
<root>
<auditlog>... elements should end up in here ...
</auditlog>
</root>The initial XML file contains the initial nodes with which to populate the XML database (root plus numerous other nodes). The PHP code inserts additional nodes as it runs. For every node I add, I create an audit entry to allow me to determine who and how the database built over time.
initialdb.xml contains, therefore:
<root>
<auditlog/>
</root>You're right - ignore 'test' - I meant WYP in the database - as in
drop database WYP
create database WYP test/initialdb.xml
Apologies for any confusion caused.
It's really weird - I can't get this to fail consistently - but when it starts inserting the namespace attribute, it then continues to do so.
Cheers
Mike
Quoted text · Christian Grün · 87 lines
On 2 Apr 2012, at 14:30, Christian Grün wrote: > Sorry, I still got some questions.. > >> drop database test >> create database test /initialdb.xml > > The database you're creating seems to be called "test"; what's "initialdb.xml"? > >> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms >> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms >> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms > > The log info implies you're having "root" and "auditlog" nodes, and > the addressed database is called "WYP", is that right? Could you pass > us on the missing snippets? > > Christian > > > >> On 2 Apr 2012, at 14:11, Christian Grün wrote: >> >>> Hi Mike, >>> >>> thanks for your report. It would be great if you could provide us with >>> a small example that allows us to reproduce the issue (an export of >>> your original database with the namespace (which is being added to the >>> new node) may suffice). >>> >>> Best, >>> Christian >>> ____________________________ >>> >>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>>> Hi >>>> >>>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >>>> >>>> declare variable $DB external; >>>> >>>> insert node >>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >>>> UID='i1' >>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >>>> mode='active' >>>> date='2012-04-02T12:21:05+00:00'/> >>>> into doc($DB)/root/auditlog >>>> >>>> -- >>>> BaseX log shows that it gets the query as-is. >>>> >>>> When I look at the data within the database by running the XQuery >>>> >>>> /root/auditlog >>>> >>>> I find that BaseX has inserted a namespace attribute as follows: >>>> >>>> <audit xmlns="http://www.w3.org/1999/xhtml" >>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >>>> >>>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >>>> >>>> The PHP script is as follows: >>>> >>>> $audit = "declare variable \$DB external; " . >>>> "insert node <audit QID='$queryID' UID='$userID' " . >>>> "guid='$guid' sessionID='" . session_id() . "' " . >>>> "mode='active' " . >>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >>>> >>>> $query = $session->query( $audit ); >>>> $query->bind( 'DB', $DB); >>>> $query->bind( 'SYSDATA', $SYSDATA ); >>>> $query->execute(); >>>> $query->close(); >>>> >>>> >>>> Thanks in advance for any suggestions. >>>> >>>> Mike >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>
CG
Christian Grün2 Apr 2012 15:52 #
So it seems that the once added namespace is propagated to other documents? I believe there must be at least one document with the mentioned namespace in your database; otherwise I can't explain where it should come from (afaik, the string "http://www.w3.org/1999/xhtml" isn't hard-coded anywhere in the project)...
Christian
Quoted text · Mike Hawkes · 120 lines
On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: > The database contains > > <root> > <auditlog> > > ... elements should end up in here ... > > </auditlog> > </root> > > > The initial XML file contains the initial nodes with which to populate the XML database (root plus numerous other nodes). The PHP code inserts additional nodes as it runs. For every node I add, I create an audit entry to allow me to determine who and how the database built over time. > > initialdb.xml contains, therefore: > <root> > <auditlog/> > </root> > > You're right - ignore 'test' - I meant WYP in the database - as in > > drop database WYP > create database WYP test/initialdb.xml > > Apologies for any confusion caused. > > It's really weird - I can't get this to fail consistently - but when it starts inserting the namespace attribute, it then continues to do so. > > Cheers > Mike > > On 2 Apr 2012, at 14:30, Christian Grün wrote: > >> Sorry, I still got some questions.. >> >>> drop database test >>> create database test /initialdb.xml >> >> The database you're creating seems to be called "test"; what's "initialdb.xml"? >> >>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms >>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms >>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms >> >> The log info implies you're having "root" and "auditlog" nodes, and >> the addressed database is called "WYP", is that right? Could you pass >> us on the missing snippets? >> >> Christian >> >> >> >>> On 2 Apr 2012, at 14:11, Christian Grün wrote: >>> >>>> Hi Mike, >>>> >>>> thanks for your report. It would be great if you could provide us with >>>> a small example that allows us to reproduce the issue (an export of >>>> your original database with the namespace (which is being added to the >>>> new node) may suffice). >>>> >>>> Best, >>>> Christian >>>> ____________________________ >>>> >>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>>>> Hi >>>>> >>>>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >>>>> >>>>> declare variable $DB external; >>>>> >>>>> insert node >>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >>>>> UID='i1' >>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >>>>> mode='active' >>>>> date='2012-04-02T12:21:05+00:00'/> >>>>> into doc($DB)/root/auditlog >>>>> >>>>> -- >>>>> BaseX log shows that it gets the query as-is. >>>>> >>>>> When I look at the data within the database by running the XQuery >>>>> >>>>> /root/auditlog >>>>> >>>>> I find that BaseX has inserted a namespace attribute as follows: >>>>> >>>>> <audit xmlns="http://www.w3.org/1999/xhtml" >>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >>>>> >>>>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >>>>> >>>>> The PHP script is as follows: >>>>> >>>>> $audit = "declare variable \$DB external; " . >>>>> "insert node <audit QID='$queryID' UID='$userID' " . >>>>> "guid='$guid' sessionID='" . session_id() . "' " . >>>>> "mode='active' " . >>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >>>>> >>>>> $query = $session->query( $audit ); >>>>> $query->bind( 'DB', $DB); >>>>> $query->bind( 'SYSDATA', $SYSDATA ); >>>>> $query->execute(); >>>>> $query->close(); >>>>> >>>>> >>>>> Thanks in advance for any suggestions. >>>>> >>>>> Mike >>>>> _______________________________________________ >>>>> BaseX-Talk mailing list >>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >
MH
Mike Hawkes2 Apr 2012 15:58 #
It's mad - I don't add a namespace, the source document is a text file without a namespace - and the log shows that I don't add it ... but it appears. No idea why.
MIke
Quoted text · Christian Grün · 130 lines
On 2 Apr 2012, at 14:52, Christian Grün wrote: > So it seems that the once added namespace is propagated to other > documents? I believe there must be at least one document with the > mentioned namespace in your database; otherwise I can't explain where > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" > isn't hard-coded anywhere in the project)... > > Christian > ___________________________________ > > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> The database contains >> >> <root> >> <auditlog> >> >> ... elements should end up in here ... >> >> </auditlog> >> </root> >> >> >> The initial XML file contains the initial nodes with which to populate the XML database (root plus numerous other nodes). The PHP code inserts additional nodes as it runs. For every node I add, I create an audit entry to allow me to determine who and how the database built over time. >> >> initialdb.xml contains, therefore: >> <root> >> <auditlog/> >> </root> >> >> You're right - ignore 'test' - I meant WYP in the database - as in >> >> drop database WYP >> create database WYP test/initialdb.xml >> >> Apologies for any confusion caused. >> >> It's really weird - I can't get this to fail consistently - but when it starts inserting the namespace attribute, it then continues to do so. >> >> Cheers >> Mike >> >> On 2 Apr 2012, at 14:30, Christian Grün wrote: >> >>> Sorry, I still got some questions.. >>> >>>> drop database test >>>> create database test /initialdb.xml >>> >>> The database you're creating seems to be called "test"; what's "initialdb.xml"? >>> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms >>> >>> The log info implies you're having "root" and "auditlog" nodes, and >>> the addressed database is called "WYP", is that right? Could you pass >>> us on the missing snippets? >>> >>> Christian >>> >>> >>> >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: >>>> >>>>> Hi Mike, >>>>> >>>>> thanks for your report. It would be great if you could provide us with >>>>> a small example that allows us to reproduce the issue (an export of >>>>> your original database with the namespace (which is being added to the >>>>> new node) may suffice). >>>>> >>>>> Best, >>>>> Christian >>>>> ____________________________ >>>>> >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>>>>> Hi >>>>>> >>>>>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >>>>>> >>>>>> declare variable $DB external; >>>>>> >>>>>> insert node >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >>>>>> UID='i1' >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >>>>>> mode='active' >>>>>> date='2012-04-02T12:21:05+00:00'/> >>>>>> into doc($DB)/root/auditlog >>>>>> >>>>>> -- >>>>>> BaseX log shows that it gets the query as-is. >>>>>> >>>>>> When I look at the data within the database by running the XQuery >>>>>> >>>>>> /root/auditlog >>>>>> >>>>>> I find that BaseX has inserted a namespace attribute as follows: >>>>>> >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >>>>>> >>>>>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >>>>>> >>>>>> The PHP script is as follows: >>>>>> >>>>>> $audit = "declare variable \$DB external; " . >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . >>>>>> "mode='active' " . >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >>>>>> >>>>>> $query = $session->query( $audit ); >>>>>> $query->bind( 'DB', $DB); >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); >>>>>> $query->execute(); >>>>>> $query->close(); >>>>>> >>>>>> >>>>>> Thanks in advance for any suggestions. >>>>>> >>>>>> Mike >>>>>> _______________________________________________ >>>>>> BaseX-Talk mailing list >>>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>
LK
Lukas Kircher2 Apr 2012 16:02 #
Hi Mike,
Leo just came up with another idea: Which kind of parser are you using in BaseX?
If you use the HTML parser for parsing XML, the strange behaviour you came across might indeed be expected ... If you're not sure which parser you are using, just take a look at our documentation [1].
Regards,
Lukas
[1] http://docs.basex.org/wiki/Parser#XML_Parsers
Quoted text · Mike Hawkes · 167 lines
On Mon, Apr 2, 2012 at 3:58 PM, Mike Hawkes <mikehawkes at me.com> wrote: > It's mad - I don't add a namespace, the source document is a text file > without a namespace - and the log shows that I don't add it ... but it > appears. No idea why. > > MIke > > On 2 Apr 2012, at 14:52, Christian Grün wrote: > > > So it seems that the once added namespace is propagated to other > > documents? I believe there must be at least one document with the > > mentioned namespace in your database; otherwise I can't explain where > > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" > > isn't hard-coded anywhere in the project)... > > > > Christian > > ___________________________________ > > > > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: > >> The database contains > >> > >> <root> > >> <auditlog> > >> > >> ... elements should end up in here ... > >> > >> </auditlog> > >> </root> > >> > >> > >> The initial XML file contains the initial nodes with which to populate > the XML database (root plus numerous other nodes). The PHP code inserts > additional nodes as it runs. For every node I add, I create an audit entry > to allow me to determine who and how the database built over time. > >> > >> initialdb.xml contains, therefore: > >> <root> > >> <auditlog/> > >> </root> > >> > >> You're right - ignore 'test' - I meant WYP in the database - as in > >> > >> drop database WYP > >> create database WYP test/initialdb.xml > >> > >> Apologies for any confusion caused. > >> > >> It's really weird - I can't get this to fail consistently - but when it > starts inserting the namespace attribute, it then continues to do so. > >> > >> Cheers > >> Mike > >> > >> On 2 Apr 2012, at 14:30, Christian Grün wrote: > >> > >>> Sorry, I still got some questions.. > >>> > >>>> drop database test > >>>> create database test /initialdb.xml > >>> > >>> The database you're creating seems to be called "test"; what's > "initialdb.xml"? > >>> > >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare > variable $DB external; insert node <audit > QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' > guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' > sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' > date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK > 0.09 ms > >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 > ms > >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP > OK 0.05 ms > >>> > >>> The log info implies you're having "root" and "auditlog" nodes, and > >>> the addressed database is called "WYP", is that right? Could you pass > >>> us on the missing snippets? > >>> > >>> Christian > >>> > >>> > >>> > >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: > >>>> > >>>>> Hi Mike, > >>>>> > >>>>> thanks for your report. It would be great if you could provide us > with > >>>>> a small example that allows us to reproduce the issue (an export of > >>>>> your original database with the namespace (which is being added to > the > >>>>> new node) may suffice). > >>>>> > >>>>> Best, > >>>>> Christian > >>>>> ____________________________ > >>>>> > >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> > wrote: > >>>>>> Hi > >>>>>> > >>>>>> I have a weird problem ... I'm running a query via the PHP > interface and run the following query: > >>>>>> > >>>>>> declare variable $DB external; > >>>>>> > >>>>>> insert node > >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' > >>>>>> UID='i1' > >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' > >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' > >>>>>> mode='active' > >>>>>> date='2012-04-02T12:21:05+00:00'/> > >>>>>> into doc($DB)/root/auditlog > >>>>>> > >>>>>> -- > >>>>>> BaseX log shows that it gets the query as-is. > >>>>>> > >>>>>> When I look at the data within the database by running the XQuery > >>>>>> > >>>>>> /root/auditlog > >>>>>> > >>>>>> I find that BaseX has inserted a namespace attribute as follows: > >>>>>> > >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" > >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" > >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" > sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" > date="2012-04-02T12:21:05+00:00"/> > >>>>>> > >>>>>> How do I stop this occurring? It only does it on the audit > components, not on anything else inserted by the PHP script. So, if I run > two insert node queries, the first will run normally, the audit update > causes the xmlns attribute to appear, effectively putting it in a different > namespace to the other data inserted by the PHP. > >>>>>> > >>>>>> The PHP script is as follows: > >>>>>> > >>>>>> $audit = "declare variable \$DB external; " . > >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . > >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . > >>>>>> "mode='active' " . > >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; > >>>>>> > >>>>>> $query = $session->query( $audit ); > >>>>>> $query->bind( 'DB', $DB); > >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); > >>>>>> $query->execute(); > >>>>>> $query->close(); > >>>>>> > >>>>>> > >>>>>> Thanks in advance for any suggestions. > >>>>>> > >>>>>> Mike > >>>>>> _______________________________________________ > >>>>>> BaseX-Talk mailing list > >>>>>> BaseX-Talk at mailman.uni-konstanz.de > >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >>>> > >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
MH
Mike Hawkes2 Apr 2012 16:23 #
Hi Lukas/Christian
It's the built-in one as far as I'm aware - I haven't done anything special to add or remove any parsers. But that's sent me down a path where I can get it reliably.
It appears that it's coming from another query that I run to check the state of a web-site. As soon as I run the following query, BaseX inserts the namespace for every inserted node thereafter:
insert node
<webpage url="http://internet.org.uk" name="primaryDomain">{
http:send-request(
<http:request
method='get'
status-only='false'/>,
"http://internet.org.uk" )}
</webpage>
into doc($DB)/root/webpagesAs soon as I have any node after the above query has run, BaseX inserts the namespace. Otherwise it doesn't. If I delete all the nodes within the <webpage> tags, things return to normal again.
Is there an easy way to do the above without adding any namesakes (I don't actually want to include them from the web query either)? This should solve the problem.
Cheers
Mike
Quoted text · Lukas Kircher · 159 lines
On 2 Apr 2012, at 15:02, Lukas Kircher wrote: > Hi Mike, > > Leo just came up with another idea: Which kind of parser are > you using in BaseX? > > If you use the HTML parser for parsing XML, the strange behaviour > you came across might indeed be expected ... If you're not sure > which parser you are using, just take a look at our documentation [1]. > > Regards, > Lukas > > [1] http://docs.basex.org/wiki/Parser#XML_Parsers > > > > On Mon, Apr 2, 2012 at 3:58 PM, Mike Hawkes <mikehawkes at me.com> wrote: > It's mad - I don't add a namespace, the source document is a text file without a namespace - and the log shows that I don't add it ... but it appears. No idea why. > > MIke > > On 2 Apr 2012, at 14:52, Christian Grün wrote: > > > So it seems that the once added namespace is propagated to other > > documents? I believe there must be at least one document with the > > mentioned namespace in your database; otherwise I can't explain where > > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" > > isn't hard-coded anywhere in the project)... > > > > Christian > > ___________________________________ > > > > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: > >> The database contains > >> > >> <root> > >> <auditlog> > >> > >> ... elements should end up in here ... > >> > >> </auditlog> > >> </root> > >> > >> > >> The initial XML file contains the initial nodes with which to populate the XML database (root plus numerous other nodes). The PHP code inserts additional nodes as it runs. For every node I add, I create an audit entry to allow me to determine who and how the database built over time. > >> > >> initialdb.xml contains, therefore: > >> <root> > >> <auditlog/> > >> </root> > >> > >> You're right - ignore 'test' - I meant WYP in the database - as in > >> > >> drop database WYP > >> create database WYP test/initialdb.xml > >> > >> Apologies for any confusion caused. > >> > >> It's really weird - I can't get this to fail consistently - but when it starts inserting the namespace attribute, it then continues to do so. > >> > >> Cheers > >> Mike > >> > >> On 2 Apr 2012, at 14:30, Christian Grün wrote: > >> > >>> Sorry, I still got some questions.. > >>> > >>>> drop database test > >>>> create database test /initialdb.xml > >>> > >>> The database you're creating seems to be called "test"; what's "initialdb.xml"? > >>> > >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms > >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms > >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms > >>> > >>> The log info implies you're having "root" and "auditlog" nodes, and > >>> the addressed database is called "WYP", is that right? Could you pass > >>> us on the missing snippets? > >>> > >>> Christian > >>> > >>> > >>> > >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: > >>>> > >>>>> Hi Mike, > >>>>> > >>>>> thanks for your report. It would be great if you could provide us with > >>>>> a small example that allows us to reproduce the issue (an export of > >>>>> your original database with the namespace (which is being added to the > >>>>> new node) may suffice). > >>>>> > >>>>> Best, > >>>>> Christian > >>>>> ____________________________ > >>>>> > >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: > >>>>>> Hi > >>>>>> > >>>>>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: > >>>>>> > >>>>>> declare variable $DB external; > >>>>>> > >>>>>> insert node > >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' > >>>>>> UID='i1' > >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' > >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' > >>>>>> mode='active' > >>>>>> date='2012-04-02T12:21:05+00:00'/> > >>>>>> into doc($DB)/root/auditlog > >>>>>> > >>>>>> -- > >>>>>> BaseX log shows that it gets the query as-is. > >>>>>> > >>>>>> When I look at the data within the database by running the XQuery > >>>>>> > >>>>>> /root/auditlog > >>>>>> > >>>>>> I find that BaseX has inserted a namespace attribute as follows: > >>>>>> > >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" > >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" > >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> > >>>>>> > >>>>>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. > >>>>>> > >>>>>> The PHP script is as follows: > >>>>>> > >>>>>> $audit = "declare variable \$DB external; " . > >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . > >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . > >>>>>> "mode='active' " . > >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; > >>>>>> > >>>>>> $query = $session->query( $audit ); > >>>>>> $query->bind( 'DB', $DB); > >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); > >>>>>> $query->execute(); > >>>>>> $query->close(); > >>>>>> > >>>>>> > >>>>>> Thanks in advance for any suggestions. > >>>>>> > >>>>>> Mike > >>>>>> _______________________________________________ > >>>>>> BaseX-Talk mailing list > >>>>>> BaseX-Talk at mailman.uni-konstanz.de > >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >>>> > >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
MH
Mike Hawkes2 Apr 2012 17:10 #
Yep - this definitely causes problems. Insert a node that includes a namespace and all subsequent nodes end up with a namespace inserted. So ... I think this presents a bug:
<root>
<nodes without namespace/>
<new nodes work well/>
</root>vs.
<root>
<nodes without namespace/>
<node with namespace/>
<new nodes automatically get spurious namespace/>
</root>Hope that helps - not sure how best to fix or work around this at the moment though.
Cheers
Mike
Quoted text · Mike Hawkes · 189 lines
On 2 Apr 2012, at 15:23, Mike Hawkes wrote: > Hi Lukas/Christian > > It's the built-in one as far as I'm aware - I haven't done anything special to add or remove any parsers. But that's sent me down a path where I can get it reliably. > > It appears that it's coming from another query that I run to check the state of a web-site. As soon as I run the following query, BaseX inserts the namespace for every inserted node thereafter: > > insert node > <webpage url="http://internet.org.uk" name="primaryDomain">{ > http:send-request( > <http:request > method='get' > status-only='false'/>, > "http://internet.org.uk" )} > </webpage> > into doc($DB)/root/webpages > > As soon as I have any node after the above query has run, BaseX inserts the namespace. Otherwise it doesn't. If I delete all the nodes within the <webpage> tags, things return to normal again. > > Is there an easy way to do the above without adding any namesakes (I don't actually want to include them from the web query either)? This should solve the problem. > > Cheers > Mike > > On 2 Apr 2012, at 15:02, Lukas Kircher wrote: > >> Hi Mike, >> >> Leo just came up with another idea: Which kind of parser are >> you using in BaseX? >> >> If you use the HTML parser for parsing XML, the strange behaviour >> you came across might indeed be expected ... If you're not sure >> which parser you are using, just take a look at our documentation [1]. >> >> Regards, >> Lukas >> >> [1] http://docs.basex.org/wiki/Parser#XML_Parsers >> >> >> >> On Mon, Apr 2, 2012 at 3:58 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> It's mad - I don't add a namespace, the source document is a text file without a namespace - and the log shows that I don't add it ... but it appears. No idea why. >> >> MIke >> >> On 2 Apr 2012, at 14:52, Christian Grün wrote: >> >> > So it seems that the once added namespace is propagated to other >> > documents? I believe there must be at least one document with the >> > mentioned namespace in your database; otherwise I can't explain where >> > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" >> > isn't hard-coded anywhere in the project)... >> > >> > Christian >> > ___________________________________ >> > >> > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> >> The database contains >> >> >> >> <root> >> >> <auditlog> >> >> >> >> ... elements should end up in here ... >> >> >> >> </auditlog> >> >> </root> >> >> >> >> >> >> The initial XML file contains the initial nodes with which to populate the XML database (root plus numerous other nodes). The PHP code inserts additional nodes as it runs. For every node I add, I create an audit entry to allow me to determine who and how the database built over time. >> >> >> >> initialdb.xml contains, therefore: >> >> <root> >> >> <auditlog/> >> >> </root> >> >> >> >> You're right - ignore 'test' - I meant WYP in the database - as in >> >> >> >> drop database WYP >> >> create database WYP test/initialdb.xml >> >> >> >> Apologies for any confusion caused. >> >> >> >> It's really weird - I can't get this to fail consistently - but when it starts inserting the namespace attribute, it then continues to do so. >> >> >> >> Cheers >> >> Mike >> >> >> >> On 2 Apr 2012, at 14:30, Christian Grün wrote: >> >> >> >>> Sorry, I still got some questions.. >> >>> >> >>>> drop database test >> >>>> create database test /initialdb.xml >> >>> >> >>> The database you're creating seems to be called "test"; what's "initialdb.xml"? >> >>> >> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms >> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms >> >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms >> >>> >> >>> The log info implies you're having "root" and "auditlog" nodes, and >> >>> the addressed database is called "WYP", is that right? Could you pass >> >>> us on the missing snippets? >> >>> >> >>> Christian >> >>> >> >>> >> >>> >> >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: >> >>>> >> >>>>> Hi Mike, >> >>>>> >> >>>>> thanks for your report. It would be great if you could provide us with >> >>>>> a small example that allows us to reproduce the issue (an export of >> >>>>> your original database with the namespace (which is being added to the >> >>>>> new node) may suffice). >> >>>>> >> >>>>> Best, >> >>>>> Christian >> >>>>> ____________________________ >> >>>>> >> >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> >>>>>> Hi >> >>>>>> >> >>>>>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >> >>>>>> >> >>>>>> declare variable $DB external; >> >>>>>> >> >>>>>> insert node >> >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >> >>>>>> UID='i1' >> >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >> >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >> >>>>>> mode='active' >> >>>>>> date='2012-04-02T12:21:05+00:00'/> >> >>>>>> into doc($DB)/root/auditlog >> >>>>>> >> >>>>>> -- >> >>>>>> BaseX log shows that it gets the query as-is. >> >>>>>> >> >>>>>> When I look at the data within the database by running the XQuery >> >>>>>> >> >>>>>> /root/auditlog >> >>>>>> >> >>>>>> I find that BaseX has inserted a namespace attribute as follows: >> >>>>>> >> >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" >> >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >> >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >> >>>>>> >> >>>>>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >> >>>>>> >> >>>>>> The PHP script is as follows: >> >>>>>> >> >>>>>> $audit = "declare variable \$DB external; " . >> >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . >> >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . >> >>>>>> "mode='active' " . >> >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >> >>>>>> >> >>>>>> $query = $session->query( $audit ); >> >>>>>> $query->bind( 'DB', $DB); >> >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); >> >>>>>> $query->execute(); >> >>>>>> $query->close(); >> >>>>>> >> >>>>>> >> >>>>>> Thanks in advance for any suggestions. >> >>>>>> >> >>>>>> Mike >> >>>>>> _______________________________________________ >> >>>>>> BaseX-Talk mailing list >> >>>>>> BaseX-Talk at mailman.uni-konstanz.de >> >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >>>> >> >> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
LK
Lukas Kircher2 Apr 2012 17:18 #
Ok, I see the problem, unfortunately I still can't replicate the issue with our current repository version. I started with a
document like this:
*<a> <b/> </a>*
and used the following insert statements:
*insert node <c xmlns='newns'/> into /a*
and afterwards ...
*insert node <d/> into /a*
*
*
*
*
Still, there's no namespace linked to <d/>. Can you replicate the issue with this example or change it in a way that it
replicates it?
Regards,
Lukas
Quoted text · Mike Hawkes · 253 lines
On Mon, Apr 2, 2012 at 5:10 PM, Mike Hawkes <mikehawkes at me.com> wrote: > Yep - this definitely causes problems. Insert a node that includes a > namespace and all subsequent nodes end up with a namespace inserted. So ... > I think this presents a bug: > > <root> > <nodes without namespace/> > <new nodes work well/> > </root> > > vs. > > <root> > <nodes without namespace/> > <node with namespace/> > <new nodes automatically get spurious namespace/> > </root> > > > Hope that helps - not sure how best to fix or work around this at the > moment though. > > Cheers > Mike > > On 2 Apr 2012, at 15:23, Mike Hawkes wrote: > > Hi Lukas/Christian > > It's the built-in one as far as I'm aware - I haven't done anything > special to add or remove any parsers. But that's sent me down a path where > I can get it reliably. > > It appears that it's coming from another query that I run to check the > state of a web-site. As soon as I run the following query, BaseX inserts > the namespace for every inserted node thereafter: > > insert node > <webpage url="http://internet.org.uk" name="primaryDomain">{ > http:send-request( > <http:request > method='get' > status-only='false'/>, > "http://internet.org.uk" )} > </webpage> > into doc($DB)/root/webpages > > As soon as I have any node after the above query has run, BaseX inserts > the namespace. Otherwise it doesn't. If I delete all the nodes within the > <webpage> tags, things return to normal again. > > Is there an easy way to do the above without adding any namesakes (I don't > actually want to include them from the web query either)? This should solve > the problem. > > Cheers > Mike > > On 2 Apr 2012, at 15:02, Lukas Kircher wrote: > > Hi Mike, > > Leo just came up with another idea: Which kind of parser are > you using in BaseX? > > If you use the HTML parser for parsing XML, the strange behaviour > you came across might indeed be expected ... If you're not sure > which parser you are using, just take a look at our documentation [1]. > > Regards, > Lukas > > [1] http://docs.basex.org/wiki/Parser#XML_Parsers > > > > On Mon, Apr 2, 2012 at 3:58 PM, Mike Hawkes <mikehawkes at me.com> wrote: > >> It's mad - I don't add a namespace, the source document is a text file >> without a namespace - and the log shows that I don't add it ... but it >> appears. No idea why. >> >> MIke >> >> On 2 Apr 2012, at 14:52, Christian Grün wrote: >> >> > So it seems that the once added namespace is propagated to other >> > documents? I believe there must be at least one document with the >> > mentioned namespace in your database; otherwise I can't explain where >> > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" >> > isn't hard-coded anywhere in the project)... >> > >> > Christian >> > ___________________________________ >> > >> > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> >> The database contains >> >> >> >> <root> >> >> <auditlog> >> >> >> >> ... elements should end up in here ... >> >> >> >> </auditlog> >> >> </root> >> >> >> >> >> >> The initial XML file contains the initial nodes with which to populate >> the XML database (root plus numerous other nodes). The PHP code inserts >> additional nodes as it runs. For every node I add, I create an audit entry >> to allow me to determine who and how the database built over time. >> >> >> >> initialdb.xml contains, therefore: >> >> <root> >> >> <auditlog/> >> >> </root> >> >> >> >> You're right - ignore 'test' - I meant WYP in the database - as in >> >> >> >> drop database WYP >> >> create database WYP test/initialdb.xml >> >> >> >> Apologies for any confusion caused. >> >> >> >> It's really weird - I can't get this to fail consistently - but when >> it starts inserting the namespace attribute, it then continues to do so. >> >> >> >> Cheers >> >> Mike >> >> >> >> On 2 Apr 2012, at 14:30, Christian Grün wrote: >> >> >> >>> Sorry, I still got some questions.. >> >>> >> >>>> drop database test >> >>>> create database test /initialdb.xml >> >>> >> >>> The database you're creating seems to be called "test"; what's >> "initialdb.xml"? >> >>> >> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare >> variable $DB external; insert node <audit >> QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' >> guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' >> sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' >> date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK >> 0.09 ms >> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK >> 0.05 ms >> >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP >> OK 0.05 ms >> >>> >> >>> The log info implies you're having "root" and "auditlog" nodes, and >> >>> the addressed database is called "WYP", is that right? Could you pass >> >>> us on the missing snippets? >> >>> >> >>> Christian >> >>> >> >>> >> >>> >> >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: >> >>>> >> >>>>> Hi Mike, >> >>>>> >> >>>>> thanks for your report. It would be great if you could provide us >> with >> >>>>> a small example that allows us to reproduce the issue (an export of >> >>>>> your original database with the namespace (which is being added to >> the >> >>>>> new node) may suffice). >> >>>>> >> >>>>> Best, >> >>>>> Christian >> >>>>> ____________________________ >> >>>>> >> >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> >> wrote: >> >>>>>> Hi >> >>>>>> >> >>>>>> I have a weird problem ... I'm running a query via the PHP >> interface and run the following query: >> >>>>>> >> >>>>>> declare variable $DB external; >> >>>>>> >> >>>>>> insert node >> >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >> >>>>>> UID='i1' >> >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >> >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >> >>>>>> mode='active' >> >>>>>> date='2012-04-02T12:21:05+00:00'/> >> >>>>>> into doc($DB)/root/auditlog >> >>>>>> >> >>>>>> -- >> >>>>>> BaseX log shows that it gets the query as-is. >> >>>>>> >> >>>>>> When I look at the data within the database by running the XQuery >> >>>>>> >> >>>>>> /root/auditlog >> >>>>>> >> >>>>>> I find that BaseX has inserted a namespace attribute as follows: >> >>>>>> >> >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" >> >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >> >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" >> sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" >> date="2012-04-02T12:21:05+00:00"/> >> >>>>>> >> >>>>>> How do I stop this occurring? It only does it on the audit >> components, not on anything else inserted by the PHP script. So, if I run >> two insert node queries, the first will run normally, the audit update >> causes the xmlns attribute to appear, effectively putting it in a different >> namespace to the other data inserted by the PHP. >> >>>>>> >> >>>>>> The PHP script is as follows: >> >>>>>> >> >>>>>> $audit = "declare variable \$DB external; " . >> >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . >> >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . >> >>>>>> "mode='active' " . >> >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >> >>>>>> >> >>>>>> $query = $session->query( $audit ); >> >>>>>> $query->bind( 'DB', $DB); >> >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); >> >>>>>> $query->execute(); >> >>>>>> $query->close(); >> >>>>>> >> >>>>>> >> >>>>>> Thanks in advance for any suggestions. >> >>>>>> >> >>>>>> Mike >> >>>>>> _______________________________________________ >> >>>>>> BaseX-Talk mailing list >> >>>>>> BaseX-Talk at mailman.uni-konstanz.de >> >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >>>> >> >> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > >
MH
Mike Hawkes2 Apr 2012 18:01 #
Hi
A bit laborious to recreate but .. here goes:
basexclient ... insert nodes then run:
Quoted text · Lukas Kircher · 1 line
> xquery /
<a>
<b/>
<d>
<e test="here"/>
</d>
</a>
Query executed in 0.2 ms.No problem - I see what I expect. Then run this:
Quoted text · Lukas Kircher · 1 line
> xquery insert node <c>{http:send-request( <http method='get' status-only='false'/>, "http://internet.org.uk" ) }</c> into /a
Query executed in 502.05 ms.
Quoted text · Lukas Kircher · 1 line
> xquery /
<a>
<b/>
<d>
<e test="here"/>
</d>
<c>
<http:response xmlns:http="http://expath.org/ns/http-client" status="200" message="OK">
...
... SNIPPED THE MIDDLE BODY OUT AS IT'S THE HTML RETURNED FROM THE SITE
...
</c>
</a>
Query executed in 1.7 ms.Quoted text · Lukas Kircher · 1 line
> xquery insert node <f/> into /a/d
Query executed in 1.34 ms.
Quoted text · Lukas Kircher · 1 line
> xquery /
<a>
<b/>
<d>
<e test="here"/>
<f/>
</d>
<c>
<http:response xmlns:http="http://expath.org/ns/http-client" status="200" message="OK">
<http:header name="Expires" value="Mon, 26 Jul 1997 05:00:00 GMT"/>
<http:header name="Last-Modified" value="Mon, 02 Apr 2012 15:47:39 GMT"/>
<http:header name="Set-Cookie" value="mosvisitor=1"/>
...
...
...
</c>
</a>
Query executed in 1.72 ms.Quoted text · Lukas Kircher · 1 line
> xquery delete node /a/d
Query executed in 1.54 ms.
Quoted text · Lukas Kircher · 1 line
> xquery insert node <d/> into /a
Query executed in 1.56 ms.
Quoted text · Lukas Kircher · 1 line
> xquery insert node <h test='hello'><i/></h> into /a/d
Query executed in 1.76 ms.
Quoted text · Lukas Kircher · 1 line
> xquery /
<a>
<b/>
<c>
<http:response xmlns:http="http://expath.org/ns/http-client" status="200" message="OK">
<http:header name="Expires" value="Mon, 26 Jul 1997 05:00:00 GMT"/>
...
...
...
</c>
<d>
<h xmlns="http://www.w3.org/1999/xhtml" test="hello">
<i/>
</h>
</d>
</a>
Query executed in 1.71 ms.Quoted text · Lukas Kircher · 1 line
>
---
So, item 'h' suddenly gains a namespace.
Sorry it's a bit convoluted to recreate, but it gets the results I see.
Cheers
Mike
Quoted text · Lukas Kircher · 240 lines
On 2 Apr 2012, at 16:18, Lukas Kircher wrote: > Ok, I see the problem, unfortunately I still can't replicate the > issue with our current repository version. I started with a > document like this: > > <a> <b/> </a> > > and used the following insert statements: > > insert node <c xmlns='newns'/> into /a > > and afterwards ... > > insert node <d/> into /a > > > Still, there's no namespace linked to <d/>. Can you replicate > the issue with this example or change it in a way that it > replicates it? > > Regards, > Lukas > > > > > On Mon, Apr 2, 2012 at 5:10 PM, Mike Hawkes <mikehawkes at me.com> wrote: > Yep - this definitely causes problems. Insert a node that includes a namespace and all subsequent nodes end up with a namespace inserted. So ... I think this presents a bug: > > <root> > <nodes without namespace/> > <new nodes work well/> > </root> > > vs. > > <root> > <nodes without namespace/> > <node with namespace/> > <new nodes automatically get spurious namespace/> > </root> > > > Hope that helps - not sure how best to fix or work around this at the moment though. > > Cheers > Mike > > On 2 Apr 2012, at 15:23, Mike Hawkes wrote: > >> Hi Lukas/Christian >> >> It's the built-in one as far as I'm aware - I haven't done anything special to add or remove any parsers. But that's sent me down a path where I can get it reliably. >> >> It appears that it's coming from another query that I run to check the state of a web-site. As soon as I run the following query, BaseX inserts the namespace for every inserted node thereafter: >> >> insert node >> <webpage url="http://internet.org.uk" name="primaryDomain">{ >> http:send-request( >> <http:request >> method='get' >> status-only='false'/>, >> "http://internet.org.uk" )} >> </webpage> >> into doc($DB)/root/webpages >> >> As soon as I have any node after the above query has run, BaseX inserts the namespace. Otherwise it doesn't. If I delete all the nodes within the <webpage> tags, things return to normal again. >> >> Is there an easy way to do the above without adding any namesakes (I don't actually want to include them from the web query either)? This should solve the problem. >> >> Cheers >> Mike >> >> On 2 Apr 2012, at 15:02, Lukas Kircher wrote: >> >>> Hi Mike, >>> >>> Leo just came up with another idea: Which kind of parser are >>> you using in BaseX? >>> >>> If you use the HTML parser for parsing XML, the strange behaviour >>> you came across might indeed be expected ... If you're not sure >>> which parser you are using, just take a look at our documentation [1]. >>> >>> Regards, >>> Lukas >>> >>> [1] http://docs.basex.org/wiki/Parser#XML_Parsers >>> >>> >>> >>> On Mon, Apr 2, 2012 at 3:58 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>> It's mad - I don't add a namespace, the source document is a text file without a namespace - and the log shows that I don't add it ... but it appears. No idea why. >>> >>> MIke >>> >>> On 2 Apr 2012, at 14:52, Christian Grün wrote: >>> >>> > So it seems that the once added namespace is propagated to other >>> > documents? I believe there must be at least one document with the >>> > mentioned namespace in your database; otherwise I can't explain where >>> > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" >>> > isn't hard-coded anywhere in the project)... >>> > >>> > Christian >>> > ___________________________________ >>> > >>> > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>> >> The database contains >>> >> >>> >> <root> >>> >> <auditlog> >>> >> >>> >> ... elements should end up in here ... >>> >> >>> >> </auditlog> >>> >> </root> >>> >> >>> >> >>> >> The initial XML file contains the initial nodes with which to populate the XML database (root plus numerous other nodes). The PHP code inserts additional nodes as it runs. For every node I add, I create an audit entry to allow me to determine who and how the database built over time. >>> >> >>> >> initialdb.xml contains, therefore: >>> >> <root> >>> >> <auditlog/> >>> >> </root> >>> >> >>> >> You're right - ignore 'test' - I meant WYP in the database - as in >>> >> >>> >> drop database WYP >>> >> create database WYP test/initialdb.xml >>> >> >>> >> Apologies for any confusion caused. >>> >> >>> >> It's really weird - I can't get this to fail consistently - but when it starts inserting the namespace attribute, it then continues to do so. >>> >> >>> >> Cheers >>> >> Mike >>> >> >>> >> On 2 Apr 2012, at 14:30, Christian Grün wrote: >>> >> >>> >>> Sorry, I still got some questions.. >>> >>> >>> >>>> drop database test >>> >>>> create database test /initialdb.xml >>> >>> >>> >>> The database you're creating seems to be called "test"; what's "initialdb.xml"? >>> >>> >>> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare variable $DB external; insert node <audit QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK 0.09 ms >>> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK 0.05 ms >>> >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP OK 0.05 ms >>> >>> >>> >>> The log info implies you're having "root" and "auditlog" nodes, and >>> >>> the addressed database is called "WYP", is that right? Could you pass >>> >>> us on the missing snippets? >>> >>> >>> >>> Christian >>> >>> >>> >>> >>> >>> >>> >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: >>> >>>> >>> >>>>> Hi Mike, >>> >>>>> >>> >>>>> thanks for your report. It would be great if you could provide us with >>> >>>>> a small example that allows us to reproduce the issue (an export of >>> >>>>> your original database with the namespace (which is being added to the >>> >>>>> new node) may suffice). >>> >>>>> >>> >>>>> Best, >>> >>>>> Christian >>> >>>>> ____________________________ >>> >>>>> >>> >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>> >>>>>> Hi >>> >>>>>> >>> >>>>>> I have a weird problem ... I'm running a query via the PHP interface and run the following query: >>> >>>>>> >>> >>>>>> declare variable $DB external; >>> >>>>>> >>> >>>>>> insert node >>> >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >>> >>>>>> UID='i1' >>> >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >>> >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >>> >>>>>> mode='active' >>> >>>>>> date='2012-04-02T12:21:05+00:00'/> >>> >>>>>> into doc($DB)/root/auditlog >>> >>>>>> >>> >>>>>> -- >>> >>>>>> BaseX log shows that it gets the query as-is. >>> >>>>>> >>> >>>>>> When I look at the data within the database by running the XQuery >>> >>>>>> >>> >>>>>> /root/auditlog >>> >>>>>> >>> >>>>>> I find that BaseX has inserted a namespace attribute as follows: >>> >>>>>> >>> >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" >>> >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >>> >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" date="2012-04-02T12:21:05+00:00"/> >>> >>>>>> >>> >>>>>> How do I stop this occurring? It only does it on the audit components, not on anything else inserted by the PHP script. So, if I run two insert node queries, the first will run normally, the audit update causes the xmlns attribute to appear, effectively putting it in a different namespace to the other data inserted by the PHP. >>> >>>>>> >>> >>>>>> The PHP script is as follows: >>> >>>>>> >>> >>>>>> $audit = "declare variable \$DB external; " . >>> >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . >>> >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . >>> >>>>>> "mode='active' " . >>> >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >>> >>>>>> >>> >>>>>> $query = $session->query( $audit ); >>> >>>>>> $query->bind( 'DB', $DB); >>> >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); >>> >>>>>> $query->execute(); >>> >>>>>> $query->close(); >>> >>>>>> >>> >>>>>> >>> >>>>>> Thanks in advance for any suggestions. >>> >>>>>> >>> >>>>>> Mike >>> >>>>>> _______________________________________________ >>> >>>>>> BaseX-Talk mailing list >>> >>>>>> BaseX-Talk at mailman.uni-konstanz.de >>> >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >>>> >>> >> >>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
LK
Lukas Kircher3 Apr 2012 13:20 #
Hi Mike,
thanks for the effort - this recreates the issue for me and
is certainly a bug, as you said. I'll have a look at it.
Regards,
Lukas
Quoted text · Mike Hawkes · 395 lines
On Mon, Apr 2, 2012 at 6:01 PM, Mike Hawkes <mikehawkes at me.com> wrote: > Hi > > A bit laborious to recreate but .. here goes: > > basexclient ... insert nodes then run: > > > xquery / > <a> > <b/> > <d> > <e test="here"/> > </d> > </a> > Query executed in 0.2 ms. > > No problem - I see what I expect. Then run this: > > > > xquery insert node <c>{http:send-request( <http method='get' > status-only='false'/>, "http://internet.org.uk" ) }</c> into /a > > Query executed in 502.05 ms. > > xquery / > <a> > <b/> > <d> > <e test="here"/> > </d> > <c> > <http:response xmlns:http="http://expath.org/ns/http-client" > status="200" message="OK"> > ... > ... SNIPPED THE MIDDLE BODY OUT AS IT'S THE HTML RETURNED FROM THE SITE > ... > </c> > </a> > Query executed in 1.7 ms. > > > > xquery insert node <f/> into /a/d > > > Query executed in 1.34 ms. > > xquery / > <a> > <b/> > <d> > <e test="here"/> > <f/> > </d> > <c> > <http:response xmlns:http="http://expath.org/ns/http-client" > status="200" message="OK"> > <http:header name="Expires" value="Mon, 26 Jul 1997 05:00:00 GMT"/> > <http:header name="Last-Modified" value="Mon, 02 Apr 2012 15:47:39 > GMT"/> > <http:header name="Set-Cookie" value="mosvisitor=1"/> > ... > ... > ... > </c> > </a> > Query executed in 1.72 ms. > > > > > xquery delete node /a/d > Query executed in 1.54 ms. > > > xquery insert node <d/> into /a > > Query executed in 1.56 ms. > > xquery insert node <h test='hello'><i/></h> into /a/d > > Query executed in 1.76 ms. > > xquery / > <a> > <b/> > <c> > <http:response xmlns:http="http://expath.org/ns/http-client" > status="200" message="OK"> > <http:header name="Expires" value="Mon, 26 Jul 1997 05:00:00 GMT"/> > ... > ... > ... > </c> > <d> > <h xmlns="http://www.w3.org/1999/xhtml" test="hello"> > <i/> > </h> > </d> > </a> > Query executed in 1.71 ms. > > > > > > --- > So, item 'h' suddenly gains a namespace. > > Sorry it's a bit convoluted to recreate, but it gets the results I see. > > Cheers > Mike > > > > > On 2 Apr 2012, at 16:18, Lukas Kircher wrote: > > Ok, I see the problem, unfortunately I still can't replicate the > issue with our current repository version. I started with a > document like this: > > *<a> <b/> </a>* > > and used the following insert statements: > > *insert node <c xmlns='newns'/> into /a* > > and afterwards ... > > *insert node <d/> into /a* > * > * > * > * > Still, there's no namespace linked to <d/>. Can you replicate > the issue with this example or change it in a way that it > replicates it? > > Regards, > Lukas > > > > > On Mon, Apr 2, 2012 at 5:10 PM, Mike Hawkes <mikehawkes at me.com> wrote: > >> Yep - this definitely causes problems. Insert a node that includes a >> namespace and all subsequent nodes end up with a namespace inserted. So ... >> I think this presents a bug: >> >> <root> >> <nodes without namespace/> >> <new nodes work well/> >> </root> >> >> vs. >> >> <root> >> <nodes without namespace/> >> <node with namespace/> >> <new nodes automatically get spurious namespace/> >> </root> >> >> >> Hope that helps - not sure how best to fix or work around this at the >> moment though. >> >> Cheers >> Mike >> >> On 2 Apr 2012, at 15:23, Mike Hawkes wrote: >> >> Hi Lukas/Christian >> >> It's the built-in one as far as I'm aware - I haven't done anything >> special to add or remove any parsers. But that's sent me down a path where >> I can get it reliably. >> >> It appears that it's coming from another query that I run to check the >> state of a web-site. As soon as I run the following query, BaseX inserts >> the namespace for every inserted node thereafter: >> >> insert node >> <webpage url="http://internet.org.uk" name="primaryDomain">{ >> http:send-request( >> <http:request >> method='get' >> status-only='false'/>, >> "http://internet.org.uk" )} >> </webpage> >> into doc($DB)/root/webpages >> >> As soon as I have any node after the above query has run, BaseX inserts >> the namespace. Otherwise it doesn't. If I delete all the nodes within the >> <webpage> tags, things return to normal again. >> >> Is there an easy way to do the above without adding any namesakes (I >> don't actually want to include them from the web query either)? This should >> solve the problem. >> >> Cheers >> Mike >> >> On 2 Apr 2012, at 15:02, Lukas Kircher wrote: >> >> Hi Mike, >> >> Leo just came up with another idea: Which kind of parser are >> you using in BaseX? >> >> If you use the HTML parser for parsing XML, the strange behaviour >> you came across might indeed be expected ... If you're not sure >> which parser you are using, just take a look at our documentation [1]. >> >> Regards, >> Lukas >> >> [1] http://docs.basex.org/wiki/Parser#XML_Parsers >> >> >> >> On Mon, Apr 2, 2012 at 3:58 PM, Mike Hawkes <mikehawkes at me.com> wrote: >> >>> It's mad - I don't add a namespace, the source document is a text file >>> without a namespace - and the log shows that I don't add it ... but it >>> appears. No idea why. >>> >>> MIke >>> >>> On 2 Apr 2012, at 14:52, Christian Grün wrote: >>> >>> > So it seems that the once added namespace is propagated to other >>> > documents? I believe there must be at least one document with the >>> > mentioned namespace in your database; otherwise I can't explain where >>> > it should come from (afaik, the string "http://www.w3.org/1999/xhtml" >>> > isn't hard-coded anywhere in the project)... >>> > >>> > Christian >>> > ___________________________________ >>> > >>> > On Mon, Apr 2, 2012 at 3:40 PM, Mike Hawkes <mikehawkes at me.com> wrote: >>> >> The database contains >>> >> >>> >> <root> >>> >> <auditlog> >>> >> >>> >> ... elements should end up in here ... >>> >> >>> >> </auditlog> >>> >> </root> >>> >> >>> >> >>> >> The initial XML file contains the initial nodes with which to >>> populate the XML database (root plus numerous other nodes). The PHP code >>> inserts additional nodes as it runs. For every node I add, I create an >>> audit entry to allow me to determine who and how the database built over >>> time. >>> >> >>> >> initialdb.xml contains, therefore: >>> >> <root> >>> >> <auditlog/> >>> >> </root> >>> >> >>> >> You're right - ignore 'test' - I meant WYP in the database - as in >>> >> >>> >> drop database WYP >>> >> create database WYP test/initialdb.xml >>> >> >>> >> Apologies for any confusion caused. >>> >> >>> >> It's really weird - I can't get this to fail consistently - but when >>> it starts inserting the namespace attribute, it then continues to do so. >>> >> >>> >> Cheers >>> >> Mike >>> >> >>> >> On 2 Apr 2012, at 14:30, Christian Grün wrote: >>> >> >>> >>> Sorry, I still got some questions.. >>> >>> >>> >>>> drop database test >>> >>>> create database test /initialdb.xml >>> >>> >>> >>> The database you're creating seems to be called "test"; what's >>> "initialdb.xml"? >>> >>> >>> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) declare >>> variable $DB external; insert node <audit >>> QID='80C18E9A-46DD-4B3E-89E9-967DAFD79A0B' UID='i1' >>> guid='0EEDDB47-726E-49F8-B1EF-0F73ED848969' >>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' mode='active' >>> date='2012-04-02T13:00:00+00:00'/> into doc($DB)/root/auditlog OK >>> 0.09 ms >>> >>>> 14:00:00.710 [127.0.0.1:49788] QUERY(4) OK >>> 0.05 ms >>> >>>> 14:00:00.710 [127.0.0.1:49788] BIND(4) DB WYP >>> OK 0.05 ms >>> >>> >>> >>> The log info implies you're having "root" and "auditlog" nodes, and >>> >>> the addressed database is called "WYP", is that right? Could you pass >>> >>> us on the missing snippets? >>> >>> >>> >>> Christian >>> >>> >>> >>> >>> >>> >>> >>>> On 2 Apr 2012, at 14:11, Christian Grün wrote: >>> >>>> >>> >>>>> Hi Mike, >>> >>>>> >>> >>>>> thanks for your report. It would be great if you could provide us >>> with >>> >>>>> a small example that allows us to reproduce the issue (an export of >>> >>>>> your original database with the namespace (which is being added to >>> the >>> >>>>> new node) may suffice). >>> >>>>> >>> >>>>> Best, >>> >>>>> Christian >>> >>>>> ____________________________ >>> >>>>> >>> >>>>> On Mon, Apr 2, 2012 at 2:44 PM, Mike Hawkes <mikehawkes at me.com> >>> wrote: >>> >>>>>> Hi >>> >>>>>> >>> >>>>>> I have a weird problem ... I'm running a query via the PHP >>> interface and run the following query: >>> >>>>>> >>> >>>>>> declare variable $DB external; >>> >>>>>> >>> >>>>>> insert node >>> >>>>>> <audit QID='C54B14ED-C748-4DF0-87F2-91F505BE207B' >>> >>>>>> UID='i1' >>> >>>>>> guid='CC9D4D2B-B380-494B-B0F6-4D72471557B0' >>> >>>>>> sessionID='48090b7f0e3a62a42a0457a3e88301ca' >>> >>>>>> mode='active' >>> >>>>>> date='2012-04-02T12:21:05+00:00'/> >>> >>>>>> into doc($DB)/root/auditlog >>> >>>>>> >>> >>>>>> -- >>> >>>>>> BaseX log shows that it gets the query as-is. >>> >>>>>> >>> >>>>>> When I look at the data within the database by running the XQuery >>> >>>>>> >>> >>>>>> /root/auditlog >>> >>>>>> >>> >>>>>> I find that BaseX has inserted a namespace attribute as follows: >>> >>>>>> >>> >>>>>> <audit xmlns="http://www.w3.org/1999/xhtml" >>> >>>>>> QID="C54B14ED-C748-4DF0-87F2-91F505BE207B" >>> >>>>>> UID="i1" guid="CC9D4D2B-B380-494B-B0F6-4D72471557B0" >>> sessionID="48090b7f0e3a62a42a0457a3e88301ca" mode="active" >>> date="2012-04-02T12:21:05+00:00"/> >>> >>>>>> >>> >>>>>> How do I stop this occurring? It only does it on the audit >>> components, not on anything else inserted by the PHP script. So, if I run >>> two insert node queries, the first will run normally, the audit update >>> causes the xmlns attribute to appear, effectively putting it in a different >>> namespace to the other data inserted by the PHP. >>> >>>>>> >>> >>>>>> The PHP script is as follows: >>> >>>>>> >>> >>>>>> $audit = "declare variable \$DB external; " . >>> >>>>>> "insert node <audit QID='$queryID' UID='$userID' " . >>> >>>>>> "guid='$guid' sessionID='" . session_id() . "' " . >>> >>>>>> "mode='active' " . >>> >>>>>> "date='$dateTime'/> into doc(\$DB)/root/auditlog"; >>> >>>>>> >>> >>>>>> $query = $session->query( $audit ); >>> >>>>>> $query->bind( 'DB', $DB); >>> >>>>>> $query->bind( 'SYSDATA', $SYSDATA ); >>> >>>>>> $query->execute(); >>> >>>>>> $query->close(); >>> >>>>>> >>> >>>>>> >>> >>>>>> Thanks in advance for any suggestions. >>> >>>>>> >>> >>>>>> Mike >>> >>>>>> _______________________________________________ >>> >>>>>> BaseX-Talk mailing list >>> >>>>>> BaseX-Talk at mailman.uni-konstanz.de >>> >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >>>> >>> >> >>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >> > >
LW
Hi,
Quoted text · Mike Hawkes · 2 lines
Am 02.04.2012 18:01, schrieb Mike Hawkes: > A bit laborious to recreate but .. here goes:
I found a simpler repro:
CREATE DB test <a><c/></a>
XQUERY insert node <b xmlns='b'/> before /a/c
XQUERY insert node <d/> into /a/c
This produces:
<a>
<b xmlns="b"/>
<c>
<d xmlns="b"/>
</c>
</a>The
d node should be in the default namespace.
We're working on it...
Cheers, LeoMH
Mike Hawkes3 Apr 2012 16:10 #
Thanks lots.
In the meantime, can I force the http functions to return everything using the default namespace? Or is it a case of writing XQuery functions to strip it all before calling the insert?
Thanks again. Much appreciated.
Mike
Quoted text · Leo Wörteler · 25 lines
On 3 Apr 2012, at 12:58, Leo Wörteler wrote: > Hi, > > Am 02.04.2012 18:01, schrieb Mike Hawkes: >> A bit laborious to recreate but .. here goes: > > I found a simpler repro: > > CREATE DB test <a><c/></a> > XQUERY insert node <b xmlns='b'/> before /a/c > XQUERY insert node <d/> into /a/c > > This produces: > > <a> > <b xmlns="b"/> > <c> > <d xmlns="b"/> > </c> > </a> > > The `d` node should be in the default namespace. > We're working on it... > > Cheers, Leo
LW
Leo Wörteler3 Apr 2012 16:29 #
Hi Mike,
Quoted text · Mike Hawkes · 2 lines
Am 03.04.2012 16:10, schrieb Mike Hawkes: > In the meantime, can I force the http functions to return everything using the default namespace? Or is it a case of writing XQuery functions to strip it all before calling the insert?
Lukas implemented just that a few days ago. Try this in the query prolog:
declare option db:htmlopt 'nons=true';Hope that helps,
cheers, Leo
MH
Mike Hawkes5 Apr 2012 18:36 #
Thanks Leo - I'll check it out after the weekend. It'll certainly help!
Thanks again everyone.
Cheers
Mike
Quoted text · Leo Wörteler · 12 lines
On 3 Apr 2012, at 15:29, Leo Wörteler wrote: > Hi Mike, > > Am 03.04.2012 16:10, schrieb Mike Hawkes: >> In the meantime, can I force the http functions to return everything using the default namespace? Or is it a case of writing XQuery functions to strip it all before calling the insert? > > Lukas implemented just that a few days ago. Try this in the query prolog: > > declare option db:htmlopt 'nons=true'; > > Hope that helps, > cheers, Leo
Written for BaseX 7.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery