I'm having a problem using the XML "include" mechanism, which I think
has to do with namespaces.
I have an XML file that has a lot of repetition--a sequence of elements
that appear multiple times. My thought was to copy this sequence into
a separate file, then use an entity defn to refer to that separate
file:
<!ENTITY ThirdPersonAllB utTense SYSTEM "3PersNotTense. xml">
and replace the sequences with &ThirdPersonAll ButTense;. (There's no
particular reason this sequence of elements should go into an
*external* file, but I can't figure out how to define an entity as a
sequence of elements in any other way.)
But I get an error msg from xmllint:
Element 'FeatureValueSe t': This element is not expected.
Expected is (
{http://lodl.ldc.upenn. edu/ParadigmDefn.xs d}FeatureValueS et ).
If I understand this correctly, it's saying it expected to find a
namespace identifier in front of the element name (and it's suggesting
a URL as the identifier). This namespace is defined as the default
namespace in the "calling" file, i.e.
<ParadigmDefn s xmlns ="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d"
...>
There is no namespace definition in the included file. (Should there
be? How?)
I'm unsure why it wants this identifier (if that is indeed what this
error msg means). My concept of what this external entity inclusion
does, is that it just copies the contents of the external file in place
of the entity. Obviously my concept is wrong, or I wouldn't be getting
an error msg, but I'm unsure why.
Apologies if the above is unclear/ uses the wrong terminology... 22 1719
In article <11************ **********@i40g 2000cwc.googleg roups.com>,
<ma*****@ldc.up enn.edu> wrote: I have an XML file that has a lot of repetition--a sequence of elements that appear multiple times. My thought was to copy this sequence into a separate file, then use an entity defn to refer to that separate file:
<!ENTITY ThirdPersonAllB utTense SYSTEM "3PersNotTense. xml">
and replace the sequences with &ThirdPersonAll ButTense;. (There's no particular reason this sequence of elements should go into an *external* file, but I can't figure out how to define an entity as a sequence of elements in any other way.)
You can use an internal entity equally well, for example:
<!DOCTYPE foo [
<!ELEMENT foo (bar*)>
<!ELEMENT bar EMPTY>
<!ENTITY lots-of-bars "
<bar/>
<bar/>
<bar/>
<bar/>
<bar/>
">
]>
<foo>
&lots-of-bars;
&lots-of-bars;
</foo>
Element 'FeatureValueSe t': This element is not expected. Expected is ( {http://lodl.ldc.upenn. edu/ParadigmDefn.xs d}FeatureValueS et ).
If I understand this correctly, it's saying it expected to find a namespace identifier in front of the element name (and it's suggesting a URL as the identifier). This namespace is defined as the default namespace in the "calling" file, i.e.
<ParadigmDefn s xmlns ="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d" ...>
There is no namespace definition in the included file. (Should there be? How?)
I'm unsure why it wants this identifier (if that is indeed what this error msg means). My concept of what this external entity inclusion does, is that it just copies the contents of the external file in place of the entity.
That's right; entites work at a textual level before namespace processing.
I don't know why you're getting this error message. Perhaps you could
post a complete cut-down example so others can check it.
-- Richard
> Perhaps you could post a complete cut-down example so others can check it.
I was afraid you were going to say that :-). The file is (by my
standards at least) large and complex, so it will take me awhile to
trim it down to s.t. manageable. But I'll try, and thanks for the
suggestion!
OK, I trimmed it down. Unfortunately, I'm posting on Google groups, so
I can't attach files (maybe that's a no-no here anyway?). So, here
goes:
First, the schema, which I have in a file BugSchema.xsd:
---------------BugSchema.xsd-----------------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd ="http://www.w3.org/2001/XMLSchema"
targetNamespace
="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d"
xmlns
="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d"
elementFormDefa ult ="qualified"
<xsd:element name="ParadigmD efns">
<xsd:complexTyp e>
<xsd:sequence >
<xsd:element ref="Paradigm" minOccurs="1"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
</xsd:element>
<xsd:element name="Paradigm" >
<xsd:complexTyp e>
<xsd:sequence >
<xsd:element ref="FeatureVal ueSet" minOccurs="1"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
</xsd:element>
<xsd:element name="FeatureVa lueSet">
</xsd:element>
</xsd:schema>
-----------------------------------------------------------
Next, the file to be validated against that schema, Bug.Defn.xml:
------------------Bug.Defn.xml--------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE ParadigmDefn
[<!ENTITY Inclusion SYSTEM "IncludeBug.xml ">]
<ParadigmDefn s xmlns
="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://lodl.ldc.upenn. edu
ParadigmDefn.xs d"
<Paradigm>
<!--If the ff. '&Inclusion;' is commented out, this file
validates.-->
&Inclusion;
<FeatureValueSe t></FeatureValueSet >
</Paradigm>
</ParadigmDefns>
-----------------------------------------
And finally, the "include" file, IncludeBug.xml:
--------------------IncludeBug.xml---------------
<FeatureValueSe t></FeatureValueSet >
-----------------------------------------
You'll notice that this line is identical to the line that appears
immediately below the '&Inclusion;' ; the latter line does not cause any
problem, if the '&Inclusion;' is commented out.
The error msg happens (if the inclusion is not commented out) when I
run the ff. cmd:
xmllint --noout --noent --schema BugSchema.xsd TestSuite/bug.Defn.xml
Specifically, the error msg is:
Element 'FeatureValueSe t': This element is not expected. Expected is
( {http://lodl.ldc.upenn. edu/ParadigmDefn.xs d}FeatureValueS et ).
TestSuite/bug.Defn.xml fails to validate
I'm running this under CygWin. xmllint reports "using libxml version
20622 of the in-memory document" (whatever that means--sounds like an
odd version #, but...)
Thanks for any suggestions!
Remember, inclusion in XML is semantic, NOT string based.
Your external entity doesn't define a default namespace, nor does it use
prefixes bound to a namespace. Ergo, its elements are NOT in any
namespace. Ergo, they are NOT the same as the ones in the namespace.
That's exactly what the error message is telling you: Element 'FeatureValueSe t': This element is not expected. Expected is ( {http://lodl.ldc.upenn. edu/ParadigmDefn.xs d}FeatureValueS et ). TestSuite/bug.Defn.xml fails to validate
You provided a <FeatureValueSe t>; it expected a
<FeatureValueSe t xmlns="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d">, or
<foo:FeatureVal ueSet
xmlns:foo="http ://lodl.ldc.upenn. edu/ParadigmDefn.xs d">, or something
equivalent.
Fix your external entity.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
> Remember, inclusion in XML is semantic, NOT string based.
That definitely seems to be what's happening, but it's not what I
expected from statements like
You can specify an entity that has text defined external to
the document by using the SYSTEM keyword...
In this case, the XML processor will parse the content of
that file as if its content had been typed at the location
of the entity reference.
(--http://www.javacommerc e.com/displaypage.jsp ?name=entities. sql&id=18238) You provided a <FeatureValueSe t>; it expected a <FeatureValueSe t xmlns="http://lodl.ldc.upenn. edu/ParadigmDefn.xs d">, or <foo:FeatureVal ueSet xmlns:foo="http ://lodl.ldc.upenn. edu/ParadigmDefn.xs d">, or something equivalent.
Fix your external entity.
In the actual file (not the cut down one that I posted here), there is
a long series of these entities
<FeatureValueSe t>foo</FeatureValueSet >
<FeatureValueSe t>bar</FeatureValueSet >
<FeatureValueSe t>baz</FeatureValueSet >
etc., and I want to splice that *sequence* in at several points. I can
put in the xmlns in each one of these entites, but is there a way in
this external file of specifying the xmlns once, rather than repeatedly? ma*****@ldc.upe nn.edu wrote: Remember, inclusion in XML is semantic, NOT string based.
That definitely seems to be what's happening, but it's not what I expected from statements like
Hmmmm. Let me think about that.
Part of the problem here is that namespaces were introduced after the
XML spec, so you get into odd situations where DTD behavior is
non-namespace-aware but later layers *are* namespace aware.
So I think I may be wrong; the inclusion -- because external entities
are defined by the XML spec rather than XML-plus-namespaces -- probably
should have occurred syntactically, and probably should have picked up
the namespace context at the point where you brought it in.
Interesting. I need to dig into this one more deeply to really convince
myself, and I should try it in a parser I trust to see what it thinks
should happen.
Which parser are you using?
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Actually, I haven't tested this with any application/ parser, only with
xmllint. ma*****@ldc.upe nn.edu wrote: Actually, I haven't tested this with any application/ parser, only with xmllint.
Not familiar with it. It may be wrong...
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
>> Actually, I haven't tested this with any application/ parser, only with xmllint.
Not familiar with it. It may be wrong...
Could be. It uses xmllib, for what that's worth. http://xmlsoft.org/xmllint.html is a man page, but I get the executable
in the CygWin package.
Can you suggest another (better!) parser that I could use to validate
the xml file against my schema? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nathan Lamont |
last post by:
I would like to make use of two separate PHP applications which happen
to share some class names; trying to include both from one script
results in the expected error, "cannot redefine class foo." or somesuch.
Using a fully qualified URL instead of the local file path in the
include() would work, except that the applications then do not have
access to the users cookies -- the requests are coming from the server
itself, not the user.
...
|
by: Tom Cat |
last post by:
Is there anything wrong with using a lot of include files?
On one part of my website, I have a form. The page it posts data to,
includes a different file based on some of the values. The include
files also include other pages based on different values. All of
these work together to select the right information from the database
and display it in the correct format.
I'm just wondering if it is better to put all the code in one file...
|
by: tshad |
last post by:
If I create multiple .dll files with the same namespace, but different
classes. Is this the same thing as creating one file with one Namespace and
all the classes in that namespace?
If so, is it better to create multiple files or just one big file?
Also, what causes ASP to look at each .dll file in the Bin folder. Even
when I make changes, they seem to get picked up.
How does ASP know to load the new .dll or the same .dll again if...
|
by: Calvin |
last post by:
Hi
I' m sorry the thread is a bit off topic, but there is no support from the vbcommenter page
I'm using vbcommenter 1.1
I have the following problem.
In some method the namespaces are not included in the name attribute of the XML file, generated by the vbcommenter.
NDOC cannot use it to generate a correct comment.
|
by: spike grobstein |
last post by:
So, I've got this project I'm working on where the app defines various
classes that are subclassed by module packages that act like plugins...
I'd like the packages to define a file path for supporting files
(graphics, etc) that are stored inside the package. The problem is that
the superclass's definition (stored elsewhere) has all of the code for
actually opening the files, so when I use the
os.path.dirname(os.path.abspath(__file__))...
| |
by: Jon Rea |
last post by:
I am currently cleaning up an application which was origainlly hashed
together with speed of coding in mind and therefore contains quite a few
"hacky" shortcuts.
As part of this "revamping" process I am introducing namespaces to
properly compartmentalise sections of the code into logical units. What
I am speciffically trying to get right is the dependency tree for header
files to reduce compile time and simplify the code structure.
On...
|
by: Wescotte |
last post by:
I have an application that uses several file formats for similar data.
So I've created various php files for each format containing the same
functions which produce the same end result.
Now I currently have a functions setup that just reads a file and
determines which file type it is and includes the correct source. My
goal is add a new function to each source called
My_File_Format($filename) where each file checks to see if the...
|
by: =?Utf-8?B?RGFuYQ==?= |
last post by:
I am re-posting this message after registering my posting alias.
When I specify an end tag for the clear element of namespaces in my
web.config file, the parser error "Unrecognized element 'add'" is reported.
....
<pages>
<namespaces>
<clear></clear>
<add namespace="System"/>
|
by: javatoil260309 |
last post by:
Hi all,
I have using JAXB to generate XML from a XSD file.
So far so good. But i noticed that all the URL's (namespaces in the xsd)
are not present in the generated xml. TO be precise my XSD file contains 4 namespaces ( which includes "http://www.w3.org/2001/XMLSchema" and 3 others), but my generated xml shows only 1 namespace. How do i resolve this issue?.
Any help will be appreciated. Thanks in advance.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |