Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 24th, 2006, 03:05 PM
SL
Guest
 
Posts: n/a
Default xml:base attribute added by a parser make validation fails

I try to validate against a schema a document stored in several files
thanks to external entities. The parseur add a 'xml:base="url"'
attribute on the root element of this sub-trees during parsing, so the
validation of the document fails.

Is there a recommanded solution to this situation ? I have no idea how
to handle the problem: I don't want to take into account at the
vocabulary level a question of syntax (the external entities) by
adding the xml:base attribute into my schema.

Thanks for any suggestion.
  #2  
Old July 24th, 2006, 06:15 PM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

SL wrote:
Quote:
The parseur add a 'xml:base="url"'
Try another parser?
  #3  
Old July 24th, 2006, 06:25 PM
SL
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

Joe Kesselman a écrit :
Quote:
SL wrote:
Quote:
>The parseur add a 'xml:base="url"'
>
Try another parser?
Yes... :-) (I preferred to deteriorate my schemas rather than to
deteriorate the abstraction of the call to a jaxp-conform parser.)

Is this an eccentricity of the parsor (Xerces-j) or a normal behavior?
It it is the normal behavior, there is perhaps a advisable solution.
  #4  
Old July 25th, 2006, 04:35 AM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

SL wrote:
Quote:
Is this an eccentricity of the parsor (Xerces-j) or a normal behavior?
There is a recently added feature (driven by the XInclude
recommendation) which may be related to this. See

http://xerces.apache.org/xerces2-j/f...ixup-base-uris

Try turning that off, and see if it helps.

(I still don't think an XML parser should be adding xml:base
automatically unless you have explicitly asked it to do so, but...)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  #5  
Old July 25th, 2006, 09:35 AM
SL
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

Joe Kesselman a écrit :
Quote:
SL wrote:
Quote:
>Is this an eccentricity of the parsor (Xerces-j) or a normal behavior?
>
There is a recently added feature (driven by the XInclude
recommendation) which may be related to this. See
>
http://xerces.apache.org/xerces2-j/f...ixup-base-uris
>
Try turning that off, and see if it helps.
No, it doesn't help. There is a feature devoted to this in the DOM
API:

<http://apache.org/xml/features/dom/create-entity-ref-nodes>

according to this mail:

<http://marc.theaimsgroup.com/?l=xerces-j-dev&m=104057076909479&w=2>

Thanks for the pointer, it is a the right direction :-)
  #6  
Old July 25th, 2006, 10:15 AM
George Bina
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

Hi,

The recommended solution is to make your schema aware of these
attributes and allow them. Look also over the following article
(including comments) for more details:
http://norman.walsh.name/2005/04/01/xinclude

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


SL wrote:
Quote:
I try to validate against a schema a document stored in several files
thanks to external entities. The parseur add a 'xml:base="url"'
attribute on the root element of this sub-trees during parsing, so the
validation of the document fails.
>
Is there a recommanded solution to this situation ? I have no idea how
to handle the problem: I don't want to take into account at the
vocabulary level a question of syntax (the external entities) by
adding the xml:base attribute into my schema.
>
Thanks for any suggestion.
  #7  
Old July 25th, 2006, 10:55 AM
SL
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

"George Bina" a écrit :
Quote:
Hi,
>
The recommended solution is to make your schema aware of these
attributes and allow them. Look also over the following article
(including comments) for more details:
http://norman.walsh.name/2005/04/01/xinclude
Thanks ! This was exactly the kind of reference I was looking for. So
this behaviour is expected and the solution should be made into the
Schemas. I find quite curious the comment by Daniel Veillard on the
fact that xml:base is not necessary if the included tree is in the
same directory as the including one, it is rather a details.

I still find curious that Xerces add an xml:base attribute for
external /entities/. If I undestand correctly, external entities are a
mechanism from the syntactic side of XML (or perhaps even below, in
the "physical" side), and there is no reason to change vocabulary at
the semantic level.

  #8  
Old July 25th, 2006, 11:35 AM
Richard Tobin
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

In article <uu0566lsc.fsf@nospam.com>, SL <nospam@nospam.comwrote:
Quote:
>I still find curious that Xerces add an xml:base attribute for
>external /entities/. If I undestand correctly, external entities are a
>mechanism from the syntactic side of XML (or perhaps even below, in
>the "physical" side), and there is no reason to change vocabulary at
>the semantic level.
The base URI for resolving a relative URI reference in an XML document
is the base URI of the element it appears in, and that (in the absence
of xml:base attributes) is the URI of the external or document entity
containing the element.

So if a document at http://example.org/doc.xml uses an external entity
foo/bar.ent, then the base URI for relative URI references in that
entity is http://example.org/foo/bar.ent. But if you parse that
document and write it out again as a single file, the entity
boundaries are lost. Inserting xml:base attributes *when you write it
out* is a way to preserve the meaning of relative URI references.

I am unconvinced that it makes sense for the *parser* to insert the
xml:base attributes however; I would expect it instead to provide a
way to determine the base URI of an element taking into account the
entity boundaries.

-- Richard
  #9  
Old July 25th, 2006, 12:05 PM
SL
Guest
 
Posts: n/a
Default Re: xml:base attribute added by a parser make validation fails

Richard Tobin a écrit :
Quote:
In article <uu0566lsc.fsf@nospam.com>, SL <nospam@nospam.comwrote:
>
Quote:
>>I still find curious that Xerces add an xml:base attribute for
>>external /entities/. If I undestand correctly, external entities are
>>a mechanism from the syntactic side of XML (or perhaps even below,
>>in the "physical" side), and there is no reason to change vocabulary
>>at the semantic level.
>
The base URI for resolving a relative URI reference in an XML
document is the base URI of the element it appears in, and that (in
the absence of xml:base attributes) is the URI of the external or
document entity containing the element.
>
So if a document at http://example.org/doc.xml uses an external
entity foo/bar.ent, then the base URI for relative URI references in
that entity is http://example.org/foo/bar.ent. But if you parse
that document and write it out again as a single file, the entity
boundaries are lost. Inserting xml:base attributes *when you write
it out* is a way to preserve the meaning of relative URI references.
Of course I undestand the /utility/ of this xml:base attribute. But
I'm wondering if is not a violation of the /logic/ of the layered
nature of XML. With a xml:base attribute added on the sub-tree root
elements, a choice at the entity level constrains the semantic level.

One could even say that if you are interesting in the "/meaning/", as
you said, of the URI reference, you should not store this information
in the SYSTEM part of an entity declaration, since this mechanism is
for storing the document at the physical level, not for expressing
information at all. The division of the document into file is not
itself an "XML information", if I understand correctly the XML
infoset. I can imagine that there is good reason, in the XInclude
spec, for adding this xml:base element, since, for instance, this
XInclude is a mechanism defined at the vocabulary level ; but adding
this attribute to trees extracted by external entity seems break
compatibility.

Am I wrong with this idea?
Quote:
I am unconvinced that it makes sense for the *parser* to insert the
xml:base attributes however; I would expect it instead to provide a
way to determine the base URI of an element taking into account the
entity boundaries.
I agree ; even the startEntity(String name) method in SAX does not
report the URI of the entity, I don't understand why: it prevents from
serialising the document as it where received (the same sub-trees in
the same file), and limit the "bidirectionality" of SAX as an API.


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles