File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML JAXB external entities

 
Natt Gonzalez
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20161
23
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20161
23
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic