Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: SAX parser splits URL ...

Reply
Thread Tools

Re: SAX parser splits URL ...

 
 
Robert Klemme
Guest
Posts: n/a
 
      06-27-2012
On 27.06.2012 05:50, lbrt chx _ gemale wrote:
> I have an URL in an XML file that looks like this:
> ~
> ...
> <Location>http://pagesinxt.com/?dn=www.outfo.org&flrdr=yes&nxte=zip</Location>
> ...
> ~
> http://xsdvalidation.utilities-online.info/
> ~
> is telling me the document itself is valid, but the SAX parser is
> splitting the value at every "&"
> ~
> // __ start element iIxLvl: |3|Location
> // __ start characters iIxLvl: |3|http://pagesinxt.com/?dn=www.outfo.org|
> // __ start characters iIxLvl: |3|&|
> // __ start characters iIxLvl: |3|flrdr=yes|
> // __ start characters iIxLvl: |3|&|
> // __ start characters iIxLvl: |3|nxte=zip|
> // __ end element iIxLvl: |2|Location|
> ~
> I found some sort of an explanation here:
> ~
> http://stackoverflow.com/questions/1...ersands-in-xml
> ~
> I couldn't make much sense of (I tried a few things)
> ~
> Is this related to a setting in the parser? Is there a way to fix that problem?


That's not related to the parser - at least not to a particular one. It
is a feature of XML which allows you to include characters in the
document which are not supported by the native encoding you use when
writing the document.

The concept is known as "XML entity". Please see
http://www.tizag.com/xmlTutorial/xmlentity.php
http://www.javacommerce.com/displayp...s.sql&id=18238

The standard
http://www.w3.org/TR/2006/REC-xml11-...sec-references

Bottom line, you can do

<Location>http://pagesinxt.com/?dn=www.outfo.org&amp;flrdr=yes&amp;nxte=zip</Location>

But please read up on XML more thoroughly - it pays off.

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/


 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      06-27-2012
On Wednesday, June 27, 2012 7:34:18 AM UTC+2, Robert Klemme wrote:
> On 27.06.2012 05:50, lbrt chx _ gemale wrote:
> > I have an URL in an XML file that looks like this:
> > ~
> > ...
> > <Location>http://pagesinxt.com/?dn=www.outfo.org&flrdr=yes&nxte=zip</Location>
> > ...
> > ~
> > http://xsdvalidation.utilities-online.info/
> > ~
> > is telling me the document itself is valid, but the SAX parser is
> > splitting the value at every "&"
> > ~
> > // __ start element iIxLvl: |3|Location
> > // __ start characters iIxLvl: |3|http://pagesinxt.com/?dn=www.outfo.org|
> > // __ start characters iIxLvl: |3|&|
> > // __ start characters iIxLvl: |3|flrdr=yes|
> > // __ start characters iIxLvl: |3|&|
> > // __ start characters iIxLvl: |3|nxte=zip|
> > // __ end element iIxLvl: |2|Location|


I forgot to mention one thing: the SAX parser is quite free to hand over character sequences in any number of chunks as long as it maintains original order from the document and ensures all characters come from the same external entity. See:

http://www.saxproject.org/apidoc/org...racters%28char[],%20int,%20int%29

Kind regards

robert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: SAX parser splits URL ... mayeul.marguet Java 0 06-27-2012 09:32 AM
a simple command that splits up a string into numbers and letters shawn bright Ruby 6 02-05-2009 07:02 AM
How to toggle between window splits? =?Utf-8?B?a2Q=?= ASP .Net 0 05-02-2005 11:34 AM
Help - Space in script that splits string at comma Hoggman Javascript 1 08-17-2004 01:29 AM



Advertisments