473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

xml:base attribute added by a parser make validation fails

SL
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.
Jul 24 '06 #1
8 2247
SL wrote:
The parseur add a 'xml:base="url"'
Try another parser?
Jul 24 '06 #2
SL
Joe Kesselman a écrit :
SL wrote:
>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.
Jul 24 '06 #3
SL wrote:
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
Jul 25 '06 #4
SL
Joe Kesselman a écrit :
SL wrote:
>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 :-)
Jul 25 '06 #5
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:
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.
Jul 25 '06 #6
SL
"George Bina" a écrit :
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.

Jul 25 '06 #7
In article <uu***********@nospam.com>, SL <no****@nospam.comwrote:
>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
Jul 25 '06 #8
SL
Richard Tobin a écrit :
In article <uu***********@nospam.com>, SL <no****@nospam.comwrote:
>>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?
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.
Jul 25 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kalessin | last post by:
I'm using PHP's XML parser to validate user-entered XHTML fragments (I wrap them in a top-level element and send them through the parser). It works a treat, except for handling entities: — --...
0
by: Roberto Nunnari | last post by:
Hi all. I announce that there's a brand new XML parser in the Open Source arena: NunniMJAX - release 1.0 http://nunnimjax.nunnisoft.ch NunniMJAX is a Java, non validating XML parser. Its...
1
by: Victor Porton | last post by:
What can be and what should be xml:base attribute? Should/can it end with a slash? What to do if it doesn't end with a slash? If xml:base="http://xxx.org/aaa/" anything is clear. But what if...
3
by: UndoMiel | last post by:
Hi, I am looking for an XML parser in C that is able to validate the XML documents against XSD Schema... Can anyone give me ideas? Thanks!
16
by: Mike | last post by:
Does anyone know of a minimal/mini/tiny/small xml parser in c? I'm looking for something small that accepts a stream or string, builds a c structure, and then returns an opaque pointer to that...
9
by: Martin Plantec | last post by:
Hello, I have managed (with your help!) to make a working XSLT stylesheet; it works fine locally (Windows Apache + PHP with Sablotron 1.0), but it fails on the remote host (FreeBSD Apache + PHP...
6
by: mahesh.kanakaraj | last post by:
Hi Folks, This is my first post to this group, and I really am not sure whether this is the right group to ask my question. If its not an appropriate question to this group, please correct me...
1
by: jaimemartin | last post by:
hello, I want to validate an xml by means of a schema (xsd). To do that first of all I´m using a SchemaFactory. The problem is that if I run the code in Windows all works fine, but If I run it in...
1
by: goldtech | last post by:
Hi, Basic XML questions, I have a .xml file I want to validate against a .xsd file... Does the Python base distribution come with a validating XML parser? I want to make sure the elements...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.