Gareth Western schrieb am 02.02.2009 um 22:20:40 (+0000):
> Hi,
> 
> I have an application which uses Xerces-J (2.9.0) to parse a large xml
> document which I'd like to split into several smaller files just to
> make it easier to manage.

> The schema prevents me from including the entire inner file, as that
> would result in nested function-set elements, so ideally i'd like to
> only include the functions from each inner file.

The answer is probably too late, but I just learnt about the entity
business that was saved from SGML into XML, and it might come in quite
handy here.

You could do without the new-fangled XInclude and XPointer stuff, by
using [general] external parsed entities and entity references to
organize your documents into physical components.

http://www.w3.org/TR/REC-xml/#sec-physical-struct

--------

C:\dev\XML\entities :: dir /b
AllFunctions.xml
AllFunctions2.xml
function-set.dtd
GroupFunctions.ent
GroupFunctions.xml
PrivateFunctions.ent
PrivateFunctions.xml

C:\dev\XML\entities :: type PrivateFunctions.ent
<function code="FC1000" />
<function code="FC1001" />

C:\dev\XML\entities :: type GroupFunctions.ent
<function code="FC5000" />
<function code="FC5001" />

C:\dev\XML\entities :: type PrivateFunctions.xml
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE function-set [
<!ENTITY PrivateFunctions SYSTEM "PrivateFunctions.ent">
]>
<function-set>
        &PrivateFunctions;
</function-set>

C:\dev\XML\entities :: type GroupFunctions.xml
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE function-set [
<!ENTITY GroupFunctions SYSTEM "GroupFunctions.ent">
]>
<function-set>
        &GroupFunctions;
</function-set>

C:\dev\XML\entities :: type AllFunctions.xml
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE function-set [
<!ENTITY PrivateFunctions SYSTEM "PrivateFunctions.ent">
<!ENTITY GroupFunctions   SYSTEM "GroupFunctions.ent">
]>
<function-set>
        &PrivateFunctions;
        &GroupFunctions;
</function-set>

--------

You could also put all the entity declarations into a DTD and reference
it from your document entities.

C:\dev\XML\entities :: type function-set.dtd
<!ELEMENT function-set (function*)>
<!ELEMENT function EMPTY>
<!ATTLIST function code NMTOKEN #REQUIRED>
<!ENTITY PrivateFunctions SYSTEM "PrivateFunctions.ent">
<!ENTITY GroupFunctions   SYSTEM "GroupFunctions.ent">

C:\dev\XML\entities :: type AllFunctions2.xml
<?xml version="1.0"?>
<!DOCTYPE function-set SYSTEM "function-set.dtd">
<function-set>
        &PrivateFunctions;
        &GroupFunctions;
</function-set>

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to