Why am I getting this error with the prolog statement
Monday, 2 October 2017 · 7 messages · last reply 4 Oct 2017
KS
Hi,
If the pasted text is what you see in a text editor, then the text is probably not valid UTF-16. It would look like this in the text display for hex viewer:
…<.?.x.m.l..e.n.c.o. etc. A space-like character before each displayed 8 bit character.
Aside from that the XML declaration requires version=”…”, so <?xml version=”1.0” encoding=”UTF-16”?>
And this is not valid markup
FF46A9948989889877EEC6FF7466
EFCF743055364957EF436016F0FE
You might want to look at https://www.w3.org/TR/xml/#NT-XMLDecl
And if you have software to encode your data as UTF-16BE that might be easier than trying to construct UTF-16 out of bytes, if that is what is shown.
Kendall
Quoted text · basex-talk-bounces at mailman.uni-konstanz.de on behalf of Dave Day · 1 line
On 10/2/17, 2:24 PM, "basex-talk-bounces at mailman.uni-konstanz.de on behalf of Dave Day" <basex-talk-bounces at mailman.uni-konstanz.de on behalf of David.Day at duke-software.com> wrote:
Hello list.
Another newbie question. I am creating a file in UTF-16, Big-endian. I am putting a 2 byte BOM sequence of x'FEFF' as the 1st two bytes, followed by a prolog statement identifying this as UTF-16 code.
I then ftp this file to my desktop in binary to maintain the encoding.
Below is a cut-n-paste of the 1st few bytes as it looks on the mainframe box.
---------------------------
Ú.<?xml encoding="UTF-16" ?>
FF46A9948989889877EEC6FF7466
EFCF743055364957EF436016F0FE
The way the display is within ISPF, each byte has one character on two lines, so the 1st byte, FE should be read as col 1 of both lines, and so forth.
When I try to create a new database I get the following from Basex.
Command:
CREATE DB d100217 :zxpf.ftp.download/apf1.v2r3.xmldata
Error:
"d100217.xml" (Line 1): Content is not allowed in prolog.
Help greatly appreciated.
Regards,
Dave Day
CG
Hi Dave,
the UTF-16 BE code for '<' would be 00 3C. I cannot see these octets in your example, so maybe you’ll have to double-check your initial encoding step?
See [1] for some more examples.
Cheers,
Christian
[1] https://en.m.wikipedia.org/wiki/UTF-16#Examples
Quoted text · Dave Day · 1 line
Am 03.10.2017 12:02 vorm. schrieb "Dave Day" <David.Day at duke-software.com>:
Hi Kendall,
Thanks for taking the time to respond.
As usual, I did not do a good job of asking the question.
The cut-n-paste I put in the original was from a display that had 'hex on' option, so you get three lines displayed for each original line in the file.
With it set to 'hex off', the display is
Ú.<?xml encoding="UTF-16" ?>
With it set to 'hex on', the display is
Ú.<?xml encoding="UTF-16" ?>
FF46A9948989889877EEC6FF7466
EFCF743055364957EF436016F0FE
The 2nd and third lines in this cut-n-paste are the hex values for the 1st line.
I will put the version= in the code and try again, as well as looking at the link you sent.
Thank you.
-- Dave
Quoted text · Kendall Shaw · 60 lines
On 10/2/2017 4:52 PM, Kendall Shaw wrote: > Hi, > > If the pasted text is what you see in a text editor, then the text is > probably not valid UTF-16. It would look like this in the text display > for hex viewer: > > …<.?.x.m.l..e.n.c.o. etc. A space-like character before each displayed 8 > bit character. > > Aside from that the XML declaration requires version=”…”, so <?xml > version=”1.0” encoding=”UTF-16”?> > > And this is not valid markup > > FF46A9948989889877EEC6FF7466 > EFCF743055364957EF436016F0FE > > You might want to look at https://www.w3.org/TR/xml/#NT-XMLDecl > > And if you have software to encode your data as UTF-16BE that might be > easier than trying to construct UTF-16 out of bytes, if that is what is > shown. > > Kendall > > On 10/2/17, 2:24 PM, "basex-talk-bounces at mailman.uni-konstanz.de on > behalf of Dave Day" <basex-talk-bounces at mailman.uni-konstanz.de on behalf > of David.Day at duke-software.com> wrote: > > Hello list. > Another newbie question. I am creating a file in UTF-16, > Big-endian. I > am putting a 2 byte BOM sequence of x'FEFF' as the 1st two bytes, > followed by a prolog statement identifying this as UTF-16 code. > I then ftp this file to my desktop in binary to maintain the > encoding. > Below is a cut-n-paste of the 1st few bytes as it looks on the > mainframe > box. > --------------------------- > Ú.<?xml encoding="UTF-16" ?> > FF46A9948989889877EEC6FF7466 > EFCF743055364957EF436016F0FE > The way the display is within ISPF, each byte has one character > on two > lines, so the 1st byte, FE should be read as col 1 of both lines, and > so > forth. > When I try to create a new database I get the following from > Basex. > Command: > CREATE DB d100217 :zxpf.ftp.download/apf1.v2r3.xmldata > Error: > "d100217.xml" (Line 1): Content is not allowed in prolog. > Help greatly appreciated. > Regards, > Dave Day > >
DD
Dave Day3 Oct 2017 01:24 #
Hello list.
Another newbie question. I am creating a file in UTF-16, Big-endian. I am putting a 2 byte BOM sequence of x'FEFF' as the 1st two bytes, followed by a prolog statement identifying this as UTF-16 code.
I then ftp this file to my desktop in binary to maintain the encoding.
Below is a cut-n-paste of the 1st few bytes as it looks on the mainframe box.
---------------------------
Ú.<?xml encoding="UTF-16" ?>
FF46A9948989889877EEC6FF7466
EFCF743055364957EF436016F0FE
The way the display is within ISPF, each byte has one character on two lines, so the 1st byte, FE should be read as col 1 of both lines, and so forth.
When I try to create a new database I get the following from Basex.
Command:
CREATE DB d100217 :zxpf.ftp.download/apf1.v2r3.xmldata
Error:
"d100217.xml" (Line 1): Content is not allowed in prolog.
Help greatly appreciated.
Regards,
Dave Day
DD
Hi Kendall,
Thanks for taking the time to respond.
As usual, I did not do a good job of asking the question.
The cut-n-paste I put in the original was from a display that had 'hex on' option, so you get three lines displayed for each original line in the file.
With it set to 'hex off', the display is
Ú.<?xml encoding="UTF-16" ?>
With it set to 'hex on', the display is
Ú.<?xml encoding="UTF-16" ?>
FF46A9948989889877EEC6FF7466
EFCF743055364957EF436016F0FE
The 2nd and third lines in this cut-n-paste are the hex values for the 1st line.
I will put the version= in the code and try again, as well as looking at the link you sent.
Thank you.
-- Dave
Quoted text · Kendall Shaw · 60 lines
On 10/2/2017 4:52 PM, Kendall Shaw wrote: > Hi, > > If the pasted text is what you see in a text editor, then the text is > probably not valid UTF-16. It would look like this in the text display for hex viewer: > > …<.?.x.m.l..e.n.c.o. etc. A space-like character before each displayed 8 bit character. > > Aside from that the XML declaration requires version=”…”, so <?xml version=”1.0” encoding=”UTF-16”?> > > And this is not valid markup > > FF46A9948989889877EEC6FF7466 > EFCF743055364957EF436016F0FE > > You might want to look at https://www.w3.org/TR/xml/#NT-XMLDecl > > And if you have software to encode your data as UTF-16BE that might be easier than trying to construct UTF-16 out of bytes, if that is what is shown. > > Kendall > > On 10/2/17, 2:24 PM, "basex-talk-bounces at mailman.uni-konstanz.de on behalf of Dave Day" <basex-talk-bounces at mailman.uni-konstanz.de on behalf of David.Day at duke-software.com> wrote: > > Hello list. > > Another newbie question. I am creating a file in UTF-16, Big-endian. I > am putting a 2 byte BOM sequence of x'FEFF' as the 1st two bytes, > followed by a prolog statement identifying this as UTF-16 code. > > I then ftp this file to my desktop in binary to maintain the encoding. > > Below is a cut-n-paste of the 1st few bytes as it looks on the mainframe > box. > > --------------------------- > Ú.<?xml encoding="UTF-16" ?> > FF46A9948989889877EEC6FF7466 > EFCF743055364957EF436016F0FE > > The way the display is within ISPF, each byte has one character on two > lines, so the 1st byte, FE should be read as col 1 of both lines, and so > forth. > > When I try to create a new database I get the following from Basex. > > Command: > CREATE DB d100217 :zxpf.ftp.download/apf1.v2r3.xmldata > Error: > "d100217.xml" (Line 1): Content is not allowed in prolog. > > > Help greatly appreciated. > > Regards, > > Dave Day > > > >
CG
Christian Grün3 Oct 2017 16:57 #
Hi Dave (cc to the list),
Quoted text · Dave Day · 2 lines
> I am creating xml on an IBM mainframe. The code page used on mainframes > is defined as EBCDIC 0037. https://en.wikipedia.org/wiki/EBCDIC_037
As EBCDIC 0037 is limited to 256 characters, a simple mapping should suffice to convert your text to ISO-8859-1 (see the mapping table in the Wikipedia entry you referenced). It should be lightning fast, no matter if you do it in assembler or in XQuery.
Hope this helps,
Christian
KS
Kendall Shaw4 Oct 2017 19:08 #
Quoted text · basex-talk-bounces at mailman.uni-konstanz.de on behalf of Christian Grün · 1 line
On 10/3/17, 7:57 AM, "basex-talk-bounces at mailman.uni-konstanz.de on behalf of Christian Grün" <basex-talk-bounces at mailman.uni-konstanz.de on behalf of christian.gruen at gmail.com> wrote:
Hi Dave (cc to the list),
Quoted text · Christian Grün · 2 lines
> I am creating xml on an IBM mainframe. The code page used on mainframes > is defined as EBCDIC 0037. https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_EBCDIC-5F037&d=DwIBaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=miid_BqIV7JLoVEU1Rw6R1qalH8OKsZl1ca87e9HMcM&s=PTtt72n66Y0yBVLX3hbg9q6mV2FP3ZfO-PYn7C-PoWU&e=
As EBCDIC 0037 is limited to 256 characters, a simple mapping should suffice to convert your text to ISO-8859-1 (see the mapping table in the Wikipedia entry you referenced). It should be lightning fast, no matter if you do it in assembler or in XQuery.
Dave,
I, for one, am interested to know what you find, because it is an unusual (for me) problem and fun.
The Hercules people might have advice because they deal with mainframe software using gnu tools.
http://www.hercules-390.org/
Kendall
DD
Dave Day4 Oct 2017 21:23 #
Kendall,
I've known about Hercules for some time, but never thought of getting in touch with them, till now. Good suggestion. I'll keep them in mind for future reference.
My problem with the prolog and the UTF-16 encoding was strictly me heading off into the weeds on this.
I really did not understand what it meant to specify an encoding as UTF-16...that each character is represented by 16 bits. Not very bright on my part. I was thinking more of UTF-16 meaning that the encoding is in hexadecimal, a numbering system that uses 16 values to count.
The reason I headed off into the weeds in the first place was me not understanding an error I got when I tried to create a new Basex database with the xml I created on z/OS.
Right now, I will be translating the xml from EBCDIC to ASCII and load the database using the translated xml. Once I get it working, I hope to be able to skip the translate on the mainframe side, and get Basex to do that. The translate instruction on MVS is one of the more cpu intensive instructions, and it would be good to get those cycles offloaded, if possible.
-- Dave
Quoted text · basex-talk-bounces at mailman.uni-konstanz.de on behalf of Christian Grün · 22 lines
On 10/4/2017 12:08 PM, Kendall Shaw wrote: > On 10/3/17, 7:57 AM, "basex-talk-bounces at mailman.uni-konstanz.de on behalf of Christian Grün" <basex-talk-bounces at mailman.uni-konstanz.de on behalf of christian.gruen at gmail.com> wrote: > > Hi Dave (cc to the list), > > > I am creating xml on an IBM mainframe. The code page used on mainframes > > is defined as EBCDIC 0037. https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_EBCDIC-5F037&d=DwIBaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=miid_BqIV7JLoVEU1Rw6R1qalH8OKsZl1ca87e9HMcM&s=PTtt72n66Y0yBVLX3hbg9q6mV2FP3ZfO-PYn7C-PoWU&e= > > As EBCDIC 0037 is limited to 256 characters, a simple mapping should > suffice to convert your text to ISO-8859-1 (see the mapping table in > the Wikipedia entry you referenced). It should be lightning fast, no > matter if you do it in assembler or in XQuery. > > Dave, > I, for one, am interested to know what you find, because it is an unusual (for me) problem and fun. > > The Hercules people might have advice because they deal with mainframe software using gnu tools. > > http://www.hercules-390.org/ > > Kendall >
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery