aspose file tools*
The moose likes XML and Related Technologies and the fly likes XML JAXB external entities Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML JAXB external entities" Watch "XML JAXB external entities" New topic
Author

XML JAXB external entities

Natt Gonzalez
Ranch Hand

Joined: Apr 28, 2008
Posts: 31
Hi,
I have an xml that I unmurshall in my application in this way
susUnmarshaller = susFactory.createUnmarshaller();
susUnmarshaller.unmarshal(docXML);

I have a too long xml and it's very difficult to mantaint so I have decided to use external entities.
I have my xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE Perfil [
<!ENTITY controles SYSTEM "Controls.xml">
]>


<Perfil xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PerfilXML.xsd">
.....
&controles;

And my Controls.xml file has xml elemets I have before in the main xml file.

When I try to unmarshal the new xml file I have errors.
DefaultValidationEventHandler: [FATAL_ERROR]: More pseudo attributes are expected.

I don't know where is the problem.
Any help would be apreciated.
Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

I doubt that XML validators can handle schemas and DTDs in the same document. I could be wrong but if I were writing a validator I wouldn't bother with such an unusual idea.
Natt Gonzalez
Ranch Hand

Joined: Apr 28, 2008
Posts: 31
ok, so how can I divide my too long xml into other xml files and include all of them in one?I have no idea.I'm looking for it through internet.
Thank you so much
Natt Gonzalez
Ranch Hand

Joined: Apr 28, 2008
Posts: 31
It works if I remove xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PerfilXML.xsd"
This is the content of my xml. I have to investigate how can I put the Schema.

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE Perfil [
<!ENTITY controles SYSTEM "Controls.xml">
]>


<Perfil >
.....
&controles;

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Natt Gonzalez wrote:ok, so how can I divide my too long xml into other xml files and include all of them in one?


Since you use that word... you could look into XInclude. Warning: all I know about it is what I read in that page.
 
Don't get me started about those stupid light bulbs.
 
subject: XML JAXB external entities