[opencms-dev] View special XML content files in the navigator as normal XML file

Sandrine Prousteau s.prousteau at eurelis.com
Fri Dec 7 17:55:56 CET 2007


Hi, 
I'd like to use my XML Content files as data container in a flash
resource, and to can edit it easily (I made my XML content types). So I
try to write a jsp template-elements wich make the XML content file work
as a simple xml file.

I try many codes like this:

	CmsObject cms_ = cms.getCmsObject();
	String uri = cms.getRequestContext().getUri();
	CmsResource rsrc = cms_.readResource(uri);
	org.opencms.xml.CmsXmlEntityResolver resolver = new
org.opencms.xml.CmsXmlEntityResolver(cms_);
	org.xml.sax.InputSource source = null;
	String systemId = CmsXmlEntityResolver.OPENCMS_SCHEME +
"system/modules/myprojet /schemas/regioncarte.xsd";
	String publicId = CmsXmlEntityResolver.OPENCMS_SCHEME +
"data/carte/xml/etablissements.html";
	source = resolver.resolveEntity(null,systemId);
	//byte[] bytes = org.opencms.util.CmsFileUtil.readFile(new
File(publicId));
	byte[] bytes =
org.opencms.util.CmsFileUtil.readFully(source.getByteStream());
	String string = org.opencms.i18n.CmsEncoder.createString(bytes,
"UTF-8");
	out.println(string);
	
This code allow me to have a navigator view of the xsd schema, but I
want my Xml content. With publicId instead of systemId, it doesn't work,
it make a null pointer exception.
I am lost with these fonctionnalities.

Is there someone who can explain me how it works?
Thanks.




More information about the opencms-dev mailing list